diff --git a/app/controllers/polls/questions_controller.rb b/app/controllers/polls/questions_controller.rb index dcf459485..07d7aa28f 100644 --- a/app/controllers/polls/questions_controller.rb +++ b/app/controllers/polls/questions_controller.rb @@ -3,6 +3,18 @@ class Polls::QuestionsController < ApplicationController load_and_authorize_resource :poll load_and_authorize_resource :question, class: 'Poll::Question', through: :poll + has_filters %w{opened expired incoming} + has_orders %w{most_voted newest oldest}, only: :show + + def show + @commentable = @question.proposal.present? ? @question.proposal : @question + @comment_tree = CommentTree.new(@commentable, params[:page], @current_order) + set_comment_flags(@comment_tree.comments) + + #@question_answer = @question.answers.where(author_id: current_user.try(:id)).first + @answers_by_question_id = {@question.id => params[:answer]} + end + def answer partial_result = @question.partial_results.find_or_initialize_by(author: current_user, amount: 1, diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 8424500a3..d8b7c1da7 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -7,6 +7,7 @@ module Abilities can [:read, :map, :summary], Proposal can :read, Comment can :read, Poll + can :read, Poll::Question can :read, SpendingProposal can :read, Legislation can :read, User diff --git a/app/views/polls/questions/show.html.erb b/app/views/polls/questions/show.html.erb new file mode 100644 index 000000000..e48a65ad0 --- /dev/null +++ b/app/views/polls/questions/show.html.erb @@ -0,0 +1,55 @@ +
+ +