diff options
| -rw-r--r-- | app/javascript/vehicle_journeys/components/tools/CreateModal.js | 3 | ||||
| -rw-r--r-- | app/models/chouette/routing_constraint_zone.rb | 2 | ||||
| -rw-r--r-- | app/models/concerns/metadata_support.rb | 4 | ||||
| -rw-r--r-- | config/environments/development.rb | 4 | ||||
| -rw-r--r-- | config/environments/production.rb | 2 | ||||
| -rw-r--r-- | spec/features/calendars_permissions_spec.rb | 4 | ||||
| -rw-r--r-- | spec/features/routing_constraint_zones_spec.rb | 4 | ||||
| -rw-r--r-- | spec/features/workbenches/workbenches_permissions_spec.rb | 4 |
8 files changed, 17 insertions, 10 deletions
diff --git a/app/javascript/vehicle_journeys/components/tools/CreateModal.js b/app/javascript/vehicle_journeys/components/tools/CreateModal.js index 1d470cd43..2806708f4 100644 --- a/app/javascript/vehicle_journeys/components/tools/CreateModal.js +++ b/app/javascript/vehicle_journeys/components/tools/CreateModal.js @@ -14,7 +14,8 @@ export default class CreateModal extends Component { handleSubmit() { if(!this.props.modal.modalProps.selectedJPModal){ let field = $('#NewVehicleJourneyModal').find(".vjCreateSelectJP") - field.parent().parent().addClass('has-error').children('.help-block').remove() + field.parent().parent().addClass('has-error') + field.parent().children('.help-block').remove() field.parent().append("<span class='small help-block'>" + I18n.t("simple_form.required.text") + "</span>") return } diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb index 2cfb60bdd..6b7c228b0 100644 --- a/app/models/chouette/routing_constraint_zone.rb +++ b/app/models/chouette/routing_constraint_zone.rb @@ -1,6 +1,6 @@ module Chouette class RoutingConstraintZone < Chouette::TridentActiveRecord - # has_metadata + has_metadata include ChecksumSupport include ObjectidSupport diff --git a/app/models/concerns/metadata_support.rb b/app/models/concerns/metadata_support.rb index c4bedbcda..182ab8310 100644 --- a/app/models/concerns/metadata_support.rb +++ b/app/models/concerns/metadata_support.rb @@ -66,6 +66,10 @@ module MetadataSupport "#{name}_updated_at".to_sym end + def as_json + @table.as_json + end + def method_missing(mid, *args) out = super(mid, *args) owner.send :write_attribute, attribute_name, @table diff --git a/config/environments/development.rb b/config/environments/development.rb index 7bd049979..d08077769 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -96,9 +96,11 @@ Rails.application.configure do config.i18n.available_locales = [:fr, :en] + config.serve_static_files = true + config.middleware.insert_after(ActionDispatch::Static, Rack::LiveReload) if ENV['LIVERELOAD'] config.middleware.use I18n::JS::Middleware - config.middleware.use CacheSettings, { + config.middleware.insert_before ActionDispatch::Static, CacheSettings, { /\/assets\/.*/ => { cache_control: "max-age=86400, public", expires: 86400 diff --git a/config/environments/production.rb b/config/environments/production.rb index eb44e1ab1..89b74154f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -138,7 +138,7 @@ Rails.application.configure do config.iev_url = ENV.fetch('IEV_URL',"http://iev:8080") config.rails_host = ENV.fetch('RAILS_HOST','http://front:3000') - config.middleware.use CacheSettings, { + config.middleware.insert_before ActionDispatch::Static, CacheSettings, { /\/assets\/.*/ => { cache_control: "max-age=#{1.year.to_i}, public", expires: 1.year.to_i diff --git a/spec/features/calendars_permissions_spec.rb b/spec/features/calendars_permissions_spec.rb index 656c0dd78..6b0b782db 100644 --- a/spec/features/calendars_permissions_spec.rb +++ b/spec/features/calendars_permissions_spec.rb @@ -57,14 +57,14 @@ RSpec.describe 'Calendars', type: :feature do context 'if present → ' do let( :permission ){ true } it 'index shows an edit button' do - expect(page).to have_css('a.btn.btn-default', text: 'Créer') + expect(page).to have_css('a.btn.btn-default', text: I18n.t('actions.add')) end end context 'if absent → ' do let( :permission ){ false } it 'index does not show any edit button' do - expect(page).not_to have_css('a.btn.btn-default', text: 'Créer') + expect(page).not_to have_css('a.btn.btn-default', text: I18n.t('actions.add')) end end end diff --git a/spec/features/routing_constraint_zones_spec.rb b/spec/features/routing_constraint_zones_spec.rb index b116b38bd..b3286af82 100644 --- a/spec/features/routing_constraint_zones_spec.rb +++ b/spec/features/routing_constraint_zones_spec.rb @@ -20,7 +20,7 @@ describe 'RoutingConstraintZones', type: :feature do context 'user has permission to create routing_constraint_zones' do it 'shows a create link for routing_constraint_zones' do - expect(page).to have_content(I18n.t('actions.new')) + expect(page).to have_content(I18n.t('actions.add')) end end @@ -28,7 +28,7 @@ describe 'RoutingConstraintZones', type: :feature do it 'does not show a create link for routing_constraint_zones' do @user.update_attribute(:permissions, []) visit referential_line_routing_constraint_zones_path(referential, line) - expect(page).not_to have_content(I18n.t('actions.new')) + expect(page).not_to have_content(I18n.t('actions.add')) end end diff --git a/spec/features/workbenches/workbenches_permissions_spec.rb b/spec/features/workbenches/workbenches_permissions_spec.rb index 1c073a4c5..a48a6dc64 100644 --- a/spec/features/workbenches/workbenches_permissions_spec.rb +++ b/spec/features/workbenches/workbenches_permissions_spec.rb @@ -23,7 +23,7 @@ describe 'Workbenches', type: :feature do it 'shows the corresponding button' do expected_href = new_workbench_referential_path(workbench) - expect( page ).to have_link('Créer', href: expected_href) + expect( page ).to have_link(I18n.t('actions.add'), href: expected_href) end end @@ -31,7 +31,7 @@ describe 'Workbenches', type: :feature do let( :permission ){ false } it 'does not show the corresponding button' do - expect( page ).not_to have_link('Créer') + expect( page ).not_to have_link(I18n.t('actions.add')) end end # let!(:ready_referential) { create :referential, workbench: workbench, metadatas: referential_metadatas, ready: true, organisation: @user.organisation } |
