Commit fab7fdcf authored by Maxim Rydkin's avatar Maxim Rydkin

replace `is_group_milestone?` with `group_milestone?`

parent ac3e5a58
module MilestonesRoutingHelper module MilestonesRoutingHelper
def milestone_path(milestone, *args) def milestone_path(milestone, *args)
if milestone.is_group_milestone? if milestone.group_milestone?
group_milestone_path(milestone.group, milestone, *args) group_milestone_path(milestone.group, milestone, *args)
elsif milestone.project_milestone? elsif milestone.project_milestone?
project_milestone_path(milestone.project, milestone, *args) project_milestone_path(milestone.project, milestone, *args)
...@@ -8,7 +8,7 @@ module MilestonesRoutingHelper ...@@ -8,7 +8,7 @@ module MilestonesRoutingHelper
end end
def milestone_url(milestone, *args) def milestone_url(milestone, *args)
if milestone.is_group_milestone? if milestone.group_milestone?
group_milestone_url(milestone.group, milestone, *args) group_milestone_url(milestone.group, milestone, *args)
elsif milestone.project_milestone? elsif milestone.project_milestone?
project_milestone_url(milestone.project, milestone, *args) project_milestone_url(milestone.project, milestone, *args)
......
...@@ -70,7 +70,7 @@ module Milestoneish ...@@ -70,7 +70,7 @@ module Milestoneish
due_date && due_date.past? due_date && due_date.past?
end end
def is_group_milestone? def group_milestone?
false false
end end
......
...@@ -163,7 +163,7 @@ class Milestone < ActiveRecord::Base ...@@ -163,7 +163,7 @@ class Milestone < ActiveRecord::Base
# Milestone.first.to_reference(same_namespace_project) # => "gitlab-ce%1" # Milestone.first.to_reference(same_namespace_project) # => "gitlab-ce%1"
# #
def to_reference(from_project = nil, format: :iid, full: false) def to_reference(from_project = nil, format: :iid, full: false)
return if is_group_milestone? && format != :name return if group_milestone? && format != :name
format_reference = milestone_format_reference(format) format_reference = milestone_format_reference(format)
reference = "#{self.class.reference_prefix}#{format_reference}" reference = "#{self.class.reference_prefix}#{format_reference}"
...@@ -207,7 +207,7 @@ class Milestone < ActiveRecord::Base ...@@ -207,7 +207,7 @@ class Milestone < ActiveRecord::Base
group || project group || project
end end
def is_group_milestone? def group_milestone?
group_id.present? group_id.present?
end end
......
...@@ -142,7 +142,7 @@ module SystemNoteService ...@@ -142,7 +142,7 @@ module SystemNoteService
# #
# Returns the created Note object # Returns the created Note object
def change_milestone(noteable, project, author, milestone) def change_milestone(noteable, project, author, milestone)
format = milestone&.is_group_milestone? ? :name : :iid format = milestone&.group_milestone? ? :name : :iid
body = milestone.nil? ? 'removed milestone' : "changed milestone to #{milestone.to_reference(project, format: format)}" body = milestone.nil? ? 'removed milestone' : "changed milestone to #{milestone.to_reference(project, format: format)}"
create_note(NoteSummary.new(noteable, project, author, body, action: 'milestone')) create_note(NoteSummary.new(noteable, project, author, body, action: 'milestone'))
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
.row .row
.col-sm-6 .col-sm-6
%strong= link_to truncate(milestone.title, length: 100), milestone_path %strong= link_to truncate(milestone.title, length: 100), milestone_path
- if milestone.is_group_milestone? - if milestone.group_milestone?
%span - Group Milestone %span - Group Milestone
- else - else
%span - Project Milestone %span - Project Milestone
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
&middot; &middot;
= link_to pluralize(milestone.merge_requests.size, 'Merge Request'), merge_requests_path = link_to pluralize(milestone.merge_requests.size, 'Merge Request'), merge_requests_path
.col-sm-6= milestone_progress_bar(milestone) .col-sm-6= milestone_progress_bar(milestone)
- if milestone.is_a?(GlobalMilestone) || milestone.is_group_milestone? - if milestone.is_a?(GlobalMilestone) || milestone.group_milestone?
.row .row
.col-sm-6 .col-sm-6
- if milestone.legacy_group_milestone? - if milestone.legacy_group_milestone?
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
- if @group - if @group
.col-sm-6.milestone-actions .col-sm-6.milestone-actions
- if can?(current_user, :admin_milestones, @group) - if can?(current_user, :admin_milestones, @group)
- if milestone.is_group_milestone? - if milestone.group_milestone?
= link_to edit_group_milestone_path(@group, milestone), class: "btn btn-xs btn-grouped" do = link_to edit_group_milestone_path(@group, milestone), class: "btn btn-xs btn-grouped" do
Edit Edit
\ \
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- if group - if group
.pull-right .pull-right
- if can?(current_user, :admin_milestones, group) - if can?(current_user, :admin_milestones, group)
- if milestone.is_group_milestone? - if milestone.group_milestone?
= link_to edit_group_milestone_path(group, milestone), class: "btn btn btn-grouped" do = link_to edit_group_milestone_path(group, milestone), class: "btn btn btn-grouped" do
Edit Edit
- if milestone.active? - if milestone.active?
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
.detail-page-description.milestone-detail .detail-page-description.milestone-detail
%h2.title %h2.title
= markdown_field(milestone, :title) = markdown_field(milestone, :title)
- if @milestone.is_group_milestone? && @milestone.description.present? - if @milestone.group_milestone? && @milestone.description.present?
%div %div
.description .description
.wiki .wiki
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
Open Open
%td %td
= ms.expires_at = ms.expires_at
- elsif @milestone.is_group_milestone? - elsif @milestone.group_milestone?
%br %br
View View
= link_to 'Issues', issues_group_path(@group, milestone_title: milestone.title) = link_to 'Issues', issues_group_path(@group, milestone_title: milestone.title)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment