Show creation date and status in admin list
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user