@@ -387,22 +387,23 class ProjectsController < ApplicationController | |||||
387 | # issue can be moved to any tracker |
|
387 | # issue can be moved to any tracker | |
388 | @trackers = Tracker.find(:all) |
|
388 | @trackers = Tracker.find(:all) | |
389 | if request.post? and params[:new_project_id] and params[:new_tracker_id] |
|
389 | if request.post? and params[:new_project_id] and params[:new_tracker_id] | |
390 | new_project = Project.find(params[:new_project_id]) |
|
390 | new_project = Project.find_by_id(params[:new_project_id]) | |
391 | new_tracker = Tracker.find(params[:new_tracker_id]) |
|
391 | new_tracker = Tracker.find_by_id(params[:new_tracker_id]) | |
392 |
@issues.each |
|
392 | @issues.each do |i| | |
393 | # project dependent properties |
|
393 | if new_project && i.project_id != new_project.id | |
394 | unless i.project_id == new_project.id |
|
394 | # issue is moved to another project | |
395 | i.category = nil |
|
395 | i.category = nil | |
396 | i.fixed_version = nil |
|
396 | i.fixed_version = nil | |
397 | # delete issue relations |
|
397 | # delete issue relations | |
398 | i.relations_from.clear |
|
398 | i.relations_from.clear | |
399 | i.relations_to.clear |
|
399 | i.relations_to.clear | |
|
400 | i.project = new_project | |||
|
401 | end | |||
|
402 | if new_tracker | |||
|
403 | i.tracker = new_tracker | |||
400 | end |
|
404 | end | |
401 | # move the issue |
|
|||
402 | i.project = new_project |
|
|||
403 | i.tracker = new_tracker |
|
|||
404 | i.save |
|
405 | i.save | |
405 |
|
|
406 | end | |
406 | flash[:notice] = l(:notice_successful_update) |
|
407 | flash[:notice] = l(:notice_successful_update) | |
407 | redirect_to :action => 'list_issues', :id => @project |
|
408 | redirect_to :action => 'list_issues', :id => @project | |
408 | end |
|
409 | end |
@@ -46,6 +46,7 class Project < ActiveRecord::Base | |||||
46 | validates_length_of :name, :maximum => 30 |
|
46 | validates_length_of :name, :maximum => 30 | |
47 | validates_format_of :name, :with => /^[\w\s\'\-]*$/i |
|
47 | validates_format_of :name, :with => /^[\w\s\'\-]*$/i | |
48 | validates_length_of :description, :maximum => 255 |
|
48 | validates_length_of :description, :maximum => 255 | |
|
49 | validates_length_of :homepage, :maximum => 30 | |||
49 | validates_length_of :identifier, :in => 3..12 |
|
50 | validates_length_of :identifier, :in => 3..12 | |
50 | validates_format_of :identifier, :with => /^[a-z0-9\-]*$/ |
|
51 | validates_format_of :identifier, :with => /^[a-z0-9\-]*$/ | |
51 |
|
52 |
@@ -4,7 +4,7 | |||||
4 | <% form_tag({:action => 'move_issues', :id => @project}, :class => "tabular") do %> |
|
4 | <% form_tag({:action => 'move_issues', :id => @project}, :class => "tabular") do %> | |
5 |
|
5 | |||
6 | <div class="box"> |
|
6 | <div class="box"> | |
7 | <p><label><%= l(:label_issue_plural) %>:</label> |
|
7 | <p><label><%= l(:label_issue_plural) %> :</label> | |
8 | <% for issue in @issues %> |
|
8 | <% for issue in @issues %> | |
9 | <%= link_to_issue issue %>: <%=h issue.subject %> |
|
9 | <%= link_to_issue issue %>: <%=h issue.subject %> | |
10 | <%= hidden_field_tag "issue_ids[]", issue.id %><br /> |
|
10 | <%= hidden_field_tag "issue_ids[]", issue.id %><br /> | |
@@ -14,11 +14,11 | |||||
14 | |
|
14 | | |
15 |
|
15 | |||
16 | <!--[form:issue]--> |
|
16 | <!--[form:issue]--> | |
17 | <p><label for="new_project_id"><%=l(:field_project)%></label> |
|
17 | <p><label for="new_project_id"><%=l(:field_project)%> :</label> | |
18 | <%= select_tag "new_project_id", options_from_collection_for_select(@projects, "id", "name", @project.id) %></p> |
|
18 | <%= select_tag "new_project_id", options_from_collection_for_select(@projects, "id", "name", @project.id) %></p> | |
19 |
|
19 | |||
20 | <p><label for="new_tracker_id"><%=l(:field_tracker)%></label> |
|
20 | <p><label for="new_tracker_id"><%=l(:field_tracker)%> :</label> | |
21 | <%= select_tag "new_tracker_id", options_from_collection_for_select(@trackers, "id", "name") %></p> |
|
21 | <%= select_tag "new_tracker_id", '<option></option>' + options_from_collection_for_select(@trackers, "id", "name") %></p> | |
22 | </div> |
|
22 | </div> | |
23 | <%= submit_tag l(:button_move) %> |
|
23 | <%= submit_tag l(:button_move) %> | |
24 | <% end %> |
|
24 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now