Skip to content

Commit

Permalink
Merge branch 'main' into cdpt-2125-rails-7-2
Browse files Browse the repository at this point in the history
  • Loading branch information
vertism committed Jan 10, 2025
2 parents d56f15c + ce63ab2 commit 188d533
Show file tree
Hide file tree
Showing 174 changed files with 3,682 additions and 2,495 deletions.
261 changes: 56 additions & 205 deletions .github/workflows/deploy.yml

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions .github/workflows/notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Notification Workflow

on:
workflow_call:
secrets:
webhook_url:
required: true
inputs:
build_tag:
required: true
type: string
environment:
required: true
type: string

jobs:
notify:
runs-on: ubuntu-latest
name: "notify-${{ inputs.environment }}"

steps:
- name: Slack notification
uses: slackapi/slack-github-action@v2.0.0
with:
webhook: ${{ secrets.webhook_url }}
webhook-type: incoming-webhook
payload: |
{
"attachments": [
{
"color": "#1d990c",
"text": "${{ github.actor }} deployed *${{ inputs.build_tag }}* to *${{ inputs.environment }}*",
"fields": [
{
"title": "Project",
"value": "Correspondence Tool Staff",
"short": true
}
],
"footer": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
32 changes: 30 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,35 @@ jobs:
- name: Security audit application code
run: bundle exec brakeman -q

javascript_test:
runs-on: ubuntu-latest
permissions:
checks: write

env:
RAILS_ENV: test
CI: true

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Allow tests to run
run: |
mkdir -p log tmp tmp/pids
sudo sed -i 's/openssl_conf = openssl_init/#openssl_conf = openssl_init/g' /etc/ssl/openssl.cnf
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Install packages
run: yarn install --pure-lockfile

- name: Javascript tests
run: bundle exec teaspoon

test:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -131,7 +160,6 @@ jobs:
minimum_file_coverage: 100

build-and-deploy:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [linting, coverage]
needs: [linting, javascript_test, coverage]
uses: ./.github/workflows/deploy.yml
secrets: inherit
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gem "humanize_boolean"
gem "jbuilder", "~> 2.11"
gem "jquery-rails", "~> 4.5"
gem "jquery-ui-rails"
gem "jsonb_accessor", "~> 1.3.2"
gem "jsonb_accessor", "~> 1.4"
gem "jwe"
gem "kaminari"
gem "libreconv", "~> 0.9.5"
Expand Down Expand Up @@ -66,7 +66,7 @@ gem "sass-rails", "~> 6.0"
gem "sentry-rails"
gem "sentry-ruby"
gem "shell-spinner"
gem "sidekiq", "<7"
gem "sidekiq", "<8"
gem "slim-rails", "~> 3.6"
gem "sprockets", "~> 4.2.1"

Expand Down Expand Up @@ -99,8 +99,10 @@ group :development, :test do
gem "colorize"
gem "debug", ">= 1.0.0"
gem "parallel_tests"
gem "phantomjs"
gem "rspec-collection_matchers"
gem "rspec-rails", "~> 6.0"
gem "rubocop-govuk", require: false
gem "selenium-webdriver"
gem "teaspoon-jasmine"
end
54 changes: 32 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ GEM
base64 (0.2.0)
bcrypt (3.1.20)
benchmark (0.4.0)
better_errors (2.9.1)
coderay (>= 1.0.0)
better_errors (2.10.1)
erubi (>= 1.0.0)
rack (>= 0.9.0)
rouge (>= 1.0.0)
better_html (2.1.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.8)
bigdecimal (3.1.9)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
bootsnap (1.11.1)
Expand Down Expand Up @@ -164,7 +164,6 @@ GEM
caxlsx_rails (0.6.3)
actionpack (>= 3.1)
caxlsx (>= 3.0)
coderay (1.1.3)
colorize (0.8.1)
concurrent-ruby (1.3.4)
config (5.5.2)
Expand Down Expand Up @@ -267,9 +266,9 @@ GEM
jquery-ui-rails (7.0.0)
railties (>= 3.2.16)
json (2.8.2)
jsonb_accessor (1.3.4)
activerecord (>= 5.0)
activesupport (>= 5.0)
jsonb_accessor (1.4)
activerecord (>= 6.1)
activesupport (>= 6.1)
pg (>= 0.18.1)
jwe (0.4.0)
jwt (2.7.0)
Expand All @@ -287,7 +286,7 @@ GEM
kaminari-core (1.2.2)
language_server-protocol (3.17.0.3)
libreconv (0.9.5)
logger (1.6.1)
logger (1.6.4)
lograge (0.12.0)
actionpack (>= 4)
activesupport (>= 4)
Expand All @@ -306,10 +305,11 @@ GEM
matrix (0.4.2)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.25.1)
minitest (5.25.4)
msgpack (1.5.1)
multi_json (1.15.0)
multi_xml (0.6.0)
mutex_m (0.3.0)
net-imap (0.5.1)
date
net-protocol
Expand All @@ -320,12 +320,12 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.4)
nokogiri (1.16.7)
nokogiri (1.16.8)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
nokogiri (1.16.8-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.16.8-x86_64-linux)
racc (~> 1.4)
notifications-ruby-client (5.4.0)
jwt (>= 1.5, < 3)
Expand Down Expand Up @@ -363,6 +363,7 @@ GEM
pg_search (2.3.6)
activerecord (>= 5.2)
activesupport (>= 5.2)
phantomjs (2.1.1.0)
prawn (2.4.0)
pdf-core (~> 0.9.0)
ttfunk (~> 1.7)
Expand Down Expand Up @@ -411,9 +412,9 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.1)
loofah (~> 2.21)
nokogiri (~> 1.14)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
Expand All @@ -433,7 +434,8 @@ GEM
rdoc (6.8.1)
psych (>= 4.0.0)
recursive-open-struct (1.2.2)
redis (4.8.1)
redis-client (0.23.0)
connection_pool
regexp_parser (2.9.2)
reline (0.5.11)
io-console (~> 0.5)
Expand All @@ -443,6 +445,7 @@ GEM
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.9)
rouge (4.5.1)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.12.2)
Expand Down Expand Up @@ -537,10 +540,11 @@ GEM
colorize
shoulda-matchers (5.1.0)
activesupport (>= 5.2.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
sidekiq (7.3.7)
connection_pool (>= 2.3.0)
logger
rack (>= 2.2.4)
redis-client (>= 0.22.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -572,6 +576,10 @@ GEM
sprockets (>= 3.0.0)
stringio (3.1.2)
table_print (1.5.7)
teaspoon (1.4.0)
railties (>= 5.0)
teaspoon-jasmine (2.9.1)
teaspoon (>= 1.0.0)
temple (0.10.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand All @@ -580,7 +588,7 @@ GEM
thor (1.3.2)
tilt (2.1.0)
timecop (0.9.6)
timeout (0.4.2)
timeout (0.4.3)
ttfunk (1.7.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
Expand Down Expand Up @@ -647,7 +655,7 @@ DEPENDENCIES
jbuilder (~> 2.11)
jquery-rails (~> 4.5)
jquery-ui-rails
jsonb_accessor (~> 1.3.2)
jsonb_accessor (~> 1.4)
jwe
kaminari
libreconv (~> 0.9.5)
Expand All @@ -663,6 +671,7 @@ DEPENDENCIES
parallel_tests
pg (~> 1.3)
pg_search (~> 2.3.6)
phantomjs
prawndown
puma (~> 6.4)
pundit (~> 2.1)
Expand All @@ -682,13 +691,14 @@ DEPENDENCIES
sentry-ruby
shell-spinner
shoulda-matchers (~> 5.1)
sidekiq (< 7)
sidekiq (< 8)
simplecov
simplecov-json
site_prism (< 5.0)
slim-rails (~> 3.6)
sprockets (~> 4.2.1)
table_print
teaspoon-jasmine
terser
timecop
turbolinks (~> 5)
Expand Down
25 changes: 0 additions & 25 deletions app/assets/javascripts/modules/DataRequestActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,5 @@ moj.Modules.DataRequestActions = {
$yyyy_field.val(year);
}
});

$('#new_data_request').submit(function() {
self.clearNoteField();
});

$('#edit_data_request').submit(function() {
self.clearNoteField();
});

},

clearNoteField: function() {
if (!$('#data_request_request_type_bwcf').is(':checked')) {
$('#request_type_bwcf_panel').empty();
}
if (!$('#data_request_request_type_cctv').is(':checked')) {
$('#request_type_cctv_panel').empty();
}
if (!$('#data_request_request_type_other').is(':checked')) {
$('#request_type_other_panel').empty();
}
if (!$('#data_request_request_type_nomis_other').is(':checked')) {
$('#request_type_nomis_other_panel').empty();
}
}

};
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
@import "moj/component/teams";
@import "moj/component/quick_links";
@import "moj/component/data_request";
@import "moj/component/data_request_area";
@import "moj/component/letters";
@import "moj/component/moj_banner";
@import "moj/case_tabs";
Expand Down
12 changes: 11 additions & 1 deletion app/assets/stylesheets/moj/_govuk_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ td {
.form-group {
margin-bottom: 2em;
}

.govuk-tag {
font-size: 100%;
}
}

// End making font sizes adjustable
Expand Down Expand Up @@ -207,7 +211,13 @@ td {
}
}

.data-request #data_request_location:disabled {
.data-requests .govuk-button--warning{
@include button($red);
margin-right: $gutter;
margin-top: $gutter;
}

.data-request #data_request_location:disabled, .data-request-area #data_request_area_location:disabled {
border-color: $grey-2;
}

Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/moj/component/_data_request_area.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.data-request-area {
&__number {
margin-bottom: $gutter-half;
}
}
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def set_user
def maintenance_mode
redirect_to "/" and return unless maintenance_mode_on?

render layout: nil, file: "layouts/maintenance"
render "layouts/maintenance", layout: nil
end

private
Expand All @@ -43,7 +43,7 @@ def check_maintenance_mode
end

def maintenance_mode_on?
File.exist? Rails.root.join("maintenance.txt")
ENV["MAINTENANCE_MODE"] == "ON"
end

def download_csv_request?
Expand Down
Loading

0 comments on commit 188d533

Please sign in to comment.