@@ -169,8 +169,18 class ProjectsController < ApplicationController | |||||
169 | def add_issue_category |
|
169 | def add_issue_category | |
170 | @category = @project.issue_categories.build(params[:category]) |
|
170 | @category = @project.issue_categories.build(params[:category]) | |
171 | if request.post? and @category.save |
|
171 | if request.post? and @category.save | |
172 | flash[:notice] = l(:notice_successful_create) |
|
172 | respond_to do |format| | |
173 | redirect_to :action => 'settings', :tab => 'categories', :id => @project |
|
173 | format.html do | |
|
174 | flash[:notice] = l(:notice_successful_create) | |||
|
175 | redirect_to :action => 'settings', :tab => 'categories', :id => @project | |||
|
176 | end | |||
|
177 | format.js do | |||
|
178 | # IE doesn't support the replace_html rjs method for select box options | |||
|
179 | render(:update) {|page| page.replace "issue_category_id", | |||
|
180 | content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]') | |||
|
181 | } | |||
|
182 | end | |||
|
183 | end | |||
174 | end |
|
184 | end | |
175 | end |
|
185 | end | |
176 |
|
186 |
@@ -77,6 +77,11 module ApplicationHelper | |||||
77 | })) |
|
77 | })) | |
78 | end |
|
78 | end | |
79 |
|
79 | |||
|
80 | def prompt_to_remote(name, text, param, url, html_options = {}) | |||
|
81 | html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" | |||
|
82 | link_to name, {}, html_options | |||
|
83 | end | |||
|
84 | ||||
80 | def format_date(date) |
|
85 | def format_date(date) | |
81 | return nil unless date |
|
86 | return nil unless date | |
82 | @date_format_setting ||= Setting.date_format.to_i |
|
87 | @date_format_setting ||= Setting.date_format.to_i |
@@ -8,7 +8,11 | |||||
8 | <p><label><%=l(:field_status)%></label> <%= @issue.status.name %></p> |
|
8 | <p><label><%=l(:field_status)%></label> <%= @issue.status.name %></p> | |
9 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p> |
|
9 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p> | |
10 | <p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p> |
|
10 | <p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p> | |
11 |
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> |
|
11 | <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> | |
|
12 | <%= prompt_to_remote(l(:label_issue_category_new), | |||
|
13 | l(:label_issue_category_new), 'category[name]', | |||
|
14 | {:controller => 'projects', :action => 'add_issue_category', :id => @project}, | |||
|
15 | :class => 'small') if authorize_for('projects', 'add_issue_category') %></p> | |||
12 | </div> |
|
16 | </div> | |
13 |
|
17 | |||
14 | <div class="splitcontentright"> |
|
18 | <div class="splitcontentright"> |
@@ -10,7 +10,11 | |||||
10 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> |
|
10 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> | |
11 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p> |
|
11 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p> | |
12 | <p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p> |
|
12 | <p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p> | |
13 |
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> |
|
13 | <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> | |
|
14 | <%= prompt_to_remote(l(:label_issue_category_new), | |||
|
15 | l(:label_issue_category_new), 'category[name]', | |||
|
16 | {:controller => 'projects', :action => 'add_issue_category', :id => @project}, | |||
|
17 | :class => 'small') if authorize_for('projects', 'add_issue_category') %></p> | |||
14 | </div> |
|
18 | </div> | |
15 | <div class="splitcontentright"> |
|
19 | <div class="splitcontentright"> | |
16 | <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p> |
|
20 | <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p> |
@@ -41,6 +41,14 function setPredecessorFieldsVisibility() { | |||||
41 | } |
|
41 | } | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
|
44 | function promptToRemote(text, param, url) { | |||
|
45 | value = prompt(text + ':'); | |||
|
46 | if (value) { | |||
|
47 | new Ajax.Request(url + '?' + param + '=' + value, {asynchronous:true, evalScripts:true}); | |||
|
48 | return false; | |||
|
49 | } | |||
|
50 | } | |||
|
51 | ||||
44 | /* shows and hides ajax indicator */ |
|
52 | /* shows and hides ajax indicator */ | |
45 | Ajax.Responders.register({ |
|
53 | Ajax.Responders.register({ | |
46 | onCreate: function(){ |
|
54 | onCreate: function(){ |
General Comments 0
You need to be logged in to leave comments.
Login now