From 81e528b0a804cbc95a948c1b2de9ffe2cf852bba Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Mon, 12 Aug 2019 17:02:37 +0200 Subject: [PATCH] Switch sorting default to date and remove sort option Signed-off-by: Jan-Christoph Borchardt --- app/controllers/admin/events_controller.rb | 2 +- app/controllers/events_controller.rb | 2 +- app/views/events/index.html.erb | 9 --------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 895c9f7..c635e9f 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -24,7 +24,7 @@ def index when 'date' @events = @events.order(date: :desc) else - @events = @events.order(created_at: :desc) + @events = @events.order(date: :desc) end @events = @events.includes(:comments).page(params[:page]).per(40) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 2c14f91..ea9d2d8 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -14,7 +14,7 @@ def index when 'date' @events = @events.where.not(date: [nil,""]).order(date: :desc) else - @events = @events.order(created_at: :desc) + @events = @events.order(date: :desc) end @events = @events.includes(:comments).page(params[:page]) diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index 953a7c7..186f253 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb @@ -1,14 +1,5 @@ <%= render partial: 'tag_or_search_summery' %> -
-
- <%= link_to_unless(params[:order_by] == "date", ''.html_safe + t('index.date').html_safe, events_path(order_by: "date"), class:'pr-3' ) %> -
-
- <%= link_to_unless(params[:order_by] == "created_at" || params[:order_by] == nil, ''.html_safe + t('index.created_at').html_safe, events_path(order_by: "created_at"), class:'pl-3' ) %> -
-
- <%= render @events %> <% if @events.any? %>