# Class Admin::GroupsController < AdminController

- app/controllers/admin/groups_controller.rb

Methods

C
  - create
D
  - destroy
E
  - edit
I
  - index
N
  - new
P
  - project_teams_update,
  - project_update
R
  - remove_project
S
  - show
U
  - update

Instance Public methods
create() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 26
    def create
      @group = Group.new(params[:group])
      @group.path = @group.name.dup.parameterize if @group.name
      @group.owner = current_user

      if @group.save
        redirect_to [:admin, @group], notice: 'Group was successfully created.'
      else
        render action: "new"
      end
    end

destroy() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 75
    def destroy
      @group.truncate_teams

      @group.destroy

      redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
    end

edit() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 23
    def edit
    end

index() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 4
    def index
      @groups = Group.order('name ASC')
      @groups = @groups.search(params[:name]) if params[:name].present?
      @groups = @groups.page(params[:page]).per(20)
    end

new() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 19
    def new
      @group = Group.new
    end

project_teams_update() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 70
    def project_teams_update
      @group.add_users_to_project_teams(params[:user_ids], params[:project_access])
      redirect_to [:admin, @group], notice: 'Users was successfully added.'
    end

project_update() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 53
    def project_update
      project_ids = params[:project_ids]

      Project.where(id: project_ids).each do |project|
        project.transfer(@group)
      end

      redirect_to :back, notice: 'Group was successfully updated.'
    end

remove_project() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 63
    def remove_project
      @project = Project.find(params[:project_id])
      @project.transfer(nil)

      redirect_to :back, notice: 'Group was successfully updated.'
    end

show() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 10
    def show
      @projects = Project.scoped
      @projects = @projects.not_in_group(@group) if @group.projects.present?
      @projects = @projects.all
      @projects.reject!(&:empty_repo?)

      @users = User.active
    end

update() Link

Source: show

    # File app/controllers/admin/groups_controller.rb, line 38
    def update
      group_params = params[:group].dup
      owner_id =group_params.delete(:owner_id)

      if owner_id
        @group.owner = User.find(owner_id)
      end

      if @group.update_attributes(group_params)
        redirect_to [:admin, @group], notice: 'Group was successfully updated.'
      else
        render action: "edit"
      end
    end