Show creation date and status in admin list

This commit is contained in:
Fernando Blat
2017-01-05 10:22:40 +01:00
parent fba4c79d2a
commit 814cf9df56
5 changed files with 44 additions and 17 deletions

View File

@@ -59,6 +59,18 @@ class Legislation::Process < ActiveRecord::Base
questions.map(&:comments_count).sum
end
def status
today = Date.current
if today < start_date
:planned
elsif end_date < today
:closed
else
:open
end
end
private
def valid_date_ranges

View File

@@ -20,6 +20,8 @@
<thead>
<tr>
<th><%= t("admin.legislation.processes.process.title") %></th>
<th><%= t("admin.legislation.processes.process.status") %></th>
<th><%= t("admin.legislation.processes.process.creation_date") %></th>
<th><%= t("admin.legislation.processes.process.comments") %></th>
<th></th>
</tr>
@@ -30,6 +32,8 @@
<td class="small-12 medium-8">
<%= link_to process.title, edit_admin_legislation_process_path(process) %>
</td>
<td><%= t("admin.legislation.processes.process.status_#{process.status}") %></td>
<td><%= I18n.l process.created_at.to_date %></td>
<td><%= process.total_comments %></td>
<td>
<%= link_to t("admin.legislation.processes.index.delete"), admin_legislation_process_path(process),