diff options
| author | Guillaume | 2017-09-29 16:31:38 +0200 |
|---|---|---|
| committer | Guillaume | 2017-09-29 16:31:38 +0200 |
| commit | 043a4166a2dbda61c93b1b6d5c617fba0482bef4 (patch) | |
| tree | 76fe0c8a371b16b5a91c7eab3098ede691bd5284 | |
| parent | 6f994ba0929649d03751af09241017b0c280c22d (diff) | |
| parent | 3cab73d42c048b27dcf35c9274c158f2457365dd (diff) | |
| download | chouette-core-043a4166a2dbda61c93b1b6d5c617fba0482bef4.tar.bz2 | |
Merge branch 'master' of https://github.com/af83/stif-boiv
27 files changed, 101 insertions, 28 deletions
@@ -102,6 +102,7 @@ gem 'roo' # Controller gem 'inherited_resources' +gem 'responders' gem 'google-analytics-rails' # Model diff --git a/Gemfile.lock b/Gemfile.lock index 2c04def92..065390ebe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -642,6 +642,7 @@ DEPENDENCIES rb-fsevent rb-inotify reflex! + responders rgeo (~> 0.5.2) roo rspec-rails (~> 3.5.0) diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js index 377fd0612..1e569d584 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js @@ -57,6 +57,10 @@ class JourneyPattern extends Component{ ) } + isDisabled(action) { + return !this.props.status.policy[`journey_patterns.${action}`] && !this.props.editMode + } + render() { this.previousCity = undefined @@ -78,9 +82,10 @@ class JourneyPattern extends Component{ <span className='fa fa-cog'></span> </div> <ul className='dropdown-menu'> - <li className={(this.props.status.policy['journey_patterns.update'] == false || this.props.editMode == false) ? 'disabled' : ''}> + <li className={this.isDisabled('update') ? 'disabled' : ''}> <button type='button' + disabled={this.isDisabled('update')} onClick={this.props.onOpenEditModal} data-toggle='modal' data-target='#JourneyPatternModal' @@ -91,10 +96,10 @@ class JourneyPattern extends Component{ <li className={this.props.value.object_id ? '' : 'disabled'}> {this.vehicleJourneyURL(this.props.value.object_id)} </li> - <li className={'delete-action' + ((this.props.status.policy['journey_patterns.destroy'] == false || this.props.editMode == false) ? ' disabled' : '')}> + <li className={'delete-action' + (this.isDisabled('destroy') ? ' disabled' : '')}> <button type='button' - disabled={(this.props.status.policy['journey_patterns.destroy'] == false || this.props.editMode == false)? 'disabled' : ''} + disabled={this.isDisabled('destroy') ? 'disabled' : ''} onClick={(e) => { e.preventDefault() this.props.onDeleteJourneyPattern(this.props.index)} diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb index be8b773e2..fc4322c76 100644 --- a/app/controllers/compliance_controls_controller.rb +++ b/app/controllers/compliance_controls_controller.rb @@ -7,9 +7,16 @@ class ComplianceControlsController < BreadcrumbController end def new - redirect_to(action: :select_type) unless params[:sti_class] - @compliance_control_set = parent - @compliance_control = params[:sti_class].constantize.new + if params[:sti_class] + @compliance_control_set = parent + @compliance_control = params[:sti_class].constantize.new + else + redirect_to(action: :select_type) + end + end + + def create + create! { compliance_control_set_path(parent) } end private diff --git a/app/models/compliance_check_message.rb b/app/models/compliance_check_message.rb index 86899eb15..562c09c0e 100644 --- a/app/models/compliance_check_message.rb +++ b/app/models/compliance_check_message.rb @@ -1,4 +1,8 @@ class ComplianceCheckMessage < ActiveRecord::Base + extend Enumerize + belongs_to :compliance_check belongs_to :compliance_check_resource + + enumerize :status, in: %i(OK ERROR WARNING IGNORED), scope: true end diff --git a/app/models/compliance_check_resource.rb b/app/models/compliance_check_resource.rb index a5c0c7d27..2989bf3cf 100644 --- a/app/models/compliance_check_resource.rb +++ b/app/models/compliance_check_resource.rb @@ -1,8 +1,9 @@ class ComplianceCheckResource < ActiveRecord::Base extend Enumerize + belongs_to :compliance_check_set - enumerize :status, in: %w[new successful warning failed] + enumerize :status, in: %i(OK ERROR WARNING IGNORED), scope: true validates_presence_of :compliance_check_set end diff --git a/config/locales/api_keys.en.yml b/config/locales/api_keys.en.yml index 1480c8e55..096846446 100644 --- a/config/locales/api_keys.en.yml +++ b/config/locales/api_keys.en.yml @@ -15,7 +15,8 @@ en: title: "Update api key" activerecord: models: - api_key: "Api Key" + one: "Api Key" + other: "Api keys" attributes: api_key: name: "Name" diff --git a/config/locales/api_keys.fr.yml b/config/locales/api_keys.fr.yml index 20af91a49..ff13cc1ca 100644 --- a/config/locales/api_keys.fr.yml +++ b/config/locales/api_keys.fr.yml @@ -15,7 +15,8 @@ fr: title: "Editer la clé d'accès API" activerecord: models: - api_key: "Clé d'accès API" + one: "Clé d'accès API" + other: "Clés d'accès API" attributes: api_key: name: "Nom" diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml index 42e26e995..3b015ff08 100644 --- a/config/locales/calendars.en.yml +++ b/config/locales/calendars.en.yml @@ -56,7 +56,8 @@ en: end: End activerecord: models: - calendar: Calendar + one: calendar + other: calendars attributes: calendar: name: Name diff --git a/config/locales/calendars.fr.yml b/config/locales/calendars.fr.yml index 63f6465d9..55ec9c620 100644 --- a/config/locales/calendars.fr.yml +++ b/config/locales/calendars.fr.yml @@ -56,7 +56,8 @@ fr: end: Fin activerecord: models: - calendar: Calendrier + one: "calendrier" + other: "calendriers" attributes: calendar: name: Nom diff --git a/config/locales/compliance_controls.en.yml b/config/locales/compliance_controls.en.yml index a6b863de5..bb6b94377 100644 --- a/config/locales/compliance_controls.en.yml +++ b/config/locales/compliance_controls.en.yml @@ -1,7 +1,8 @@ en: activerecord: models: - compliance_control: "compliance control" + one: "compliance control" + other: "compliance controls" attributes: compliance_control: name: "Name" @@ -121,4 +122,4 @@ en: uniqueness: messages: 3_generic_3: "% : the % attribute's value (%) of % is in conflict with : %" - description: "The attribute's value must be unique compared to the other objects ofthe same type (related to the same line)"
\ No newline at end of file + description: "The attribute's value must be unique compared to the other objects ofthe same type (related to the same line)" diff --git a/config/locales/compliance_controls.fr.yml b/config/locales/compliance_controls.fr.yml index 9a5400a5e..1eff5d0e6 100644 --- a/config/locales/compliance_controls.fr.yml +++ b/config/locales/compliance_controls.fr.yml @@ -1,7 +1,8 @@ fr: activerecord: models: - compliance_control: "Jeu de controle" + one: "jeu de controle" + other: "jeux de controle" attributes: compliance_control: name: "Nom" @@ -21,7 +22,7 @@ fr: new: title: "Ajouter un jeu de controle" edit: - title: "Editer le jeu de controle" + title: "Editer le jeu de controle" route: zdl_stop_area: messages: @@ -121,4 +122,4 @@ fr: uniqueness: messages: 3_generic_3: "La valeur de l'attribut doit être unique au sein des objets de la ligne" - description: "% : l'attribut % de % à une valeur % en conflit avec %"
\ No newline at end of file + description: "% : l'attribut % de % à une valeur % en conflit avec %" diff --git a/config/locales/flash_responders.en.yml b/config/locales/flash_responders.en.yml new file mode 100644 index 000000000..659a0bcc5 --- /dev/null +++ b/config/locales/flash_responders.en.yml @@ -0,0 +1,10 @@ +en: + flash: + actions: + create: + notice: "%{resource_name} was successfully created." + update: + notice: "%{resource_name} was successfully updated." + destroy: + notice: "%{resource_name} was successfully destroyed." + alert: "%{resource_name} could not be destroyed." diff --git a/config/locales/flash_responders.fr.yml b/config/locales/flash_responders.fr.yml new file mode 100644 index 000000000..356b83665 --- /dev/null +++ b/config/locales/flash_responders.fr.yml @@ -0,0 +1,10 @@ +fr: + flash: + actions: + create: + notice: "%{resource_name} a été créé avec succès." + update: + notice: "%{resource_name} a été mis à jour avec succès." + destroy: + notice: "%{resource_name} a été détruit avec succès." + alert: "%{resource_name} ne peut pas être détruit." diff --git a/config/locales/line_referentials.en.yml b/config/locales/line_referentials.en.yml index 78083912d..c6e498b50 100644 --- a/config/locales/line_referentials.en.yml +++ b/config/locales/line_referentials.en.yml @@ -14,7 +14,8 @@ en: activerecord: models: line_referential: - one: "referential" + one: "line referential" + other: "line referentials" attributes: line_referential: sync_interval: "Synchronisation frequency" diff --git a/config/locales/line_referentials.fr.yml b/config/locales/line_referentials.fr.yml index c8dfbd640..1711fdf9c 100644 --- a/config/locales/line_referentials.fr.yml +++ b/config/locales/line_referentials.fr.yml @@ -14,7 +14,8 @@ fr: activerecord: models: line_referential: - one: "référentiel" + one: "référentiel de ligne" + other: "référentiels de ligne" attributes: line_referential: sync_interval: "Fréquence de synchronisation" diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index 9ae6bfe35..14b4dbe66 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -48,9 +48,9 @@ en: activerecord: models: referential: - zero: "Data space" - one: "Data space" - other: "Data spaces" + zero: "data space" + one: "data space" + other: "data spaces" attributes: referential: name: "Data space name" diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml index a201ccadd..b90f6e5b6 100644 --- a/config/locales/referentials.fr.yml +++ b/config/locales/referentials.fr.yml @@ -48,9 +48,9 @@ fr: activerecord: models: referential: - zero: "Jeu de Données" - one: "Jeu de Données" - other: "Jeux de Données" + zero: "jeu de Données" + one: "jeu de Données" + other: "jeux de Données" attributes: referential: name: "Nom" diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml index 836705a6a..882c227fe 100644 --- a/config/locales/routing_constraint_zones.en.yml +++ b/config/locales/routing_constraint_zones.en.yml @@ -1,7 +1,8 @@ en: activerecord: models: - routing_constraint_zone: Routing constraint zone + one: routing constraint zone + other: routing constraint zones attributes: routing_constraint_zone: name: Name diff --git a/config/locales/routing_constraint_zones.fr.yml b/config/locales/routing_constraint_zones.fr.yml index c262a851a..4ff0718b2 100644 --- a/config/locales/routing_constraint_zones.fr.yml +++ b/config/locales/routing_constraint_zones.fr.yml @@ -1,7 +1,8 @@ fr: activerecord: models: - routing_constraint_zone: Zone de contrainte + one: zone de contrainte + other: zone de contraintes attributes: routing_constraint_zone: name: Nom diff --git a/config/locales/stop_area_referentials.en.yml b/config/locales/stop_area_referentials.en.yml index bf2e0dc8b..11baf67e2 100644 --- a/config/locales/stop_area_referentials.en.yml +++ b/config/locales/stop_area_referentials.en.yml @@ -5,3 +5,8 @@ en: cancel_sync: "Cancel reflex synchronization" show: title: 'Synchronization iCAR' + activerecord: + models: + stop_area_referential: + one: "stop area referential" + other: "stop area referentials" diff --git a/config/locales/stop_area_referentials.fr.yml b/config/locales/stop_area_referentials.fr.yml index b09c648f0..bb4c4463a 100644 --- a/config/locales/stop_area_referentials.fr.yml +++ b/config/locales/stop_area_referentials.fr.yml @@ -5,3 +5,8 @@ fr: cancel_sync: "Annuler la synchronisation Reflex" show: title: 'Synchronisation iCAR' + activerecord: + models: + stop_area_referential: + one: "référentiel d'arrêt" + other: "référentiel d'arrêts" diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml index 8a458e118..051ef1c96 100644 --- a/config/locales/workbenches.en.yml +++ b/config/locales/workbenches.en.yml @@ -14,3 +14,9 @@ en: zero: "Currently, there is no referential in your workbench" one: "Currently, there is one referential in your workbench" other: "Currently, there are #{count} referentials in your workbench" + activerecord: + models: + workbench: + zero: "workbench" + one: "workbench" + other: "workbenches" diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml index 559593492..f361251a0 100644 --- a/config/locales/workbenches.fr.yml +++ b/config/locales/workbenches.fr.yml @@ -15,3 +15,9 @@ fr: zero: "Aucun jeu de données à l'heure actuelle" one: "1 jeu de données à l'heure actuelle" other: "#{count} jeux de données à l'heure actuelle" + activerecord: + models: + workbench: + zero: "espace de travail" + one: "espace de travail" + other: "espaces de travail" diff --git a/spec/controllers/compliance_controls_controller_spec.rb b/spec/controllers/compliance_controls_controller_spec.rb index d8368c3d0..e866b037c 100644 --- a/spec/controllers/compliance_controls_controller_spec.rb +++ b/spec/controllers/compliance_controls_controller_spec.rb @@ -40,6 +40,7 @@ RSpec.describe ComplianceControlsController, type: :controller do it 'should be successful' do post :create, compliance_control_set_id: compliance_control_set.id, compliance_control: compliance_control_params expect(response).to have_http_status(302) + expect(response).to redirect_to compliance_control_set_path(compliance_control_set) end end diff --git a/spec/factories/compliance_check_messages.rb b/spec/factories/compliance_check_messages.rb index 1a047a242..a0d45eb50 100644 --- a/spec/factories/compliance_check_messages.rb +++ b/spec/factories/compliance_check_messages.rb @@ -2,6 +2,7 @@ FactoryGirl.define do factory :compliance_check_message do association :compliance_check association :compliance_check_resource + status 'OK' message_key "message_key" end end diff --git a/spec/factories/compliance_check_resources.rb b/spec/factories/compliance_check_resources.rb index 95be48de4..5438bd48e 100644 --- a/spec/factories/compliance_check_resources.rb +++ b/spec/factories/compliance_check_resources.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :compliance_check_resource do - status :new - sequence(:name) { |n| "Compliance check resource #{n}" } association :compliance_check_set + sequence(:name) { |n| "Compliance check resource #{n}" } + status 'OK' end end |
