hides legislation empty tables, improves table styles

This commit is contained in:
decabeza
2017-05-24 13:34:37 +02:00
parent 5aa8017aa8
commit 02055bd09a
4 changed files with 106 additions and 83 deletions

View File

@@ -84,7 +84,7 @@
</div> </div>
</div> </div>
<div class="row primary-buttons"> <div class="row margin-top primary-buttons">
<div class="actions small-12 medium-3 column legislation-process-save"> <div class="actions small-12 medium-3 column legislation-process-save">
<%= f.submit(class: "button expanded", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %> <%= f.submit(class: "button expanded", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %>
</div> </div>

View File

@@ -23,29 +23,44 @@
</div> </div>
</div> </div>
<table class="stack"> <% if @process.draft_versions.any? %>
<thead> <table class="stack">
<tr> <thead>
<th><%= t("admin.legislation.draft_versions.table.title") %></th> <tr>
<th><%= t("admin.legislation.draft_versions.table.created_at") %></th> <th><%= t("admin.legislation.draft_versions.table.title") %></th>
<th><%= t("admin.legislation.draft_versions.table.status") %></th> <th><%= t("admin.legislation.draft_versions.table.created_at") %></th>
<th><%= t("admin.legislation.draft_versions.table.comments") %></th> <th><%= t("admin.legislation.draft_versions.table.status") %></th>
<th><%= t("admin.legislation.draft_versions.table.final_version") %></th> <th><%= t("admin.legislation.draft_versions.table.comments") %></th>
</tr> <th><%= t("admin.legislation.draft_versions.table.final_version") %></th>
</thead> </tr>
<tbody> </thead>
<% @process.draft_versions.each do |draft_version| %> <tbody>
<tr id="<%= dom_id(draft_version) %>"> <% @process.draft_versions.each do |draft_version| %>
<td> <tr id="<%= dom_id(draft_version) %>">
<%= link_to draft_version.title, edit_admin_legislation_process_draft_version_path(@process, draft_version) %> <td>
</td> <%= link_to draft_version.title, edit_admin_legislation_process_draft_version_path(@process, draft_version) %>
<td><%= draft_version.created_at.to_date %></td> </td>
<td><%= draft_version.status %> <%= link_to "(#{t('.preview')})", legislation_process_draft_version_path(@process, draft_version) if draft_version.status == 'draft' %></td> <td><%= draft_version.created_at.to_date %></td>
<td><%= draft_version.total_comments %></td> <td>
<td><%= draft_version.final_version %></td> <% if draft_version.status == 'draft' %>
</tr> <%= t("admin.legislation.draft_versions.statuses.draft") %>
<% end %> <%= link_to "(#{t('.preview')})", legislation_process_draft_version_path(@process, draft_version) %>
</tbody> <% else %>
</table> <%= t("admin.legislation.draft_versions.statuses.published") %>
<% end %>
</td>
<td><%= draft_version.total_comments %></td>
<td>
<% if draft_version.final_version %>
<span class="icon-check" title="<%= draft_version.final_version %>"></span>
<% else %>
<span class="icon-x delete" title="<%= draft_version.final_version %>"></span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div> </div>
</div> </div>

View File

@@ -14,37 +14,43 @@
<%= render 'shared/filter_subnav', i18n_namespace: "admin.legislation.processes.index" %> <%= render 'shared/filter_subnav', i18n_namespace: "admin.legislation.processes.index" %>
<h3><%= page_entries_info @processes %></h3> <% if @processes.any? %>
<h3><%= page_entries_info @processes %></h3>
<table class="stack"> <table class="stack">
<thead> <thead>
<tr> <tr>
<th><%= t("admin.legislation.processes.process.title") %></th> <th><%= t("admin.legislation.processes.process.title") %></th>
<th><%= t("admin.legislation.processes.process.status") %></th> <th><%= t("admin.legislation.processes.process.status") %></th>
<th><%= t("admin.legislation.processes.process.creation_date") %></th> <th><%= t("admin.legislation.processes.process.creation_date") %></th>
<th><%= t("admin.legislation.processes.process.comments") %></th> <th><%= t("admin.legislation.processes.process.comments") %></th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @processes.each do |process| %> <% @processes.each do |process| %>
<tr id="<%= dom_id(process) %>"> <tr id="<%= dom_id(process) %>">
<td class="small-12 medium-8"> <td class="small-12 medium-8">
<%= link_to process.title, edit_admin_legislation_process_path(process) %> <%= link_to process.title, edit_admin_legislation_process_path(process) %>
</td> </td>
<td><%= t("admin.legislation.processes.process.status_#{process.status}") %></td> <td><%= t("admin.legislation.processes.process.status_#{process.status}") %></td>
<td><%= I18n.l process.created_at.to_date %></td> <td><%= I18n.l process.created_at.to_date %></td>
<td><%= process.total_comments %></td> <td><%= process.total_comments %></td>
<td> <td>
<%= link_to t("admin.legislation.processes.index.delete"), admin_legislation_process_path(process), <%= link_to t("admin.legislation.processes.index.delete"), admin_legislation_process_path(process),
method: :delete, method: :delete,
class: 'button hollow alert' %> class: 'button hollow alert' %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= paginate @processes %> <%= paginate @processes %>
<% else %>
<div class="callout primary">
<%= page_entries_info @processes %>
</div>
<% end %>
</div> </div>

View File

@@ -23,35 +23,37 @@
</div> </div>
</div> </div>
<table class="stack"> <% if @process.questions.any? %>
<thead> <table class="stack">
<tr> <thead>
<th><%= t("admin.legislation.questions.table.title") %></th> <tr>
<th><%= t("admin.legislation.questions.table.question_options") %></th> <th><%= t("admin.legislation.questions.table.title") %></th>
<th><%= t("admin.legislation.questions.table.answers_count") %></th> <th><%= t("admin.legislation.questions.table.question_options") %></th>
<th><%= t("admin.legislation.questions.table.comments_count") %></th> <th><%= t("admin.legislation.questions.table.answers_count") %></th>
</tr> <th><%= t("admin.legislation.questions.table.comments_count") %></th>
</thead> </tr>
<tbody> </thead>
<% @process.questions.each do |question| %> <tbody>
<tr id="<%= dom_id(question) %>"> <% @process.questions.each do |question| %>
<td> <tr id="<%= dom_id(question) %>">
<%= link_to question.title, edit_admin_legislation_process_question_path(@process, question) %> <td>
</td> <%= link_to question.title, edit_admin_legislation_process_question_path(@process, question) %>
<td> </td>
<%= content_tag :ul do %> <td>
<% question.question_options.each do |question_option| %> <%= content_tag :ul do %>
<%= content_tag :li do %> <% question.question_options.each do |question_option| %>
<%= question_option.value %> (<%= question_option.answers_count %>) <%= content_tag :li do %>
<%= question_option.value %> (<%= question_option.answers_count %>)
<% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> </td>
</td> <td><%= question.answers_count %></td>
<td><%= question.answers_count %></td> <td><%= link_to question.comments.count, legislation_process_question_path(@process, question, anchor: 'comments') %></td>
<td><%= link_to question.comments.count, legislation_process_question_path(@process, question, anchor: 'comments') %></td> </tr>
</tr> <% end %>
<% end %> </tbody>
</tbody> </table>
</table> <% end %>
</div> </div>
</div> </div>