Class: Groups::MilestonesController

Inherits:
ApplicationController show all
Includes:
GlobalMilestones
Defined in:
app/controllers/groups/milestones_controller.rb

Instance Method Summary collapse

Methods included from GlobalMilestones

#milestone, #milestones

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, #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

#createObject


20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/groups/milestones_controller.rb', line 20

def create
  project_ids = params[:milestone][:project_ids].reject(&:blank?)
  title = milestone_params[:title]

  if create_milestones(project_ids)
    redirect_to milestone_path(title)
  else
    render_new_with_error(project_ids.empty?)
  end
end

#indexObject


8
9
10
11
12
13
14
# File 'app/controllers/groups/milestones_controller.rb', line 8

def index
  respond_to do |format|
    format.html do
      @milestones = Kaminari.paginate_array(milestones).page(params[:page])
    end
  end
end

#newObject


16
17
18
# File 'app/controllers/groups/milestones_controller.rb', line 16

def new
  @milestone = Milestone.new
end

#showObject


31
32
# File 'app/controllers/groups/milestones_controller.rb', line 31

def show
end

#updateObject


34
35
36
37
38
39
40
# File 'app/controllers/groups/milestones_controller.rb', line 34

def update
  @milestone.milestones.each do |milestone|
    Milestones::UpdateService.new(milestone.project, current_user, milestone_params).execute(milestone)
  end

  redirect_back_or_default(default: milestone_path(@milestone.title))
end