From 9df201780d5f4ff021e5e34e4d08a3ece4231f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 17 Sep 2018 17:23:11 +0200 Subject: [PATCH] Extract proposals table into a partial --- .../legislation/proposals/_proposals.html.erb | 38 +++++++++++++++++ .../legislation/proposals/index.html.erb | 41 +------------------ 2 files changed, 39 insertions(+), 40 deletions(-) create mode 100644 app/views/admin/legislation/proposals/_proposals.html.erb diff --git a/app/views/admin/legislation/proposals/_proposals.html.erb b/app/views/admin/legislation/proposals/_proposals.html.erb new file mode 100644 index 000000000..cc2de04ce --- /dev/null +++ b/app/views/admin/legislation/proposals/_proposals.html.erb @@ -0,0 +1,38 @@ +<% if proposals.any? %> +

<%= page_entries_info proposals %>

+ + <%= render 'shared/wide_order_selector', i18n_namespace: "admin.legislation.processes.proposals" %> + + + + + + + + + + + + + <% proposals.each do |proposal| %> + + + + + + + <% end %> + +
<%= t("admin.legislation.proposals.index.id") %><%= t("admin.legislation.proposals.index.title") %><%= t("admin.legislation.proposals.index.supports") %><%= t("admin.legislation.proposals.index.selected") %>
<%= proposal.id %><%= proposal.title %><%= proposal.cached_votes_up %> + <% if proposal.selected? + button_text = t("admin.legislation.proposals.index.selected") + clas = 'button expanded' + else + button_text = t("admin.legislation.proposals.index.select") + clas = 'button hollow expanded' + end %> + <%= link_to button_text, admin_legislation_process_proposal_path(@process, proposal), method: 'PUT', class: clas %> +
+ + <%= paginate proposals %> +<% end %> diff --git a/app/views/admin/legislation/proposals/index.html.erb b/app/views/admin/legislation/proposals/index.html.erb index d5f4c39fe..d8dd407a5 100644 --- a/app/views/admin/legislation/proposals/index.html.erb +++ b/app/views/admin/legislation/proposals/index.html.erb @@ -11,44 +11,5 @@ <%= render 'admin/legislation/processes/subnav', process: @process, active: 'proposals' %> <%= render 'form' %> - -<% if @proposals.any? %> -

<%= page_entries_info @proposals %>

- - <%= render 'shared/wide_order_selector', i18n_namespace: "admin.legislation.processes.proposals" %> - - - - - - - - - - - - - <% @proposals.each do |proposal| %> - - - - - - - <% end %> - -
<%= t("admin.legislation.proposals.index.id") %><%= t("admin.legislation.proposals.index.title") %><%= t("admin.legislation.proposals.index.supports") %><%= t("admin.legislation.proposals.index.selected") %>
<%= proposal.id %><%= proposal.title %><%= proposal.cached_votes_up %> - <% if proposal.selected? - button_text = t("admin.legislation.proposals.index.selected") - clas = 'button expanded' - else - button_text = t("admin.legislation.proposals.index.select") - clas = 'button hollow expanded' - end %> - <%= link_to button_text, admin_legislation_process_proposal_path(@process, proposal), method: 'PUT', class: clas %> -
- - <%= paginate @proposals %> -<% end %> - + <%= render 'proposals', proposals: @proposals %>