summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-10-25 11:23:46 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-10-25 11:23:46 +0000
commit6fedbf60d5a9bb2747b1e250ffc9f5f4947676f6 (patch)
treeac8fa3b202cf53627363c5fcf789b7acafe905b4 /app
parent6dfe0395a5890016bd9124fa2f1e9e69d4ed94d0 (diff)
downloadredmine-6fedbf60d5a9bb2747b1e250ffc9f5f4947676f6.tar.gz
redmine-6fedbf60d5a9bb2747b1e250ffc9f5f4947676f6.zip
Allow project forums copy.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2976 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb12
-rw-r--r--app/views/projects/copy.rhtml1
2 files changed, 12 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 7b9080833..00aa5df6c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -408,7 +408,7 @@ class Project < ActiveRecord::Base
def copy(project, options={})
project = project.is_a?(Project) ? project : Project.find(project)
- to_be_copied = %w(wiki versions issue_categories issues members queries)
+ to_be_copied = %w(wiki versions issue_categories issues members queries boards)
to_be_copied = to_be_copied & options[:only].to_a unless options[:only].nil?
Project.transaction do
@@ -521,6 +521,16 @@ class Project < ActiveRecord::Base
self.queries << new_query
end
end
+
+ # Copies boards from +project+
+ def copy_boards(project)
+ project.boards.each do |board|
+ new_board = Board.new
+ new_board.attributes = board.attributes.dup.except("id", "project_id", "topics_count", "messages_count", "last_message_id")
+ new_board.project = self
+ self.boards << new_board
+ end
+ end
def allowed_permissions
@allowed_permissions ||= begin
diff --git a/app/views/projects/copy.rhtml b/app/views/projects/copy.rhtml
index f88817c1f..49e262786 100644
--- a/app/views/projects/copy.rhtml
+++ b/app/views/projects/copy.rhtml
@@ -18,6 +18,7 @@
<label class="block"><%= check_box_tag 'only[]', 'issue_categories', true %> <%= l(:label_issue_category_plural) %> (<%= @source_project.issue_categories.count %>)</label>
<label class="block"><%= check_box_tag 'only[]', 'issues', true %> <%= l(:label_issue_plural) %> (<%= @source_project.issues.count %>)</label>
<label class="block"><%= check_box_tag 'only[]', 'queries', true %> <%= l(:label_query_plural) %> (<%= @source_project.queries.count %>)</label>
+ <label class="block"><%= check_box_tag 'only[]', 'boards', true %> <%= l(:label_board_plural) %> (<%= @source_project.boards.count %>)</label>
<label class="block"><%= check_box_tag 'only[]', 'wiki', true %> <%= l(:label_wiki_page_plural) %> (<%= @source_project.wiki.nil? ? 0 : @source_project.wiki.pages.count %>)</label>
<%= hidden_field_tag 'only[]', '' %>
</fieldset>