debian-mirror-gitlab/app/controllers/concerns/milestone_actions.rb

56 lines
1.3 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
module MilestoneActions
extend ActiveSupport::Concern
def merge_requests
respond_to do |format|
format.html { redirect_to milestone_redirect_path }
format.json do
render json: tabs_json("shared/milestones/_merge_requests_tab", {
2017-09-10 17:25:29 +05:30
merge_requests: @milestone.sorted_merge_requests,
2017-08-17 22:00:37 +05:30
show_project_name: true
})
end
end
end
def participants
respond_to do |format|
format.html { redirect_to milestone_redirect_path }
format.json do
render json: tabs_json("shared/milestones/_participants_tab", {
users: @milestone.participants
})
end
end
end
def labels
respond_to do |format|
format.html { redirect_to milestone_redirect_path }
format.json do
render json: tabs_json("shared/milestones/_labels_tab", {
labels: @milestone.labels
})
end
end
end
private
def tabs_json(partial, data = {})
{
html: view_to_html_string(partial, data)
}
end
def milestone_redirect_path
if @project
2017-09-10 17:25:29 +05:30
project_milestone_path(@project, @milestone)
elsif @group
2017-08-17 22:00:37 +05:30
group_milestone_path(@group, @milestone.safe_title, title: @milestone.title)
2017-09-10 17:25:29 +05:30
else
dashboard_milestone_path(@milestone.safe_title, title: @milestone.title)
2017-08-17 22:00:37 +05:30
end
end
end