aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorcedricnjanga2018-05-14 17:41:39 -0700
committerJohan Van Ryseghem2018-05-28 14:36:14 +0200
commit4192ed6722845fd5042bc805d784bce4cef1667b (patch)
tree60dab36607a2767d8a1e07679be68a8378fc4e2c /app
parent20a9124dfa1a7e42dbf01e0d7357003f488418cb (diff)
downloadchouette-core-4192ed6722845fd5042bc805d784bce4cef1667b.tar.bz2
Refs #6955 Add new translation + custom delete confirmation modal
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/modal_confirmation.js31
-rw-r--r--app/decorators/network_decorator.rb2
-rw-r--r--app/decorators/referential_line_decorator.rb2
-rw-r--r--app/javascript/vehicle_journeys/actions/index.js10
-rw-r--r--app/views/lines/_form.html.slim2
-rw-r--r--app/views/routing_constraint_zones/show.html.slim6
6 files changed, 42 insertions, 11 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,