Sha256: 2171ebfb6b623f77f96ca2b016701fed598e62057fd71b57fdf5863169440980

Contents?: true

Size: 790 Bytes

Versions: 9

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # Controller that allows managing user groups at the admin panel.
    #
    class UserGroupsController < ApplicationController
      def index
        authorize! :index, UserGroup
        @user_groups = collection
      end

      def verify
        @user_group = collection.find(params[:id])
        authorize! :verify, @user_group

        @user_group.verify!

        flash[:notice] = I18n.t("user_groups.verify.success", scope: "decidim.admin")
        redirect_to decidim_admin.user_groups_path
      end

      private

      def collection
        UserGroup
          .includes(:memberships)
          .where(decidim_user_group_memberships: { decidim_user_id: current_organization.users })
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
decidim-admin-0.0.6 app/controllers/decidim/admin/user_groups_controller.rb
decidim-0.0.6 decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb
decidim-admin-0.0.5 app/controllers/decidim/admin/user_groups_controller.rb
decidim-0.0.5 decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb
decidim-0.0.4 decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb
decidim-admin-0.0.3 app/controllers/decidim/admin/user_groups_controller.rb
decidim-0.0.3 decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb
decidim-admin-0.0.2 app/controllers/decidim/admin/user_groups_controller.rb
decidim-0.0.2 decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb