From 353c6571ddd49e247d285a0ce47499d35eaae916 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 30 Apr 2018 06:09:48 +0000 Subject: [PATCH] Set default category assignee immediately upon category selection (#15919). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@17320 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/issues/_attributes.html.erb | 2 +- app/views/issues/new.js.erb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 640a00e0b..3a3b5ac00 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -19,7 +19,7 @@ <% end %> <% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %> -

<%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %> +

<%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), {:include_blank => true, :required => @issue.required_attribute?('category_id')}, :onchange => ("updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" if @issue.new_record?) %> <%= link_to(l(:label_issue_category_new), new_project_issue_category_path(@issue.project), :remote => true, diff --git a/app/views/issues/new.js.erb b/app/views/issues/new.js.erb index c751b5750..58b9214b6 100644 --- a/app/views/issues/new.js.erb +++ b/app/views/issues/new.js.erb @@ -1,4 +1,9 @@ replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>'); -<% if params[:form_update_triggered_by] == "issue_project_id" %> -$("#watchers_form_container").html('<%= escape_javascript(render :partial => 'issues/watchers_form') %>'); +<% case params[:form_update_triggered_by] %> +<% when "issue_project_id" %> + $("#watchers_form_container").html('<%= escape_javascript(render :partial => 'issues/watchers_form') %>'); +<% when "issue_category_id" %> + <% if @issue.assigned_to_id.blank? %> + $('#issue_assigned_to_id').val('<%= @issue.category.try(:assigned_to_id) %>'); + <% end %> <% end %> -- 2.39.5