Project

General

Profile

Actions

Patch #2931

open

Templating for description of new tickets by Tracker

Added by Rodrigo Panachi almost 16 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Start date:
Due date:
% Done:

0%

Estimated time:

Description

This patch allows to assign a template for Trackers to be inserted in the description field when creating a new Issue. This is useful to maintain the standardization of issues.

This was diff'd against svn trunk revision 2568.


Files

templating_for_trackers.diff (2.23 KB) templating_for_trackers.diff SVN diff for revision 2568 Rodrigo Panachi, 2009-03-08 18:18
102_add_trackers_template.rb (192 Bytes) 102_add_trackers_template.rb DB migration for templating description Rodrigo Panachi, 2009-03-08 18:21
tracker_templates_redmine_0.9.6.diff (1.87 KB) tracker_templates_redmine_0.9.6.diff tracker_templates_redmine_0.9.6.diff Pieter Smith, 2010-07-22 13:40
tracker_templates_redmine_0.9.6.diff (1.86 KB) tracker_templates_redmine_0.9.6.diff Tracker description templates for Redmine 0.9.6 Pieter Smith, 2010-07-22 16:23
tracker_templates_redmine_1.2-stable.diff (3.21 KB) tracker_templates_redmine_1.2-stable.diff Tracker dependent Issue Description templates for Redmine 1.2-stable Martin Corino, 2011-09-20 09:37

Related issues

Related to Redmine - Feature #1138: Issue templatesClosed2008-04-29

Actions
Related to Redmine - Feature #643: Issue description templatesNew2008-02-12

Actions
Has duplicate Redmine - Feature #7055: Default description per tracker.Closed2010-12-06

Actions
Has duplicate Redmine - Feature #5341: Default issue description per tracker basisClosed2010-04-16

Actions
Actions #2

Updated by Damien Couderc almost 16 years ago

Related to ticket #1138

Actions #3

Updated by Pieter Smith over 14 years ago

I updated the patch for Redmine 0.9.6. Note that the patch only includes the English language definitions.

Actions #4

Updated by Pieter Smith over 14 years ago

Oops... Here is the updated file:

Actions #5

Updated by Pieter Smith over 14 years ago

My apologies. I diffed the states in the wrong order. Here is the proper 0.9.6 patch.

Actions #6

Updated by Light Kong over 14 years ago

We installed this latest patch on 1.0.0. and are able to configure different description templates for different trackers.

Upon creation of new issue, the description template for the default tracker is shown. However, when a different tracker is chosen from the drop down list, the description template shown remains the one for the default tracker while other custom fields are updated according to the chosen tracker. Somehow it does not update the description template according to the chosen tracker. Please advice.

Actions #7

Updated by Rodrigo Panachi over 14 years ago

Light Kong, the description is changed only on creation of an issue (new record) in order to prevent the lost of issue's description when editing. Feel free to change this behavior.

Actions #8

Updated by Avery Chan about 14 years ago

Some tips on installing this patch (I was puzzled at first).

In you root of redmine installation where you have tracker_templates_redmine_0.9.6.diff:

> patch -p1 <  tracker_templates_redmine_0.9.6.diff 
> rake db:migrate

You may need to tweak the cols style in app/views/trackers/_form.rhtml to fit in your particular preferences, but go to Administration->Tracker-><your tracker here> and you should see the form.

Actions #9

Updated by Damien Couderc almost 14 years ago

Hi,
any reason why this is not yet in trunk ?

Actions #10

Updated by Terence Mill almost 14 years ago

+1

Actions #11

Updated by Antoine Roux almost 14 years ago

+1 ! :o)

Actions #12

Updated by Dominic Clifton almost 14 years ago

+1

Actions #13

Updated by John Stone over 13 years ago

This is a great patch that I would love to see included as standard.

It is worth noting that the default ":string" type for the template column in 102_add_trackers_template.rb above limits the template to 255 chars. Change that to ":text" for larger templates.

Actions #14

Updated by John Stone over 13 years ago

This patch appears to break the "Duplicate issue" functionality. I've tweaked it so it works on my 1.1.2.stable copy. I'm a complete newbie at Ruby on Rails; corrections/oversights welcome. ;)

+++ L:/www/redmine/app/views/issues/_form.rhtml    Tue May 17 17:51:00 2011
@@ -15,7 +15,7 @@
 <% end %>

 <p><%= f.text_area :description,
-                   :value => (@issue.new_record? ? @issue.tracker.template : @issue.description),
+                   :value => ((@issue.new_record? && @issue.description.blank?) ? @issue.tracker.template : @issue.description),
                    :cols => 60,
                    :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
                    :accesskey => accesskey(:edit),
Actions #15

Updated by Thomas Elsgaard over 13 years ago

