aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/calendars_controller.rb6
-rw-r--r--app/views/calendars/index.html.slim24
2 files changed, 24 insertions, 6 deletions
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index 23af4129b..66eb3f963 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -5,6 +5,12 @@ class CalendarsController < BreadcrumbController
respond_to :html
respond_to :js, only: :index
+ def index
+ index! do
+ @calendars = ModelDecorator.decorate(@calendars, with: CalendarDecorator)
+ end
+ end
+
def show
show! do
@calendar = @calendar.decorate
diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim
index ec3893959..843ec1256 100644
--- a/app/views/calendars/index.html.slim
+++ b/app/views/calendars/index.html.slim
@@ -15,12 +15,24 @@
- if @calendars.any?
.row
.col-lg-12
- = table_builder @calendars,
- { :name => 'name', :short_name => 'short_name', :shared => Proc.new{|c| t("#{c.try(:shared)}") } },
- [:show, :edit, :delete],
- [],
- 'table has-filter'
-
+ = table_builder_2 @calendars,
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :short_name, \
+ attribute: 'short_name' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :shared, \
+ attribute: Proc.new { |c| t("#{c.try(:shared)}") } \
+ ) \
+ ],
+ links: [:show, :edit],
+ cls: 'table has-filter'
+
= new_pagination @calendars, 'pull-right'
- unless @calendars.any?