diff options
| author | cedricnjanga | 2018-05-14 17:41:39 -0700 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-28 14:36:14 +0200 |
| commit | 4192ed6722845fd5042bc805d784bce4cef1667b (patch) | |
| tree | 60dab36607a2767d8a1e07679be68a8378fc4e2c | |
| parent | 20a9124dfa1a7e42dbf01e0d7357003f488418cb (diff) | |
| download | chouette-core-4192ed6722845fd5042bc805d784bce4cef1667b.tar.bz2 | |
Refs #6955 Add new translation + custom delete confirmation modal
| -rw-r--r-- | app/assets/javascripts/modal_confirmation.js | 31 | ||||
| -rw-r--r-- | app/decorators/network_decorator.rb | 2 | ||||
| -rw-r--r-- | app/decorators/referential_line_decorator.rb | 2 | ||||
| -rw-r--r-- | app/javascript/vehicle_journeys/actions/index.js | 10 | ||||
| -rw-r--r-- | app/views/lines/_form.html.slim | 2 | ||||
| -rw-r--r-- | app/views/routing_constraint_zones/show.html.slim | 6 | ||||
| -rw-r--r-- | config/breadcrumbs.rb | 3 | ||||
| -rw-r--r-- | config/locales/actions.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/actions.fr.yml | 1 | ||||
| -rw-r--r-- | config/locales/companies.en.yml | 2 | ||||
| -rw-r--r-- | config/locales/layouts.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/layouts.fr.yml | 1 | ||||
| -rw-r--r-- | config/locales/lines.en.yml | 4 | ||||
| -rw-r--r-- | config/locales/networks.en.yml | 2 | ||||
| -rw-r--r-- | config/locales/routing_constraint_zones.en.yml | 2 | ||||
| -rw-r--r-- | config/locales/routing_constraint_zones.fr.yml | 2 | ||||
| -rw-r--r-- | config/locales/stop_areas.en.yml | 2 |
17 files changed, 56 insertions, 18 deletions
diff --git a/app/assets/javascripts/modal_confirmation.js b/app/assets/javascripts/modal_confirmation.js new file mode 100644 index 000000000..e82a8a81b --- /dev/null +++ b/app/assets/javascripts/modal_confirmation.js @@ -0,0 +1,31 @@ +$(document).ready(() => { + $.rails.allowAction = (link) => { + let message = link.data('confirm') + if (!message) return true + showConfirmModal(link) + return false + } + + let showConfirmModal = (link) => { + let message = link.data('confirm') + let html = `<div class="modal fade" id="confirmationDialog" tabindex="1" role="dialog"> + <div class="modal-container"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title"> ${I18n.t('warning')} </h4> + </div> + <div class="modal-body"> + <p>${message}</p> + </div> + <div class="modal-footer"> + <a data-dismiss="modal" class="btn">${I18n.t('cancel')}</a> + <a data-dismiss="modal" class="btn btn-primary" data-method=${link.data('method')} href=${link.attr('href')}>${I18n.t('ok')}</a> + </div> + </div> + </div> + </div> + </div> ` + $(html).modal() + } +})
\ No newline at end of file diff --git a/app/decorators/network_decorator.rb b/app/decorators/network_decorator.rb index ea0f73dc2..ab90e4998 100644 --- a/app/decorators/network_decorator.rb +++ b/app/decorators/network_decorator.rb @@ -25,7 +25,7 @@ class NetworkDecorator < AF83::Decorator end instance_decorator.destroy_action_link do |l| - l.content h.destroy_link_content('networks.actions.destroy') + l.content h.t('networks.actions.destroy') l.data confirm: h.t('networks.actions.destroy_confirm') end end diff --git a/app/decorators/referential_line_decorator.rb b/app/decorators/referential_line_decorator.rb index 3ac846d76..a8c210be0 100644 --- a/app/decorators/referential_line_decorator.rb +++ b/app/decorators/referential_line_decorator.rb @@ -13,7 +13,7 @@ class ReferentialLineDecorator < AF83::Decorator instance_decorator.show_action_link instance_decorator.action_link secondary: true do |l| - l.content Chouette::Line.human_attribute_name(:footnotes) + l.content Chouette::Line.tmf(:footnotes) l.href { h.referential_line_footnotes_path(context[:referential], object) } end diff --git a/app/javascript/vehicle_journeys/actions/index.js b/app/javascript/vehicle_journeys/actions/index.js index 98594083d..8ac8b5ec5 100644 --- a/app/javascript/vehicle_journeys/actions/index.js +++ b/app/javascript/vehicle_journeys/actions/index.js @@ -379,11 +379,11 @@ const actions = { vehicle_journey_at_stops: vjasWithDelta, deletable: false, selected: false, - published_journey_name: val.published_journey_name || 'non renseigné', - published_journey_identifier: val.published_journey_identifier || 'non renseigné', - company: val.company || {name: 'non renseigné'}, - transport_mode: val.route.line.transport_mode || 'undefined', - transport_submode: val.route.line.transport_submode || 'undefined' + published_journey_name: val.published_journey_name || '', + published_journey_identifier: val.published_journey_identifier || '', + company: val.company || {name: ''}, + transport_mode: val.route.line.transport_mode || '', + transport_submode: val.route.line.transport_submode || '' }) ) } diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim index 909d6512e..4623abf8a 100644 --- a/app/views/lines/_form.html.slim +++ b/app/views/lines/_form.html.slim @@ -4,7 +4,7 @@ = f.input :name = f.input :network_id, as: :select, :collection => @line_referential.networks, include_blank: false = f.input :company_id, as: :select, :collection => @line_referential.companies, include_blank: true - = f.input :secondary_company_ids, :collection => @line_referential.companies, include_blank: false, input_html: { multiple: true, 'data-select2ed': true }, label: t('activerecord.attributes.line.secondary_company') + = f.input :secondary_company_ids, :collection => @line_referential.companies, include_blank: false, input_html: { multiple: true, 'data-select2ed': true }, label: Chouette::Line.tmf(:secondary_companies) = f.input :published_name = f.input :registration_number = f.input :number diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim index 8c8e9b17a..55c952ae6 100644 --- a/app/views/routing_constraint_zones/show.html.slim +++ b/app/views/routing_constraint_zones/show.html.slim @@ -16,15 +16,15 @@ = table_builder_2 @routing_constraint_zone.route.stop_points, [ \ TableBuilderHelper::Column.new( \ - name: "Arrêts de l'itinéraire", \ + name: t('.route_stop_points'), \ attribute: 'name', \ link_to: lambda do |stop_point| \ referential_stop_area_path(@referential, stop_point.stop_area) \ end \ ), TableBuilderHelper::Column.new( \ - name: "Arrêts inclus dans l'ITL", \ - attribute: Proc.new{ |rsp| (@routing_constraint_zone.stop_point_ids.include? rsp.id) ? 'Oui' : 'Non' } \ + name: t('.stop_points'), \ + attribute: Proc.new{ |rsp| (@routing_constraint_zone.stop_point_ids.include? rsp.id) ? t('yes') : t('no') } \ ) \ ], sortable: false, diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb index af1dec3ae..59ebbd898 100644 --- a/config/breadcrumbs.rb +++ b/config/breadcrumbs.rb @@ -3,7 +3,7 @@ crumb :root do end crumb :workbench do |workbench| - link workbench.name, workbench_path(workbench) + link I18n.t('workbenches.index.offers.title'), workbench_path(workbench) end crumb :workbench_configure do |workbench| @@ -175,7 +175,6 @@ end crumb :stop_areas do |stop_area_referential| link I18n.t('stop_areas.index.title'), stop_area_referential_stop_areas_path(stop_area_referential) - parent :stop_area_referential, stop_area_referential end crumb :stop_area do |stop_area_referential, stop_area| diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml index faf0dcec2..2c48f11a9 100644 --- a/config/locales/actions.en.yml +++ b/config/locales/actions.en.yml @@ -35,3 +35,4 @@ en: no_result_text: "No Results" searching_term: "Searching..." are_you_sure: Are you sure? + ok: Ok diff --git a/config/locales/actions.fr.yml b/config/locales/actions.fr.yml index 9e1a132a7..f02ab2198 100644 --- a/config/locales/actions.fr.yml +++ b/config/locales/actions.fr.yml @@ -35,3 +35,4 @@ fr: no_result_text: "Aucun résultat" searching_term: "Recherche en cours..." are_you_sure: Etes vous sûr ? + ok: Ok diff --git a/config/locales/companies.en.yml b/config/locales/companies.en.yml index f2b19bc19..8a746f6b7 100644 --- a/config/locales/companies.en.yml +++ b/config/locales/companies.en.yml @@ -6,7 +6,7 @@ en: new: "Add a new company" edit: "Edit this company" destroy: "Remove this company" - destroy_confirm: "Are you sure you want destroy this company?" + destroy_confirm: "Are you sure you want to destroy this company?" new: title: "Add a new company" edit: diff --git a/config/locales/layouts.en.yml b/config/locales/layouts.en.yml index 2f75bffbf..3f67c5c20 100644 --- a/config/locales/layouts.en.yml +++ b/config/locales/layouts.en.yml @@ -71,6 +71,7 @@ en: yesterday: "Yestersday" edit_periods: "Edit periods" delete_periods: "Delete periods" + warning: Warning attributes: author: "Edited by" created_at: "Created at" diff --git a/config/locales/layouts.fr.yml b/config/locales/layouts.fr.yml index 4526a9e56..48c1211d4 100644 --- a/config/locales/layouts.fr.yml +++ b/config/locales/layouts.fr.yml @@ -71,6 +71,7 @@ fr: yesterday: "Hier" edit_periods: "Editer Périodes" delete_periods: "Supprimer Périodes" + warning: Avertissement attributes: author: "Edité par" created_at: "Créé le" diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml index 6501faa57..0f3eaadd9 100644 --- a/config/locales/lines.en.yml +++ b/config/locales/lines.en.yml @@ -8,7 +8,7 @@ en: activate: "Activate this line" deactivate: "Deactivate this line" activate_confirm: "Are you sure you want to activate this line ?" - deactivate_confirm: "Are you sure you want tode activate this line ?" + deactivate_confirm: "Are you sure you want to deactivate this line ?" destroy_confirm: "Are you sure you want to destroy this line ?" destroy_selection_confirm: "Are you sure you want to destroy those lines ?" import: "Import lines" @@ -117,7 +117,7 @@ en: updated_at: Updated at creator_id: "Created by" footnotes: "Footnotes" - stable_id: External permanent idenifier" + stable_id: External permanent identifier status: Status activated: Activated deactivated: Deactivated diff --git a/config/locales/networks.en.yml b/config/locales/networks.en.yml index 2046a30ae..d4164f9a6 100644 --- a/config/locales/networks.en.yml +++ b/config/locales/networks.en.yml @@ -5,7 +5,7 @@ en: new: "Add a new network" edit: "Edit this network" destroy: "Remove this network" - destroy_confirm: "Are you sure you want destroy this network?" + destroy_confirm: "Are you sure you want to destroy this network ?" new: title: "Add a new network" edit: diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml index 2143ce1e1..a4bb9b36c 100644 --- a/config/locales/routing_constraint_zones.en.yml +++ b/config/locales/routing_constraint_zones.en.yml @@ -39,6 +39,8 @@ en: title: "Update routing constraint zone %{name}" show: title: "Routing constraint zone %{name}" + route_stop_points: Route stop points + stop_points: Stop points included in the RCZ index: title: "Routing constraint zones" search_no_results: "No ITL matches your query" diff --git a/config/locales/routing_constraint_zones.fr.yml b/config/locales/routing_constraint_zones.fr.yml index b5e0fa7fb..8de1bc225 100644 --- a/config/locales/routing_constraint_zones.fr.yml +++ b/config/locales/routing_constraint_zones.fr.yml @@ -39,6 +39,8 @@ fr: title: "Editer l'ITL : %{name}" show: title: "Zone de contrainte %{name}" + route_stop_points: Arrêts de l'itinéraire + stop_points: Arrêts inclus dans l'ITL index: title: "Interdictions de trafic local" search_no_results: "Aucune ITL ne correspond à votre recherche" diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml index 7f460381c..3a26f93b2 100644 --- a/config/locales/stop_areas.en.yml +++ b/config/locales/stop_areas.en.yml @@ -28,7 +28,7 @@ en: activate: "Activate this stop" deactivate: "Deactivate this stop" activate_confirm: "Are you sure you want to activate this stop ?" - deactivate_confirm: "Are you sure you want tode activate this stop ?" + deactivate_confirm: "Are you sure you want to deactivate this stop ?" deleted_at: "Activated" destroy_confirm: "Are you sure you want destroy this stop and all of his children ?" select_parent: "Create or modify the relation child -> parent" |
