summaryrefslogtreecommitdiffstats
path: root/app/controllers/context_menus_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/context_menus_controller.rb')
-rw-r--r--app/controllers/context_menus_controller.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb
index 2b174c016..36cb13f26 100644
--- a/app/controllers/context_menus_controller.rb
+++ b/app/controllers/context_menus_controller.rb
@@ -71,6 +71,9 @@ class ContextMenusController < ApplicationController
def time_entries
@time_entries = TimeEntry.where(:id => params[:ids]).preload(:project).to_a
(render_404; return) unless @time_entries.present?
+ if (@time_entries.size == 1)
+ @time_entry = @time_entries.first
+ end
@projects = @time_entries.collect(&:project).compact.uniq
@project = @projects.first if @projects.size == 1
@@ -79,6 +82,18 @@ class ContextMenusController < ApplicationController
:delete => User.current.allowed_to?(:edit_time_entries, @projects)
}
@back = back_url
+
+ @options_by_custom_field = {}
+ if @can[:edit]
+ custom_fields = @time_entries.map(&:editable_custom_fields).reduce(:&).reject(&:multiple?)
+ custom_fields.each do |field|
+ values = field.possible_values_options(@projects)
+ if values.present?
+ @options_by_custom_field[field] = values
+ end
+ end
+ end
+
render :layout => false
end
end