aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/time_tables/show.rabl
blob: 55744bf8c68e44b3dd8539c71b59693cae3008f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
object @time_table

attributes :id, :comment
node do |tt|
  {
    time_table_bounding: tt.presenter.time_table_bounding,
    tags: tt.tags.map{ |tag| {id: tag.id, name: tag.name}},
    day_types: %w(monday tuesday wednesday thursday friday saturday sunday).select{ |d| tt.send(d) }.map{ |d| tt.human_attribute_name(d).first(2)}.join(''),
    current_month: tt.month_inspect(Date.today),
    periode_range: month_periode_enum(3),
    current_periode_range: Date.today.beginning_of_month,
    color: tt.color ? tt.color : '',
    short_id: tt.get_objectid.short_id
  }
end

child(:periods, object_root: false) do
  attributes :id, :period_start, :period_end
end

child(:dates, object_root: false) do
  attributes :id, :date, :in_out
end

child(:calendar) do
  attributes :id, :name
end