aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-07-06 16:41:41 +0200
committerTeddy Wing2017-07-07 12:58:11 +0200
commitd4463529108442b6fc063901e96fc093435b7211 (patch)
tree3dd83a3d0a56b6b26063ce2cdfdbd8dc53e87dd0
parented027aa2fbb3510be6729c7d8bc41ae77a3a1b66 (diff)
downloadchouette-core-d4463529108442b6fc063901e96fc093435b7211.tar.bz2
Calendars#index: Use new table builder helper
Refs #3479
-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?