diff options
| author | Alban Peignier | 2016-11-28 16:10:05 +0100 |
|---|---|---|
| committer | Alban Peignier | 2016-11-28 16:10:05 +0100 |
| commit | 32b1fc9b7f848df1fb6b2bb22f203488fa1f74b7 (patch) | |
| tree | c24ea2976e60c98ceb3b00b95a34d8ad41e5cb52 /app | |
| parent | 02f4abc49555ccb90739d4355bb3f87c6f5434ca (diff) | |
| download | chouette-core-32b1fc9b7f848df1fb6b2bb22f203488fa1f74b7.tar.bz2 | |
Hide details on line group of lines when no group of line is defined. Refs #2087
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/lines_controller.rb | 1 | ||||
| -rw-r--r-- | app/views/lines/_line.html.slim | 19 |
2 files changed, 11 insertions, 9 deletions
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index ef058e317..c4d7bffa5 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -11,6 +11,7 @@ class LinesController < BreadcrumbController belongs_to :line_referential def index + @hide_group_of_line = line_referential.group_of_lines.empty? index! do |format| format.html { if collection.out_of_bounds? diff --git a/app/views/lines/_line.html.slim b/app/views/lines/_line.html.slim index 9c11259e4..3105c765c 100644 --- a/app/views/lines/_line.html.slim +++ b/app/views/lines/_line.html.slim @@ -43,12 +43,13 @@ = line.human_attribute_name('company') = link_to_if( line.company, line.company.name, line_referential_company_path(line.line_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, line_referential_group_of_line_path(line.line_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, line_referential_group_of_line_path(line.line_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) |
