From bd8de9a6f84052f72930dac3c5ee2e353c249238 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 2 Apr 2007 17:45:21 +0000 Subject: [PATCH] Added the ability to copy an existing workflow when creating a new tracker. git-svn-id: http://redmine.rubyforge.org/svn/trunk@399 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/trackers_controller.rb | 7 +++++++ app/views/trackers/_form.rhtml | 3 +++ lang/de.yml | 1 + lang/en.yml | 1 + lang/es.yml | 1 + lang/fr.yml | 1 + lang/it.yml | 1 + lang/ja.yml | 1 + lang/zh.yml | 1 + 9 files changed, 17 insertions(+) diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index db30862c6..a473bcf41 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -35,9 +35,16 @@ class TrackersController < ApplicationController def new @tracker = Tracker.new(params[:tracker]) if request.post? and @tracker.save + # workflow copy + if params[:copy_workflow_from] && (copy_from = Tracker.find_by_id(params[:copy_workflow_from])) + copy_from.workflows.each do |w| + @tracker.workflows << w.clone + end + end flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end + @trackers = Tracker.find :all end def edit diff --git a/app/views/trackers/_form.rhtml b/app/views/trackers/_form.rhtml index 3dea238d8..26a34443c 100644 --- a/app/views/trackers/_form.rhtml +++ b/app/views/trackers/_form.rhtml @@ -4,5 +4,8 @@

<%= f.text_field :name, :required => true %>

<%= f.check_box :is_in_chlog %>

<%= f.check_box :is_in_roadmap %>

+<% if @tracker.new_record? %> +

<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name)) %>

+<% end %> diff --git a/lang/de.yml b/lang/de.yml index a98947d77..39b3ea1f5 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -354,6 +354,7 @@ label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side label_options: Options +label_copy_workflow_from: Copy workflow from button_login: Einloggen button_submit: OK diff --git a/lang/en.yml b/lang/en.yml index d4c589299..4f0cbe9f0 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -354,6 +354,7 @@ label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side label_options: Options +label_copy_workflow_from: Copy workflow from button_login: Login button_submit: Submit diff --git a/lang/es.yml b/lang/es.yml index aad0b95a0..7b05f3707 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -354,6 +354,7 @@ label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side label_options: Options +label_copy_workflow_from: Copy workflow from button_login: Conexión button_submit: Someter diff --git a/lang/fr.yml b/lang/fr.yml index 4218ca4f4..564b5fe78 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -354,6 +354,7 @@ label_view_diff: Voir les différences label_diff_inline: en ligne label_diff_side_by_side: côte à côte label_options: Options +label_copy_workflow_from: Copier le workflow de button_login: Connexion button_submit: Soumettre diff --git a/lang/it.yml b/lang/it.yml index d5c0f43dd..fc2d405a3 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -354,6 +354,7 @@ label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side label_options: Options +label_copy_workflow_from: Copy workflow from button_login: Login button_submit: Invia diff --git a/lang/ja.yml b/lang/ja.yml index 127dbbe51..db4335c38 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -355,6 +355,7 @@ label_view_diff: 差分を見る label_diff_inline: インライン label_diff_side_by_side: 横に並べる label_options: Options +label_copy_workflow_from: Copy workflow from button_login: ログイン button_submit: 変更 diff --git a/lang/zh.yml b/lang/zh.yml index 1496583fa..a0508d34b 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -357,6 +357,7 @@ label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side label_options: Options +label_copy_workflow_from: Copy workflow from button_login: 登录 button_submit: 提交 -- 2.39.5