Skip to content

Commit

Permalink
Move progressive enhancement so it can be used in editor preview
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenLeighton21 committed Jul 13, 2023
1 parent 3aa2957 commit 861d54a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ministryofjustice/fb-metadata-presenter.git
revision: c94797fc9954f06d99ea8bed5f93722a06ba3a76
revision: b8b8166f9a93165f5c9ebe605abe2b2ce7eaa5ae
branch: multi-file-upload
specs:
metadata_presenter (3.0.12)
Expand Down Expand Up @@ -185,7 +185,7 @@ GEM
sentry-rails (~> 5.3)
sentry-ruby (~> 5.3)
statsd-ruby (~> 1.5)
govuk_design_system_formbuilder (4.0.0)
govuk_design_system_formbuilder (4.1.0)
actionview (>= 6.1)
activemodel (>= 6.1)
activesupport (>= 6.1)
Expand Down
1 change: 0 additions & 1 deletion app/javascript/packs/runner_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList'
require("@rails/ujs").start()
require("../src/runner/contentloaded.js")
require("../src/runner/analytics")
require("../src/runner/multiupload")
require("../src/runner/index")

// Entry point for fb-editor stylesheets
Expand Down
1 change: 1 addition & 0 deletions app/javascript/src/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import TimeoutWarning from './timeout-warning.js'
const {
htmlAdjustment
} = require('../shared/content');
require('../shared/multiupload.js');

const ENVIRONMENT_PREVIEW = "preview";
const ENVIRONMENT_RUNNER = "runner";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ function showFileUpload() {
uploadFile.removeAttribute('hidden');
}

// function upload() {

// }

// So we can just access required functions from the window object
window.multiupload = {
Expand Down
2 changes: 0 additions & 2 deletions app/models/user_data_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ def answers

def set_uploaded_file_details
if @page_answers.uploaded_files.present?
# byebug
@page_answers.uploaded_files.map do |uploaded_file|
if uploaded_file.component.type == 'multiupload'
# byebug
# merge the uploaded file into the last file in the component
@answer_params[uploaded_file.component.id][-1] =
@page_answers.send(uploaded_file.component.id)[uploaded_file.component.id].last.merge(uploaded_file.file)
Expand Down

0 comments on commit 861d54a

Please sign in to comment.