Feature #12704 » project-select.patch
| redmine-3.2.1/app/controllers/issues_controller.rb 2016-06-09 17:53:20.482524185 +0200 | ||
|---|---|---|
| 42 | 42 |
include SortHelper |
| 43 | 43 |
helper :timelog |
| 44 | 44 | |
| 45 |
def find_optional_project |
|
| 46 |
@project = Project.find(params[:project_id]) unless params[:project_id].blank? |
|
| 47 |
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
|
|
| 48 | ||
| 49 |
if ! allowed and ! @project.nil? |
|
| 50 |
@project.children.each do |subproject| |
|
| 51 |
if User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, subproject, :global => true)
|
|
| 52 |
@project = subproject |
|
| 53 |
return true; |
|
| 54 |
end |
|
| 55 |
end |
|
| 56 | ||
| 57 |
@project = nil |
|
| 58 |
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
|
|
| 59 |
end |
|
| 60 | ||
| 61 |
allowed ? true : deny_access |
|
| 62 |
rescue ActiveRecord::RecordNotFound |
|
| 63 |
render_404 |
|
| 64 |
end |
|
| 65 | ||
| 45 | 66 |
def index |
| 46 | 67 |
retrieve_query |
| 47 | 68 |
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
| redmine-3.2.1/app/views/issues/_form.html.erb 2016-06-08 16:36:32.921088980 +0200 | ||
|---|---|---|
| 8 | 8 |
</p> |
| 9 | 9 |
<% end %> |
| 10 | 10 | |
| 11 |
<% if @issue.safe_attribute?('project_id') && (!@issue.new_record? || @project.nil? || @issue.copy?) %>
|
|
| 11 |
<% if @issue.safe_attribute?('project_id') #&& (!@issue.new_record? || @project.nil? || @issue.copy?)
|
|
| 12 |
%> |
|
| 12 | 13 |
<p><%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true},
|
| 13 | 14 |
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
|
| 14 | 15 |
<% end %> |