diff options
| author | Marc Florisson | 2012-06-13 16:07:30 +0200 | 
|---|---|---|
| committer | Marc Florisson | 2012-06-13 16:07:30 +0200 | 
| commit | cbd9618b0a9d4ea7f2b0733c134d1c85010f0a2f (patch) | |
| tree | 88413299c9fe5573ace27a25c3cb60a4d7b99892 /app/helpers/time_tables_helper.rb | |
| parent | bfcaec8ebed6cc7cfeb1ab64a48d9182a5c3e567 (diff) | |
| download | chouette-core-cbd9618b0a9d4ea7f2b0733c134d1c85010f0a2f.tar.bz2 | |
add views for vehicle_journeys
Diffstat (limited to 'app/helpers/time_tables_helper.rb')
| -rw-r--r-- | app/helpers/time_tables_helper.rb | 30 | 
1 files changed, 30 insertions, 0 deletions
| diff --git a/app/helpers/time_tables_helper.rb b/app/helpers/time_tables_helper.rb new file mode 100644 index 000000000..c5a6579d9 --- /dev/null +++ b/app/helpers/time_tables_helper.rb @@ -0,0 +1,30 @@ +module TimeTablesHelper +  def bounding_info(time_table) +    return t('time_tables.time_table.empty') if time_table.bounding_dates.empty? +    t('time_tables.time_table.bounding',  +        :start => l(time_table.bounding_dates.min), +        :end => l(time_table.bounding_dates.max)) +  end +  def time_tables_shortest_info( vehicle) +    "#{l(vehicle.bounding_dates.min)} #{l(vehicle.bounding_dates.max)}" +  end +  def time_tables_info( vehicle) +    vehicle.time_tables.map do |time_table| +      composition_info(time_table) +    end.join( "\n") +  end + +  def composition_info(time_table) +    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 +      t('time_tables.time_table.dates_count', :count => time_table.dates.count) +    else +      t('time_tables.time_table.periods_dates_count',  +        :dates_count => time_table.dates.count, +        :periods_count => time_table.periods.count) +    end +  end +end + | 
