aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/time_tables/index.json.rabl9
-rw-r--r--app/views/time_tables/index.rabl2
-rw-r--r--app/views/time_tables/show.rabl26
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