diff options
| author | Xinhui | 2017-04-06 14:28:20 +0200 |
|---|---|---|
| committer | Xinhui | 2017-04-06 14:40:19 +0200 |
| commit | 8adf909694b52959483818bf839d6e180015eb99 (patch) | |
| tree | e70a726eaa8afae8498f81c57edf9d8101fbc563 | |
| parent | 44c187c15aac3def4f509b8ab4d94ff3fb1550d4 (diff) | |
| download | chouette-core-8adf909694b52959483818bf839d6e180015eb99.tar.bz2 | |
Timetables#show json
| -rw-r--r-- | app/views/time_tables/index.json.rabl | 9 | ||||
| -rw-r--r-- | app/views/time_tables/index.rabl | 2 | ||||
| -rw-r--r-- | app/views/time_tables/show.rabl | 26 |
3 files changed, 28 insertions, 9 deletions
diff --git a/app/views/time_tables/index.json.rabl b/app/views/time_tables/index.json.rabl deleted file mode 100644 index 316b8817d..000000000 --- a/app/views/time_tables/index.json.rabl +++ /dev/null @@ -1,9 +0,0 @@ -collection @time_tables, :object_root => false - -node do |time_table| - { :id => time_table.id, :comment => time_table.comment, - :time_table_bounding => time_table.presenter.time_table_bounding, - :composition_info => time_table.presenter.composition_info, - :tags => time_table.tags.join(','), - :day_types => %w(monday tuesday wednesday thursday friday saturday sunday).select{ |d| time_table.send(d) }.map{ |d| time_table.human_attribute_name(d).first(2)}.join('')} -end diff --git a/app/views/time_tables/index.rabl b/app/views/time_tables/index.rabl new file mode 100644 index 000000000..d8b7c6e0c --- /dev/null +++ b/app/views/time_tables/index.rabl @@ -0,0 +1,2 @@ +collection @time_tables, :object_root => false +extends "time_tables/show" diff --git a/app/views/time_tables/show.rabl b/app/views/time_tables/show.rabl new file mode 100644 index 000000000..1e57e069e --- /dev/null +++ b/app/views/time_tables/show.rabl @@ -0,0 +1,26 @@ +object @time_table + +node do |tt| + { + time_table_bounding: tt.presenter.time_table_bounding, + composition_info: tt.presenter.composition_info, + 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('') + } +end +attributes :id, :comment + +child(:periods, object_root: false) do + attributes :id, :period_start, :period_end, :position +end + +child(:dates, object_root: false) do + attributes :id, :date, :position, :in_out +end + +child(:calendar) do + attributes :id, :name, :short_name +end + +child(:tags, object_root: false) do + attributes :name +end |
