2015-01-06 15:32:04 -05:00
|
|
|
module MilestonesHelper
|
|
|
|
def milestones_filter_path(opts = {})
|
|
|
|
if @project
|
2015-01-24 13:02:58 -05:00
|
|
|
namespace_project_milestones_path(@project.namespace, @project, opts)
|
2015-01-06 15:32:04 -05:00
|
|
|
elsif @group
|
|
|
|
group_milestones_path(@group, opts)
|
2015-03-03 10:19:37 -05:00
|
|
|
else
|
|
|
|
dashboard_milestones_path(opts)
|
2015-01-06 15:32:04 -05:00
|
|
|
end
|
|
|
|
end
|
2015-03-09 18:20:32 -04:00
|
|
|
|
|
|
|
def milestone_progress_bar(milestone)
|
|
|
|
options = {
|
|
|
|
class: 'progress-bar progress-bar-success',
|
|
|
|
style: "width: #{milestone.percent_complete}%;"
|
|
|
|
}
|
|
|
|
|
|
|
|
content_tag :div, class: 'progress' do
|
|
|
|
content_tag :div, nil, options
|
|
|
|
end
|
|
|
|
end
|
2015-03-26 22:13:49 -04:00
|
|
|
|
|
|
|
def projects_milestones_options
|
|
|
|
milestones =
|
|
|
|
if @project
|
|
|
|
@project.milestones
|
|
|
|
else
|
|
|
|
Milestone.where(project_id: @projects)
|
|
|
|
end.active
|
|
|
|
|
2015-04-30 17:29:00 -04:00
|
|
|
grouped_milestones = Milestones::GroupService.new(milestones).execute
|
2015-06-28 16:12:32 -04:00
|
|
|
grouped_milestones.unshift(Milestone::None)
|
2015-10-09 00:24:55 -04:00
|
|
|
grouped_milestones.unshift(Milestone::Any)
|
2015-06-24 18:07:29 -04:00
|
|
|
|
2015-10-09 00:24:55 -04:00
|
|
|
options_from_collection_for_select(grouped_milestones, 'name', 'title', params[:milestone_title])
|
2015-03-26 22:13:49 -04:00
|
|
|
end
|
2015-01-06 15:32:04 -05:00
|
|
|
end
|