diff options
author | Alban Peignier | 2016-11-28 16:17:36 +0100 |
---|---|---|
committer | Alban Peignier | 2016-11-28 16:17:36 +0100 |
commit | 313f42a352b6655e840de90e72c459da9ef96bb9 (patch) | |
tree | 4c565e98393128085703906a40032baaf34fe776 | |
parent | 32b1fc9b7f848df1fb6b2bb22f203488fa1f74b7 (diff) | |
download | chouette-core-313f42a352b6655e840de90e72c459da9ef96bb9.tar.bz2 |
Hide details on line group of lines when no group of line is defined (in ReferentialLinesController) Refs #2087
-rw-r--r-- | app/controllers/referential_lines_controller.rb | 1 | ||||
-rw-r--r-- | app/views/referential_lines/_line.html.slim | 19 |
2 files changed, 11 insertions, 9 deletions
diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb index fb53e4959..cfa5ce143 100644 --- a/app/controllers/referential_lines_controller.rb +++ b/app/controllers/referential_lines_controller.rb @@ -10,6 +10,7 @@ class ReferentialLinesController < ChouetteController belongs_to :referential def index + @hide_group_of_line = referential.group_of_lines.empty? index! do |format| format.html { if collection.out_of_bounds? diff --git a/app/views/referential_lines/_line.html.slim b/app/views/referential_lines/_line.html.slim index 1c8b8eaa8..789b21534 100644 --- a/app/views/referential_lines/_line.html.slim +++ b/app/views/referential_lines/_line.html.slim @@ -38,12 +38,13 @@ = line.human_attribute_name('company') = link_to_if( line.company, line.company.name, referential_company_path(@referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) - p - - if line.group_of_lines.count == 0 - br - / = t('lines.form.no_group_of_line') - - elsif line.group_of_lines.count == 1 - = line.human_attribute_name('group_of_line') - = link_to_if( line.group_of_lines.first, line.group_of_lines.first.name, referential_group_of_line_path(@referential, line.group_of_lines.first), :title => "#{line.human_attribute_name('group_of_line')} #{line.group_of_lines.first.name}") - - else - = t('lines.form.several_group_of_lines', :count => line.group_of_lines.count) + - unless @hide_group_of_line + p + - if line.group_of_lines.count == 0 + br + / = t('lines.form.no_group_of_line') + - elsif line.group_of_lines.count == 1 + = line.human_attribute_name('group_of_line') + = link_to_if( line.group_of_lines.first, line.group_of_lines.first.name, referential_group_of_line_path(@referential, line.group_of_lines.first), :title => "#{line.human_attribute_name('group_of_line')} #{line.group_of_lines.first.name}") + - else + = t('lines.form.several_group_of_lines', :count => line.group_of_lines.count) |