New Issue: Is it possible to populate the description box with a pre-defined template
Added by Aaron Boxer over 16 years ago
Hello,
I would like all developers on my team to file bug reports with the following info:
1. steps to reproduce
2. expected results
3. actual results
Is it possible to automatically enter the above three lines whenever a developer opens a new issue?
Thanks!!
Replies (1)
RE: New Issue: Is it possible to populate the description box with a pre-defined template
-
Added by Andrew Rudenko over 16 years ago
I have resolved this problem by adding my own code into app/views/issues/_form.rhtml file.
There are three tracker types in our redmine system, these are: Bug, Feature and Support.
I need for Template only for Bug tracker type, so the code is as provided below:
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
<p>
<%# INSERTED CODE %>
<% bug_template = '
*Steps to reproduce*:
#
#
*Actual Results*:
*Expected Results*:
*Note*: ' %>
<%# if issue is a new AND tracker name is 'Bug' %>
<% if @issue.new_record? && (@issue.tracker.name<=>('Bug')).eql?(0) %>
<%# issue description will set to bug_template in case if it is not a blank %>
<% @issue.description = bug_template if @issue.description.blank? %>
<% elsif @issue.new_record? %>
<%# clearing description for all tracker types that are not a Bug, if description is not blank and equals to bug_template %>
<% @issue.description = '' if !@issue.description.blank? && bug_template.include?(@issue.description.gsub(/\r\n/m, "\n")) %>
<% end %>
<%# END OF INSERTED CODE %>
If you want the template to be added for each new issue independently of tracker type, the code will be following:
<% if @issue.new_record? %> <% @issue.description = bug_template if @issue.description.blank? %> <% end %>