annotate .svn/pristine/68/68bd17bebc5bfbe2bcbf019b9cf0d56ac2adcfff.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents dffacf8a6908
children
rev   line source
Chris@1517 1 # Redmine - project management software
Chris@1517 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
Chris@1517 3 #
Chris@1517 4 # This program is free software; you can redistribute it and/or
Chris@1517 5 # modify it under the terms of the GNU General Public License
Chris@1517 6 # as published by the Free Software Foundation; either version 2
Chris@1517 7 # of the License, or (at your option) any later version.
Chris@1517 8 #
Chris@1517 9 # This program is distributed in the hope that it will be useful,
Chris@1517 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1517 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1517 12 # GNU General Public License for more details.
Chris@1517 13 #
Chris@1517 14 # You should have received a copy of the GNU General Public License
Chris@1517 15 # along with this program; if not, write to the Free Software
Chris@1517 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1517 17
Chris@1517 18 class ContextMenusController < ApplicationController
Chris@1517 19 helper :watchers
Chris@1517 20 helper :issues
Chris@1517 21
Chris@1517 22 before_filter :find_issues, :only => :issues
Chris@1517 23
Chris@1517 24 def issues
Chris@1517 25 if (@issues.size == 1)
Chris@1517 26 @issue = @issues.first
Chris@1517 27 end
Chris@1517 28 @issue_ids = @issues.map(&:id).sort
Chris@1517 29
Chris@1517 30 @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
Chris@1517 31
Chris@1517 32 @can = {:edit => User.current.allowed_to?(:edit_issues, @projects),
Chris@1517 33 :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
Chris@1517 34 :update => (User.current.allowed_to?(:edit_issues, @projects) || (User.current.allowed_to?(:change_status, @projects) && !@allowed_statuses.blank?)),
Chris@1517 35 :move => (@project && User.current.allowed_to?(:move_issues, @project)),
Chris@1517 36 :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
Chris@1517 37 :delete => User.current.allowed_to?(:delete_issues, @projects)
Chris@1517 38 }
Chris@1517 39 if @project
Chris@1517 40 if @issue
Chris@1517 41 @assignables = @issue.assignable_users
Chris@1517 42 else
Chris@1517 43 @assignables = @project.assignable_users
Chris@1517 44 end
Chris@1517 45 @trackers = @project.trackers
Chris@1517 46 else
Chris@1517 47 #when multiple projects, we only keep the intersection of each set
Chris@1517 48 @assignables = @projects.map(&:assignable_users).reduce(:&)
Chris@1517 49 @trackers = @projects.map(&:trackers).reduce(:&)
Chris@1517 50 end
Chris@1517 51 @versions = @projects.map {|p| p.shared_versions.open}.reduce(:&)
Chris@1517 52
Chris@1517 53 @priorities = IssuePriority.active.reverse
Chris@1517 54 @back = back_url
Chris@1517 55
Chris@1517 56 @options_by_custom_field = {}
Chris@1517 57 if @can[:edit]
Chris@1517 58 custom_fields = @issues.map(&:editable_custom_fields).reduce(:&).reject(&:multiple?)
Chris@1517 59 custom_fields.each do |field|
Chris@1517 60 values = field.possible_values_options(@projects)
Chris@1517 61 if values.present?
Chris@1517 62 @options_by_custom_field[field] = values
Chris@1517 63 end
Chris@1517 64 end
Chris@1517 65 end
Chris@1517 66
Chris@1517 67 @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
Chris@1517 68 render :layout => false
Chris@1517 69 end
Chris@1517 70
Chris@1517 71 def time_entries
Chris@1517 72 @time_entries = TimeEntry.where(:id => params[:ids]).preload(:project).to_a
Chris@1517 73 (render_404; return) unless @time_entries.present?
Chris@1517 74
Chris@1517 75 @projects = @time_entries.collect(&:project).compact.uniq
Chris@1517 76 @project = @projects.first if @projects.size == 1
Chris@1517 77 @activities = TimeEntryActivity.shared.active
Chris@1517 78 @can = {:edit => User.current.allowed_to?(:edit_time_entries, @projects),
Chris@1517 79 :delete => User.current.allowed_to?(:edit_time_entries, @projects)
Chris@1517 80 }
Chris@1517 81 @back = back_url
Chris@1517 82 render :layout => false
Chris@1517 83 end
Chris@1517 84 end