Project

General

Profile

Defect #23922 » 23922-activities_time_entries_context_menu.patch

Felix Schäfer, 2016-09-25 09:46

View differences:

app/controllers/context_menus_controller.rb
59 59
  end
60 60

  
61 61
  def time_entries
62
    @time_entries = TimeEntry.where(:id => params[:ids]).preload(:project).to_a
62
    @time_entries = TimeEntry.where(:id => params[:ids]).preload(:project => :time_entry_activities).to_a
63 63
    (render_404; return) unless @time_entries.present?
64 64
    if (@time_entries.size == 1)
65 65
      @time_entry = @time_entries.first
......
67 67

  
68 68
    @projects = @time_entries.collect(&:project).compact.uniq
69 69
    @project = @projects.first if @projects.size == 1
70
    @activities = TimeEntryActivity.shared.active
70
    @activities = @projects.map(&:activities).reduce(:&)
71 71

  
72 72
    edit_allowed = @time_entries.all? {|t| t.editable_by?(User.current)}
73 73
    @can = {:edit => edit_allowed, :delete => edit_allowed}
    (1-1/1)