diff --git a/Gemfile b/Gemfile index 7e4d12c8e..345f8031f 100644 --- a/Gemfile +++ b/Gemfile @@ -88,7 +88,8 @@ gem 'groupdate' gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8' -gem 'spreadsheet_architect', '~> 1.4.8' # https://github.com/westonganger/spreadsheet_architect/issues/14 +gem 'spreadsheet_architect' +gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365 gem 'apipie-rails' # For Markdown support in apipie diff --git a/Gemfile.lock b/Gemfile.lock index 94942b01a..3b718b9fd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,10 +96,14 @@ GEM attr_required (1.0.1) autoprefixer-rails (8.3.0) execjs - axlsx (2.0.1) - htmlentities (~> 4.3.1) - nokogiri (>= 1.4.1) - rubyzip (~> 1.0.0) + axlsx (3.0.0.pre) + htmlentities (~> 4.3, >= 4.3.4) + mimemagic (~> 0.3) + nokogiri (~> 1.8, >= 1.8.2) + rubyzip (~> 1.2, >= 1.2.1) + axlsx_styler (0.2.0) + activesupport (>= 3.1) + axlsx (>= 2.0, < 4) bcrypt (3.1.12) bindata (2.4.3) bindex (0.5.0) @@ -632,10 +636,10 @@ GEM rgeo (1.0.0) rgeo-geojson (2.0.0) rgeo (~> 1.0) - rodf (0.3.7) - activesupport (>= 3.0, < 6.0) - builder (~> 3.0) - rubyzip (~> 1.0) + rodf (1.0.0) + activesupport (>= 3.0) + builder (>= 3.0) + rubyzip (>= 1.0) rspec (3.7.0) rspec-core (~> 3.7.0) rspec-expectations (~> 3.7.0) @@ -673,7 +677,7 @@ GEM ruby_dep (1.5.0) ruby_parser (3.11.0) sexp_processor (~> 4.9) - rubyzip (1.0.0) + rubyzip (1.2.2) safe_yaml (1.0.4) sanitize-url (0.1.4) sass (3.5.6) @@ -722,9 +726,10 @@ GEM jquery-rails kaminari (>= 0.17) rails (>= 3.2) - spreadsheet_architect (1.4.8) - axlsx (>= 2.0) - rodf (= 0.3.7) + spreadsheet_architect (3.1.0) + axlsx (>= 2, < 4) + axlsx_styler (>= 0.1.7, < 2) + rodf (>= 1.0.0, < 2) spring (2.0.2) activesupport (>= 4.2) spring-commands-rspec (1.0.4) @@ -809,6 +814,7 @@ DEPENDENCIES administrate after_party apipie-rails + axlsx (~> 3.0.0.pre) bootstrap-sass (~> 3.3.5) bootstrap-wysihtml5-rails (~> 0.3.3.8) brakeman @@ -885,7 +891,7 @@ DEPENDENCIES simple_form skylight smart_listing - spreadsheet_architect (~> 1.4.8) + spreadsheet_architect spring spring-commands-rspec therubyracer @@ -902,4 +908,4 @@ DEPENDENCIES xray-rails BUNDLED WITH - 1.16.2 + 1.16.3 diff --git a/app/assets/javascripts/old_design/admin_procedures_modal.js b/app/assets/javascripts/old_design/admin_procedures_modal.js index a2076e174..d02923e37 100644 --- a/app/assets/javascripts/old_design/admin_procedures_modal.js +++ b/app/assets/javascripts/old_design/admin_procedures_modal.js @@ -1,10 +1,12 @@ $(document).on('turbolinks:load', init_path_modal); +var PROCEDURE_PATH_SELECTOR = 'input[data-autocomplete=path]'; + function init_path_modal() { path_modal_action(); path_validation_action(); path_type_init(); - path_validation($("input[id='procedure_path']")); + path_validation($(PROCEDURE_PATH_SELECTOR)); } function path_modal_action() { @@ -22,7 +24,7 @@ function path_modal_action() { } function path_validation_action() { - $("input[id='procedure_path']").keyup(function (key) { + $(PROCEDURE_PATH_SELECTOR).keyup(function (key) { if (key.keyCode != 13) path_validation(this); }); @@ -57,7 +59,7 @@ function validatePath(path) { } function path_type_init() { - $('#procedure_path').bind('autocomplete:select', function(ev, suggestion) { + $(PROCEDURE_PATH_SELECTOR).bind('autocomplete:select', function(ev, suggestion) { togglePathMessage(true, suggestion['mine']); }); } diff --git a/app/javascript/packs/application-old.js b/app/javascript/packs/application-old.js index 5bd38c5ea..44fa321c8 100644 --- a/app/javascript/packs/application-old.js +++ b/app/javascript/packs/application-old.js @@ -12,6 +12,7 @@ import '../shared/sentry'; import '../shared/rails-ujs-fix'; import '../shared/safari-11-file-xhr-workaround'; import '../shared/autocomplete'; +import '../shared/remote-input'; // Start Rails helpers Rails.start(); diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 563e8a386..64c5c01c7 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -14,6 +14,7 @@ import '../shared/sentry'; import '../shared/rails-ujs-fix'; import '../shared/safari-11-file-xhr-workaround'; import '../shared/autocomplete'; +import '../shared/remote-input'; import '../new_design/buttons'; import '../new_design/form-validation'; diff --git a/app/javascript/shared/remote-input.js b/app/javascript/shared/remote-input.js new file mode 100644 index 000000000..d03e69640 --- /dev/null +++ b/app/javascript/shared/remote-input.js @@ -0,0 +1,24 @@ +import Rails from 'rails-ujs'; +import debounce from 'debounce'; + +const { delegate, fire } = Rails; + +const remote = 'data-remote'; +const inputChangeSelector = `input[${remote}], textarea[${remote}]`; + +// This is a patch for ujs remote handler. Its purpose is to add +// a debounced input listener. +function handleRemote(event) { + const element = this; + + if (isRemote(element)) { + fire(element, 'change', event); + } +} + +function isRemote(element) { + const value = element.getAttribute(remote); + return value && value !== 'false'; +} + +delegate(document, inputChangeSelector, 'input', debounce(handleRemote, 200)); diff --git a/app/views/accessibilite/index.html.haml b/app/views/accessibilite/index.html.haml index 0923c5d65..adcdbb3d9 100644 --- a/app/views/accessibilite/index.html.haml +++ b/app/views/accessibilite/index.html.haml @@ -9,7 +9,7 @@ %h2.new-h2 Signaler un dysfonctionnement %p.new-p - = "Si, malgré notre vigilance, vous rencontriez le moindre problème d’accessibilité sur notre site, n’hésitez pas à #{contact_link('nous écrire', tags: 'a11y')}." + Si, malgré notre vigilance, vous rencontriez le moindre problème d’accessibilité sur notre site, n’hésitez pas à #{contact_link('nous écrire', tags: 'a11y')}. %h2.new-h2 Défenseur des droits %p.new-p diff --git a/package.json b/package.json index 2e512ce4a..b68dcd7ed 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "activestorage": "^5.2.0", "autocomplete.js": "^0.31.0", "chartkick": "^2.3.6", + "debounce": "^1.2.0", "highcharts": "^6.1.1", "jquery": "^3.3.1", "leaflet": "^1.3.1", diff --git a/yarn.lock b/yarn.lock index f09c468b5..72a33df3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2137,6 +2137,10 @@ dateformat@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" +debounce@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131" + debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"