diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb
index 1681fb004..3b630a5ae 100644
--- a/app/controllers/management/proposals_controller.rb
+++ b/app/controllers/management/proposals_controller.rb
@@ -1,18 +1,23 @@
class Management::ProposalsController < Management::BaseController
skip_before_action :verify_manager
+
include HasOrders
include CommentableActions
before_action :set_proposal, only: :vote
before_action :parse_search_terms, only: :index
- has_orders %w{hot_score confidence_score created_at most_commented random}, only: :index
+ has_orders %w{hot_score confidence_score created_at most_commented random}, only: [:index, :print]
def vote
@proposal.register_vote(current_user, 'yes')
redirect_to management_proposals_url, notice: "Succesfully voted"
end
+ def print
+ @proposals = Proposal.all.page(params[:page]).for_render.send("sort_by_#{@current_order}")
+ end
+
private
def set_proposal
@@ -33,4 +38,9 @@ class Management::ProposalsController < Management::BaseController
Proposal
end
+ #Duplicated in application_controller. Move to a concenrn.
+ def set_proposal_votes(proposals)
+ @proposal_votes = current_user ? current_user.proposal_votes(proposals) : {}
+ end
+
end
\ No newline at end of file
diff --git a/app/views/management/proposals/_votes.html.erb b/app/views/management/proposals/_votes.html.erb
index 7ef6fd6e3..ac0c93b09 100644
--- a/app/views/management/proposals/_votes.html.erb
+++ b/app/views/management/proposals/_votes.html.erb
@@ -1,9 +1,31 @@
-
- <%= link_to vote_management_proposal_path(proposal, value: 'yes'),
- class: "button button-support tiny radius expand",
- title: t('proposals.proposal.support_title'), method: "post" do %>
- <%= t("proposals.proposal.support") %>
- <% end %>
-
+
+ <% if action_name == 'print' %>
+
+
+
+ <%= supports_percentage(proposal) %> / <%= t("proposals.proposal.total_percent") %>
+
+
+
+
+ <%= t("proposals.proposal.supports", count: proposal.total_votes) %>
+
+ ">
+ <%= t("proposals.proposal.supports_necessary") %>
+
+
+
+ <% else %>
+
+
+ <%= link_to vote_management_proposal_path(proposal, value: 'yes'),
+ class: "button button-support tiny radius expand",
+ title: t('proposals.proposal.support_title'), method: "post" do %>
+ <%= t("proposals.proposal.support") %>
+ <% end %>
+
+
+ <% end %>
+
diff --git a/app/views/management/proposals/print.html.erb b/app/views/management/proposals/print.html.erb
new file mode 100644
index 000000000..c223dbd4c
--- /dev/null
+++ b/app/views/management/proposals/print.html.erb
@@ -0,0 +1,33 @@
+
+ <%= t("manage.create_user.print") %>
+
+
+
+
+
+
+
+ <%= t("proposals.index.select_order_long") %>
+
+ <%= render 'shared/order_selector', i18n_namespace: "proposals.index" %>
+
+
+
+
+ <%= render @proposals %>
+ <%= paginate @proposals %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 5b62b5494..b3a2a5476 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -173,6 +173,10 @@ Rails.application.routes.draw do
member do
post :vote
end
+
+ collection do
+ get :print
+ end
end
end