Sha256: 11ffe26c223419a30a10d1982cb8a27d45bc20518c94fb5d20b676f3029c25b7

Contents?: true

Size: 1.18 KB

Versions: 31

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Polls
      class QuestionsController < Decidim::Meetings::ApplicationController
        include Decidim::Meetings::PollsResources

        def index
          respond_to do |format|
            format.js do
              render template: pick_index_template, locals: { open_question: nil }
            end
          end
        end

        def update
          enforce_permission_to :update, :question, question: question

          Decidim::Meetings::Admin::UpdateQuestionStatus.call(question, current_user) do
            respond_to do |format|
              format.js do
                render template: admin_index_template, locals: { open_question: question.id }
              end
            end
          end
        end

        private

        def question
          @question ||= questionnaire.questions.find(params[:id]) if questionnaire
        end

        def admin_index_template
          "decidim/meetings/polls/questions/index_admin"
        end

        def pick_index_template
          params[:admin] ? admin_index_template : "decidim/meetings/polls/questions/index"
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.8 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.7 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.6 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.10 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.9 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.5 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.8 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.4 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.3 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.7 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.5 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.2 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.1 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.4 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.0 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.3 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.0.rc2 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.27.0.rc1 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.26.2 app/controllers/decidim/meetings/polls/questions_controller.rb