Class: GroupsController

Inherits:
Groups::ApplicationController show all
Includes:
FilterProjects, IssuesAction, MergeRequestsAction
Defined in:
app/controllers/groups_controller.rb

Instance Method Summary collapse

Methods included from MergeRequestsAction

#merge_requests

Methods included from IssuesAction

#issues

Methods included from FilterProjects

#filter_projects

Methods inherited from ApplicationController

#redirect_back_or_default

Methods included from PageLayoutHelper

#blank_container, #container_class, #fluid_layout, #header_title, #nav, #page_card_attributes, #page_card_meta_tags, #page_description, #page_image, #page_title, #sidebar

Methods included from GitlabRoutingHelper

#activity_project_path, #edit_project_path, #edit_project_url, #issue_path, #issue_url, #merge_request_path, #merge_request_url, #milestone_path, #project_builds_path, #project_commits_path, #project_files_path, #project_path, #project_pipelines_path, #project_snippet_url, #project_url, #runner_path, #runners_path, #toggle_subscription_path

Methods included from Gitlab::GonHelper

#add_gon_variables

Methods included from Gitlab::CurrentSettings

#current_application_settings, #fake_application_settings

Instance Method Details

#activityObject


66
67
68
69
70
71
72
73
74
75
# File 'app/controllers/groups_controller.rb', line 66

def activity
  respond_to do |format|
    format.html

    format.json do
      load_events
      pager_json("events/_events", @events.count)
    end
  end
end

#createObject


29
30
31
32
33
34
35
36
37
# File 'app/controllers/groups_controller.rb', line 29

def create
  @group = Groups::CreateService.new(current_user, group_params).execute

  if @group.persisted?
    redirect_to @group, notice: "Group '#{@group.name}' was successfully created."
  else
    render action: "new"
  end
end

#destroyObject


92
93
94
95
96
# File 'app/controllers/groups_controller.rb', line 92

def destroy
  DestroyGroupService.new(@group, current_user).execute

  redirect_to root_path, alert: "Group '#{@group.name}' was successfully deleted."
end

#editObject


77
78
# File 'app/controllers/groups_controller.rb', line 77

def edit
end

#indexObject


21
22
23
# File 'app/controllers/groups_controller.rb', line 21

def index
  redirect_to(current_user ? dashboard_groups_path : explore_groups_path)
end

#newObject


25
26
27
# File 'app/controllers/groups_controller.rb', line 25

def new
  @group = Group.new
end

#projectsObject


80
81
82
# File 'app/controllers/groups_controller.rb', line 80

def projects
  @projects = @group.projects.page(params[:page])
end

#showObject


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/controllers/groups_controller.rb', line 39

def show
  @last_push = current_user.recent_push if current_user

  @projects = @projects.includes(:namespace)
  @projects = @projects.sorted_by_activity
  @projects = filter_projects(@projects)
  @projects = @projects.sort(@sort = params[:sort])
  @projects = @projects.page(params[:page]) if params[:filter_projects].blank?

  @shared_projects = GroupProjectsFinder.new(group, only_shared: true).execute(current_user)

  respond_to do |format|
    format.html

    format.json do
      render json: {
        html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects })
      }
    end

    format.atom do
      load_events
      render layout: false
    end
  end
end

#updateObject


84
85
86
87
88
89
90
# File 'app/controllers/groups_controller.rb', line 84

def update
  if Groups::UpdateService.new(@group, current_user, group_params).execute
    redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated."
  else
    render action: "edit"
  end
end