+1

This is truely an great patch, it should really be included!!

Actions #16

Updated by Olivier Chabanel over 13 years ago

Hi,

I'm using Redmine 1.0.1 and I try to use this patch with the command:

root@projet:/opt/bitnami/apps/redmine# patch -p1 < tracker_templates_redmine_0.9.6.diff
patch: **** Only garbage was found in the patch input.

Could someone give me a hint how to apply the patch correctly?

Thanks

Actions #17

Updated by Etienne Massip over 13 years ago

  • Category set to Issues
  • Target version set to Candidate for next major release
Actions #18

Updated by R Chang over 13 years ago

Hi,

I am trying to apply this patch and these are the steps I performed:

% rake 102_add_trackers_template.rb
(in /usr/share/redmine-1.2.0)
% rake db:migrate
(in /usr/share/redmine-1.2.0)
% patch -pl < tracker_templates_redmine_0.9.6.diff 
patch: ** strip count l is not a number

I'm not sure what that error means? Any help is appreciated. Thanks!

Actions #19

Updated by George Palmer over 13 years ago

This only appears to work on the default tracker. When you change the tracker it does not update the description. Any ideas on how to make this work?

Thanks

Actions #20

Updated by Pieter Smith over 13 years ago

We fixed this in our implementation. I have asked the relevant engineer to post a patch for 1.2.1.

Actions #21

Updated by Martin Corino over 13 years ago

The attached patches provide support for the tracker templates and take care of the updating issue when changing trackers, i.e. when changing the Tracker on an issue the Description content of an issue will be updated to the template of the new Tracker as long as the Description content has not been changed.

Actions #22

Updated by Martin Corino over 13 years ago

BTW. I've not included the migration patch to add the template column to the tracker table. Just use the 102_add_trackers_template.rb provided above or create your own (f.i. to make the column 'text' instead of 'string').

Martin Corino wrote:

The attached patches provide support for the tracker templates and take care of the updating issue when changing trackers, i.e. when changing the Tracker on an issue the Description content of an issue will be updated to the template of the new Tracker as long as the Description content has not been changed.

Actions #23

Updated by John Stone about 13 years ago

Thanks Martin for the 1.2 update. Note that the patch does not include the tweak for app/views/trackers/_form.rhtml for showing the template edit box.

Actions #24

Updated by John Stone about 13 years ago

For whomever ports this into the main code, note that there appears to be a minor bug (with an easy workaround) using 1.2.1-stable:

  1. Add templates for trackers "Bug" and "Feature."
  2. Open a new issue of type "Bug."
  3. Select the "Tracker" drop-down list and change it from "Bug" to "Feature." Observe proper switch to the "Feature" template.
  4. Change the tracker type to "Support" or another type that has no template created yet.
  5. Change the tracker type back to "Bug."
  6. ERROR: "Internal error" appears where the template would normally exist.
  7. WORKAROUND: Simply create a template for each tracker or, if you don't want a template for a particular tracker, open the tracker anyway and click "Save" with the template box left empty so it creates a blank template.
Actions #25

Updated by Olivier Chabanel about 13 years ago

Sorry, I'm not used to patch redmine and I have some diffuculties here. Could someone give what are the steps to patch the 1.2 stable version?
Any help would be very appreciated.

I tried these steps with no luck:

cd in root redmine directory

% patch -pl < tracker_templates_redmine_1.2-stable.diff 
% rake 102_add_trackers_template.rb
% rake db:migrate

I have an error when I try to create a new issue. With this message in the log:

