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 class="row primary-buttons">
<div class="row margin-top primary-buttons">
<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")) %>
</div>

View File

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

View File

@@ -14,37 +14,43 @@
<%= 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">
<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>
</thead>
<tbody>
<% @processes.each do |process| %>
<tr id="<%= dom_id(process) %>">
<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),
method: :delete,
class: 'button hollow alert' %>
</td>
</tr>
<% end %>
</tbody>
</table>
<table class="stack">
<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>
</thead>
<tbody>
<% @processes.each do |process| %>
<tr id="<%= dom_id(process) %>">
<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),
method: :delete,
class: 'button hollow alert' %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @processes %>
<%= paginate @processes %>
<% else %>
<div class="callout primary">
<%= page_entries_info @processes %>
</div>
<% end %>
</div>

View File

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