Sha256: 0d31cb61eecc0f8ce58384e07800c625e3b87838039ef990804d04437c27df3d

Contents?: true

Size: 1.17 KB

Versions: 13

Compression:

Stored size: 1.17 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:)

          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

13 entries across 13 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.4 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.29.0 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.3 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.29.0.rc4 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.29.0.rc3 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.29.0.rc2 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.29.0.rc1 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.2 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.1 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.0 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.0.rc5 app/controllers/decidim/meetings/polls/questions_controller.rb
decidim-meetings-0.28.0.rc4 app/controllers/decidim/meetings/polls/questions_controller.rb