NoMethodError (undefined method `template' for #<ActiveRecord::Associations::BelongsToAssociation:0x7fe68d1e3680>):
  app/controllers/issues_controller.rb:316:in `build_new_issue_from_params'
  /opt/passenger-3.0.5/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  /opt/passenger-3.0.5/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
  /opt/passenger-3.0.5/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
  /opt/passenger-3.0.5/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/utils.rb:479:in `safe_fork'
  /opt/passenger-3.0.5/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:180:in `start'
  /opt/passenger-3.0.5/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
  /opt/passenger-3.0.5/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  /opt/passenger-3.0.5/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /opt/passenger-3.0.5/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  /opt/passenger-3.0.5/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  /opt/passenger-3.0.5/helper-scripts/passenger-spawn-server:99

Rendering /var/www/redmine/public/500.html (500 Internal Server Error)

Thanks

Actions #26

Updated by John Stone about 13 years ago

Hmm...Something in the 1.2.1 batch of tweaks for this seems to be preventing the "Duplicate" function from copying over the source bug description. Investigating...

Actions #27

Updated by John Stone about 13 years ago

Duplicate functionality resolved.

*** L:/www/redmine/app/controllers/issues_controller.rb.duplicatebroken    Tue Oct 11 16:31:53 2011
--- L:/www/redmine/app/controllers/issues_controller.rb    Tue Oct 11 16:25:17 2011
***************
*** 317,323 ****
--- 317,325 ----
                (_prev_tracker = @project.trackers.find(params[:prev_tracker_id])) &&                         # previous tracker (+ template)
                (params[:issue][:description].gsub(/\r|\n/, '') != _prev_tracker.template.gsub(/\r|\n/, ''))  # description changed
          params[:issue] ||= {} 
+         unless params[:copy_from]
              params[:issue][:description] = @issue.tracker.template
+         end
        end
      end
      @issue.start_date ||= Date.today
Actions #28

Updated by Hugh Gallagher about 13 years ago

Hmmm.. I have the same issues as Olivier Chabanel on Redmine 1.2.1.stable

% patch -p1 < tracker_templates_redmine_1.2-stable.diff 
% rake 102_add_trackers_template.rb
% rake db:migrate

I've added the patch as above and then manually added the two lines from John Stone's additional fix.

NoMethodError (undefined method `template' for #<ActiveRecord::Associations::BelongsToAssociation:0xb708075c>):
  app/controllers/issues_controller.rb:319:in `build_new_issue_from_params'
  passenger (3.0.9) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.9) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.9) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
  passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
  passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
  passenger (3.0.9) lib/phusion_passenger/utils.rb:479:in `safe_fork'
  passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:180:in `start'
  passenger (3.0.9) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
  passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
  passenger (3.0.9) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
  passenger (3.0.9) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
  passenger (3.0.9) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
  passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
  passenger (3.0.9) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.9) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.9) helper-scripts/passenger-spawn-server:99

Rendering /opt/redmine-1.2.1/public/500.html (500 Internal Server Error)
Actions #29

Updated by Slan Buas almost 13 years ago

Anyone made a patch for 1.3 ? thnx

Actions #31

Updated by Peter Wang over 12 years ago

Can you have a patch for 2.0-stable?

Thanks a lot

Actions #32

Updated by Christopher Proud over 12 years ago

+1

Actions #33

Updated by Rob C over 12 years ago

+1

Actions #34

Updated by Jonas J over 12 years ago

+1 needs to be on trunk

Actions #35

Updated by Terence Mill over 12 years ago

+1

Actions #36

Updated by Jonas J over 12 years ago

Someone of you have tested the plugin: http://www.redmine.org/plugins/issue_templates ?

Actions #37

Updated by Ivan Cenov almost 12 years ago

Jonas J wrote:

Someone of you have tested the plugin: http://www.redmine.org/plugins/issue_templates ?

Nice plugin, but works as project module. It would be better if it was Redmine-wide plugin.

Actions #38

Updated by Mischa The Evil almost 12 years ago

Ivan Cenov wrote:

Jonas J wrote:

Someone of you have tested the plugin: http://www.redmine.org/plugins/issue_templates ?

Nice plugin, but works as project module. It would be better if it was Redmine-wide plugin.

Considering the fact that trackers are bound to projects I think it is the best to implement this plugin as a project module.

Actions #39

Updated by Terence Mill almost 12 years ago

If you can also share templates globallz check out another plugins which can do thats also.

http://www.redmine.org/plugins/gsc_templates

As far as i remember i tested successfully for remine 2.2.3

Actions #40

Updated by Gurvan Le Dromaguet over 11 years ago

Mischa The Evil wrote:

Considering the fact that trackers are bound to projects I think it is the best to implement this plugin as a project module.

I would disagree as trackers are project independents IMO and furthermore if you have a lot of projects, it is a pain to configure ...

Actions #41

Updated by Alex Petty over 9 years ago

For that matter, new issues should be settable to only those tracker-types that are configured for the users given role (or roles).

I envision this workflow as follows:
(1) Administrator creates a role (let's call it role A)
(2) Administrator assigns a user (or group) role A.
(3) Through the implementation of this feature, the administrator will be able to define which tracker-types that role A is capable of creating (so long as role A has been assigned the "add issue" permission)
(4) When the user possessing role A (and also having the "add issue" permission) clicks the "New Issue" tab, the user will see only those trackers which were defined as "can create this tracker" to role A.
(5) If the user has multiple roles with "can create this tracker" defined, each having their own set of permissible trackers, the user will be able to create the super-set of all trackers from all assigned roles.

This feature would greatly enhance Redmine's flexibility in configuration.

Actions #42

Updated by Go MAEDA almost 8 years ago

  • Has duplicate Feature #7055: Default description per tracker. added
Actions #43

Updated by Go MAEDA almost 8 years ago

  • Has duplicate Feature #5341: Default issue description per tracker basis added
Actions

Also available in: Atom PDF