Sha256: 1f14ea1b3c006f7a00f4650ceee0d2656f64b9b6fe36b8f82bc4e92e5de93a5c

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true
require_dependency "think_feel_do_engine/application_controller"

module ThinkFeelDoEngine
  module Manage
    # Users can view groups to CRUD and assign slideshows
    class GroupsController < ApplicationController
      before_action :authenticate_user!, :set_arm
      rescue_from ActiveRecord::RecordNotFound, with: :record_not_found

      def index
        authorize! :index, Group
        @groups = Group.all
      end

      def edit_tasks
        @group = @arm.groups
                     .includes(tasks: { bit_core_content_module: :tool })
                     .find(params[:id])
        authorize! :update, @group
        @task = current_user.tasks.build
        @content_modules = BitCore::ContentModule
                           .where(bit_core_tool_id: @arm.bit_core_tool_ids)
                           .includes(:tool)
      end

      private

      def set_arm
        @arm = Arm.find(params[:arm_id])
      end

      def record_not_found
        redirect_to main_app.root_path,
                    alert: "The group you are looking for no longer exists."
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.8 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.7 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.6 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.5 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.4 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.2 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.1 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.22.0 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.21.2 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.21.1 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.21.0 app/controllers/think_feel_do_engine/manage/groups_controller.rb
think_feel_do_engine-3.20.1 app/controllers/think_feel_do_engine/manage/groups_controller.rb