Module: GlobalMilestones

Extended by:
ActiveSupport::Concern
Included in:
Dashboard::MilestonesController, Groups::MilestonesController
Defined in:
app/controllers/concerns/global_milestones.rb

Instance Method Summary collapse

Instance Method Details

#milestoneObject


11
12
13
14
15
16
17
18
19
# File 'app/controllers/concerns/global_milestones.rb', line 11

def milestone
  milestones = Milestone.of_projects(@projects).where(title: params[:title])

  if milestones.present?
    @milestone = GlobalMilestone.new(params[:title], milestones)
  else
    render_404
  end
end

#milestonesObject


4
5
6
7
8
9
# File 'app/controllers/concerns/global_milestones.rb', line 4

def milestones
  epoch = DateTime.parse('1970-01-01')
  @milestones = MilestonesFinder.new.execute(@projects, params)
  @milestones = GlobalMilestone.build_collection(@milestones)
  @milestones = @milestones.sort_by { |x| x.due_date.nil? ? epoch : x.due_date }
end