Sha256: 986c9e2cd311d3d0ae6a7a8b35610de0b2dffd9d061debecaedaa73b2c056c43

Contents?: true

Size: 926 Bytes

Versions: 6

Compression:

Stored size: 926 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    module TrusteeZone
      # Handles the KeyCeremony for trustee users
      class ElectionsController < Decidim::Elections::TrusteeZone::ApplicationController
        helper_method :election

        def show
          enforce_permission_to :view, :election, trustee: trustee
        end

        def update
          enforce_permission_to :update, :election, trustee: trustee

          UpdateElectionBulletinBoardStatus.call(election, params[:status]) do
            on(:ok) do
              render :update
            end
            on(:invalid) do
              flash[:alert] = I18n.t("elections.update.error", scope: "decidim.elections.trustee_zone")
            end
          end
        end

        private

        def election
          @election ||= Decidim::Elections::Election.find(params[:election_id])
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-elections-0.24.3 app/controllers/decidim/elections/trustee_zone/elections_controller.rb
decidim-elections-0.24.2 app/controllers/decidim/elections/trustee_zone/elections_controller.rb
decidim-elections-0.24.1 app/controllers/decidim/elections/trustee_zone/elections_controller.rb
decidim-elections-0.24.0 app/controllers/decidim/elections/trustee_zone/elections_controller.rb
decidim-elections-0.24.0.rc2 app/controllers/decidim/elections/trustee_zone/elections_controller.rb
decidim-elections-0.24.0.rc1 app/controllers/decidim/elections/trustee_zone/elections_controller.rb