summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-31 20:56:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-31 20:56:14 +0000
commit1281d99f3057c391e6523d21ac6dee6fefba41ca (patch)
treed14c639e757880b27f72a418b89e81aa62723b30 /app
parentc68dac7e9ad0e4f8d46a5799de7aef75d28da664 (diff)
downloadredmine-1281d99f3057c391e6523d21ac6dee6fefba41ca.tar.gz
redmine-1281d99f3057c391e6523d21ac6dee6fefba41ca.zip
Added the ability to move issues (to another project) without changing their trackers.
Added length validation for homepage project attribute. git-svn-id: http://redmine.rubyforge.org/svn/trunk@687 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb19
-rw-r--r--app/models/project.rb1
-rw-r--r--app/views/projects/move_issues.rhtml8
3 files changed, 15 insertions, 13 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 8d8250d20..63cf8a0d1 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -387,22 +387,23 @@ class ProjectsController < ApplicationController
# issue can be moved to any tracker
@trackers = Tracker.find(:all)
if request.post? and params[:new_project_id] and params[:new_tracker_id]
- new_project = Project.find(params[:new_project_id])
- new_tracker = Tracker.find(params[:new_tracker_id])
- @issues.each { |i|
- # project dependent properties
- unless i.project_id == new_project.id
+ new_project = Project.find_by_id(params[:new_project_id])
+ new_tracker = Tracker.find_by_id(params[:new_tracker_id])
+ @issues.each do |i|
+ if new_project && i.project_id != new_project.id
+ # issue is moved to another project
i.category = nil
i.fixed_version = nil
# delete issue relations
i.relations_from.clear
i.relations_to.clear
+ i.project = new_project
+ end
+ if new_tracker
+ i.tracker = new_tracker
end
- # move the issue
- i.project = new_project
- i.tracker = new_tracker
i.save
- }
+ end
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list_issues', :id => @project
end
diff --git a/app/models/project.rb b/app/models/project.rb
index f994ed6a5..eeeaa9fd4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -46,6 +46,7 @@ class Project < ActiveRecord::Base
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_length_of :description, :maximum => 255
+ validates_length_of :homepage, :maximum => 30
validates_length_of :identifier, :in => 3..12
validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
diff --git a/app/views/projects/move_issues.rhtml b/app/views/projects/move_issues.rhtml
index fd8edb208..e9e4bb787 100644
--- a/app/views/projects/move_issues.rhtml
+++ b/app/views/projects/move_issues.rhtml
@@ -4,7 +4,7 @@
<% form_tag({:action => 'move_issues', :id => @project}, :class => "tabular") do %>
<div class="box">
-<p><label><%= l(:label_issue_plural) %>:</label>
+<p><label><%= l(:label_issue_plural) %> :</label>
<% for issue in @issues %>
<%= link_to_issue issue %>: <%=h issue.subject %>
<%= hidden_field_tag "issue_ids[]", issue.id %><br />
@@ -14,11 +14,11 @@
&nbsp;
<!--[form:issue]-->
-<p><label for="new_project_id"><%=l(:field_project)%></label>
+<p><label for="new_project_id"><%=l(:field_project)%> :</label>
<%= select_tag "new_project_id", options_from_collection_for_select(@projects, "id", "name", @project.id) %></p>
-<p><label for="new_tracker_id"><%=l(:field_tracker)%></label>
-<%= select_tag "new_tracker_id", options_from_collection_for_select(@trackers, "id", "name") %></p>
+<p><label for="new_tracker_id"><%=l(:field_tracker)%> :</label>
+<%= select_tag "new_tracker_id", '<option></option>' + options_from_collection_for_select(@trackers, "id", "name") %></p>
</div>
<%= submit_tag l(:button_move) %>
<% end %>