aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2018-04-17 15:01:32 +0200
committerGitHub2018-04-17 15:01:32 +0200
commit3cf7527928d882f5dffaf813558f364183646c8b (patch)
treec426c0047bf65c16c6461e82bd5e9e3b52af3c85
parentde6edec5a85e2282f11b1eed0bd97fb5b6eaafe8 (diff)
parentcccf59ad996447596ac2e821815b2d677c993d4b (diff)
downloadchouette-core-3cf7527928d882f5dffaf813558f364183646c8b.tar.bz2
Merge pull request #493 from af83/6425-fix-lines-show
6508 Uniformize lines show
-rw-r--r--app/helpers/referentials_helper.rb12
-rw-r--r--app/views/lines/show.html.slim20
-rw-r--r--app/views/referential_lines/show.html.slim4
-rw-r--r--config/locales/lines.en.yml2
-rw-r--r--config/locales/lines.fr.yml2
5 files changed, 21 insertions, 19 deletions
diff --git a/app/helpers/referentials_helper.rb b/app/helpers/referentials_helper.rb
index 9c3852322..a01d901e6 100644
--- a/app/helpers/referentials_helper.rb
+++ b/app/helpers/referentials_helper.rb
@@ -1,13 +1,15 @@
module ReferentialsHelper
# Outputs a green check icon and the text "Oui" or a red exclamation mark
# icon and the text "Non" based on `status`
- def line_status(status)
+ def line_status(status, verbose=true)
if status
- content_tag(:span, nil, class: 'fa fa-exclamation-circle fa-lg text-danger') +
- t('activerecord.attributes.line.deactivated')
+ out = content_tag(:span, nil, class: 'fa fa-exclamation-circle fa-lg text-danger')
+ out += t('activerecord.attributes.line.deactivated') if verbose
+ out
else
- content_tag(:span, nil, class: 'fa fa-check-circle fa-lg text-success') +
- t('activerecord.attributes.line.activated')
+ out = content_tag(:span, nil, class: 'fa fa-check-circle fa-lg text-success')
+ out += t('activerecord.attributes.line.activated') if verbose
+ out
end
end
diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim
index 9e1ae6d6f..b683b9be6 100644
--- a/app/views/lines/show.html.slim
+++ b/app/views/lines/show.html.slim
@@ -7,13 +7,13 @@
.col-lg-6.col-md-6.col-sm-12.col-xs-12
= definition_list t('metadatas'),
{ t('objectid') => @line.get_objectid.short_id,
- @line.human_attribute_name(:deactivated) => (@line.deactivated? ? t('false') : t('true')),
- @line.human_attribute_name(:network_id) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name),
- @line.human_attribute_name(:company_id) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name),
- @line.human_attribute_name(:secondary_companies) => (@line.secondary_companies.nil? ? t('lines.index.unset') : array_to_html_list(@line.secondary_companies.collect(&:name))),
- @line.human_attribute_name(:number) => @line.number,
- @line.human_attribute_name(:registration_number) => (@line.registration_number ? @line.registration_number : '-'),
- @line.human_attribute_name(:transport_mode) => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
- @line.human_attribute_name(:transport_submode) => (@line.transport_submode.present? ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'),
- @line.human_attribute_name(:url) => (@line.url ? @line.url : '-'),
- @line.human_attribute_name(:seasonal) => (@line.seasonal? ? t('true') : t('false')),}
+ Chouette::Line.tmf(:state) => line_status(@line.deactivated),
+ Chouette::Line.tmf(:network_id) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name),
+ Chouette::Line.tmf(:company_id) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name),
+ Chouette::Line.tmf(:secondary_companies) => (@line.secondary_companies.nil? ? t('lines.index.unset') : array_to_html_list(@line.secondary_companies.collect(&:name))),
+ Chouette::Line.tmf(:number) => @line.number,
+ Chouette::Line.tmf(:registration_number) => (@line.registration_number ? @line.registration_number : '-'),
+ Chouette::Line.tmf(:transport_mode) => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
+ Chouette::Line.tmf(:transport_submode) => (@line.transport_submode.present? ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'),
+ Chouette::Line.tmf(:url) => (@line.url ? @line.url : '-'),
+ Chouette::Line.tmf(:seasonal) => (@line.seasonal? ? t('true') : t('false')),}
diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim
index 91868a002..4804da527 100644
--- a/app/views/referential_lines/show.html.slim
+++ b/app/views/referential_lines/show.html.slim
@@ -7,10 +7,10 @@
.col-lg-6.col-md-6.col-sm-12.col-xs-12
= definition_list t('metadatas'),
{ t('id_codif') => @line.get_objectid.short_id,
- Chouette::Line.tmf('activated') => (@line.deactivated? ? t('false') : t('true')),
+ Chouette::Line.tmf('state') => line_status(@line.deactivated),
Chouette::Line.tmf('network_id') => (@line.network.nil? ? t('lines.index.unset') : link_to(@line.network.name, [@referential, @line.network]) ),
Chouette::Line.tmf('company') => (@line.company.nil? ? t('lines.index.unset') : link_to(@line.company.name, [@referential, @line.company]) ),
- Chouette::Line.tmf('secondary_company') => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),
+ Chouette::Line.tmf('secondary_companies') => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),
Chouette::Line.tmf('registration_number') => @line.number,
Chouette::Line.tmf('published_name') => (@line.registration_number ? @line.registration_number : '-'),
Chouette::Line.tmf('transport_mode') => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml
index 1cd5150db..3d1ddc149 100644
--- a/config/locales/lines.en.yml
+++ b/config/locales/lines.en.yml
@@ -78,7 +78,7 @@ en:
name: "Network"
company_id: "Company"
company: "Company"
- secondary_company: "Secondary company"
+ secondary_companies: "Secondary companies"
companies:
name: "Company"
registration_number: "Registration number"
diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml
index 6f4a2e9bf..47baf96f8 100644
--- a/config/locales/lines.fr.yml
+++ b/config/locales/lines.fr.yml
@@ -79,7 +79,7 @@ fr:
name: "Réseau"
company_id: "Transporteur principal"
company: "Transporteur principal"
- secondary_company: "Transporteurs secondaires"
+ secondary_companies: "Transporteurs secondaires"
companies:
name: "Transporteur principal"
registration_number: "Nom court"