diff options
| author | Marc Florisson | 2012-06-15 20:22:48 +0200 |
|---|---|---|
| committer | Marc Florisson | 2012-06-15 20:22:48 +0200 |
| commit | aa96bcc26c7c943c199cfe911343702937550452 (patch) | |
| tree | f022a5433d07c63061f93c46ea12ed73ab2b631b /app/helpers | |
| parent | aac47f41318b3ccd980f482e0a9fd21433ace69b (diff) | |
| download | chouette-core-aa96bcc26c7c943c199cfe911343702937550452.tar.bz2 | |
refactor vehicle_journey's views
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/time_tables_helper.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/helpers/time_tables_helper.rb b/app/helpers/time_tables_helper.rb index db9c1109e..a7607f7a0 100644 --- a/app/helpers/time_tables_helper.rb +++ b/app/helpers/time_tables_helper.rb @@ -5,13 +5,19 @@ module TimeTablesHelper :start => l(time_table.bounding_dates.min), :end => l(time_table.bounding_dates.max)) end + def bounding_short_info(dates) + return t('time_tables.time_table.empty') if dates.empty? + "#{l(dates.min)} #{l(dates.max)}" + end + def time_table_bounding( time_table) + bounding_short_info( time_table.bounding_dates) + end def time_tables_shortest_info( vehicle) - return vehicle.bounding_dates.inspect - #"#{l(vehicle.bounding_dates.min)} #{l(vehicle.bounding_dates.max)}" + bounding_short_info( vehicle.bounding_dates) end def time_tables_info( vehicle) vehicle.time_tables.map do |time_table| - composition_info(time_table) + "#{time_table_bounding( time_table)} - #{composition_info(time_table)}" end.join( "\n") end @@ -19,7 +25,7 @@ module TimeTablesHelper return if time_table.bounding_dates.empty? if time_table.dates.empty? t('time_tables.time_table.periods_count', :count => time_table.periods.count) - elsif + elsif time_table.periods.empty? t('time_tables.time_table.dates_count', :count => time_table.dates.count) else t('time_tables.time_table.periods_dates_count', |
