Order admin poll list by starts_at date

This commit is contained in:
decabeza
2019-01-23 14:53:46 +01:00
parent 5ea1275e6a
commit dfd4f60e15
6 changed files with 25 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
before_action :load_geozones, only: [:new, :create, :edit, :update]
def index
@polls = Poll.order(starts_at: :desc)
end
def show

View File

@@ -4,19 +4,19 @@
<%= link_to poll.name, admin_poll_path(poll) %>
</strong>
</td>
<td>
<%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %>
<td class="text-center">
<%= l poll.starts_at.to_date %>
</td>
<td class="text-right">
<div class="small-6 column">
<td class="text-center">
<%= l poll.ends_at.to_date %>
</td>
<td>
<%= link_to t("admin.actions.edit"),
edit_admin_poll_path(poll),
class: "button hollow expanded" %>
</div>
<div class="small-6 column">
class: "button hollow" %>
<%= link_to t("admin.actions.configure"),
admin_poll_path(poll),
class: "button hollow expanded" %>
</div>
class: "button hollow " %>
</td>
</tr>

View File

@@ -7,8 +7,9 @@
<% if @polls.any? %>
<table>
<thead>
<th class="small-6"><%= t("admin.polls.index.name") %></th>
<th><%= t("admin.polls.index.dates") %></th>
<th class="small-5"><%= t("admin.polls.index.name") %></th>
<th class="text-center"><%= t("admin.polls.index.start_date") %></th>
<th class="text-center"><%= t("admin.polls.index.closing_date") %></th>
<th><%= t("admin.actions.actions") %></th>
</thead>
<tbody>