Introduce a per-project issue template to hint a reporter to provide

certain information in his issue report (closes issue 540).
This commit is contained in:
Thomas Keller 2010-10-09 10:40:30 +00:00
parent d25bc74d71
commit b518385962
5 changed files with 32 additions and 5 deletions

View File

@ -313,6 +313,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
'labels_download_one_max' => IDF_Form_UploadConf::init_one_max, 'labels_download_one_max' => IDF_Form_UploadConf::init_one_max,
'labels_wiki_predefined' => IDF_Form_WikiConf::init_predefined, 'labels_wiki_predefined' => IDF_Form_WikiConf::init_predefined,
'labels_wiki_one_max' => IDF_Form_WikiConf::init_one_max, 'labels_wiki_one_max' => IDF_Form_WikiConf::init_one_max,
'labels_issue_template' => IDF_Form_IssueTrackingConf::init_template,
'labels_issue_open' => IDF_Form_IssueTrackingConf::init_open, 'labels_issue_open' => IDF_Form_IssueTrackingConf::init_open,
'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed, 'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed,
'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined, 'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined,

View File

@ -45,6 +45,9 @@ class IDF_Form_IssueCreate extends Pluf_Form
or $this->user->hasPerm('IDF.project-member', $this->project)) { or $this->user->hasPerm('IDF.project-member', $this->project)) {
$this->show_full = true; $this->show_full = true;
} }
$contentTemplate = $this->project->getConf()->getVal(
'labels_issue_template', IDF_Form_IssueTrackingConf::init_template
);
$this->fields['summary'] = new Pluf_Form_Field_Varchar( $this->fields['summary'] = new Pluf_Form_Field_Varchar(
array('required' => true, array('required' => true,
'label' => __('Summary'), 'label' => __('Summary'),
@ -57,7 +60,7 @@ class IDF_Form_IssueCreate extends Pluf_Form
$this->fields['content'] = new Pluf_Form_Field_Varchar( $this->fields['content'] = new Pluf_Form_Field_Varchar(
array('required' => true, array('required' => true,
'label' => __('Description'), 'label' => __('Description'),
'initial' => '', 'initial' => $contentTemplate,
'widget' => 'Pluf_Form_Widget_TextareaInput', 'widget' => 'Pluf_Form_Widget_TextareaInput',
'widget_attrs' => array( 'widget_attrs' => array(
'cols' => 58, 'cols' => 58,

View File

@ -31,6 +31,15 @@ class IDF_Form_IssueTrackingConf extends Pluf_Form
* Defined as constants to easily access the value in the * Defined as constants to easily access the value in the
* IssueUpdate/Create form in the case nothing is in the db yet. * IssueUpdate/Create form in the case nothing is in the db yet.
*/ */
const init_template = 'Steps to reproduce the problem:
1.
2.
3.
Expected result:
Actual result:
';
const init_open = 'New = Issue has not had initial review yet const init_open = 'New = Issue has not had initial review yet
Accepted = Problem reproduced / Need acknowledged Accepted = Problem reproduced / Need acknowledged
Started = Work on this issue has begun'; Started = Work on this issue has begun';
@ -66,6 +75,15 @@ Maintainability = Hinders future changes';
public function initFields($extra=array()) public function initFields($extra=array())
{ {
$this->fields['labels_issue_template'] = new Pluf_Form_Field_Varchar(
array('required' => false,
'label' => __('Define an issue template to hint the reporter to provide certain information'),
'initial' => self::init_template,
'widget_attrs' => array('rows' => 7,
'cols' => 75),
'widget' => 'Pluf_Form_Widget_TextareaInput',
));
$this->fields['labels_issue_open'] = new Pluf_Form_Field_Varchar( $this->fields['labels_issue_open'] = new Pluf_Form_Field_Varchar(
array('required' => true, array('required' => true,
'label' => __('Open issue status values'), 'label' => __('Open issue status values'),
@ -99,8 +117,6 @@ Maintainability = Hinders future changes';
'widget_attrs' => array('size' => 60), 'widget_attrs' => array('size' => 60),
)); ));
} }
} }

View File

@ -277,7 +277,8 @@ class IDF_Views_Project
} }
} else { } else {
$params = array(); $params = array();
$keys = array('labels_issue_open', 'labels_issue_closed', $keys = array('labels_issue_template',
'labels_issue_open', 'labels_issue_closed',
'labels_issue_predefined', 'labels_issue_one_max'); 'labels_issue_predefined', 'labels_issue_one_max');
foreach ($keys as $key) { foreach ($keys as $key) {
$_val = $conf->getVal($key, false); $_val = $conf->getVal($key, false);

View File

@ -4,6 +4,12 @@
<form method="post" action="."> <form method="post" action=".">
<table class="form" summary=""> <table class="form" summary="">
<tr> <tr>
<td colspan="2"><strong>{$form.f.labels_issue_template.labelTag}:</strong><br />
{if $form.f.labels_issue_template.errors}{$form.f.labels_issue_template.fieldErrors}{/if}
{$form.f.labels_issue_template|unsafe}
</td>
</tr>
<tr>
<td colspan="2"><strong>{$form.f.labels_issue_open.labelTag}:</strong><br /> <td colspan="2"><strong>{$form.f.labels_issue_open.labelTag}:</strong><br />
{if $form.f.labels_issue_open.errors}{$form.f.labels_issue_open.fieldErrors}{/if} {if $form.f.labels_issue_open.errors}{$form.f.labels_issue_open.fieldErrors}{/if}
{$form.f.labels_issue_open|unsafe} {$form.f.labels_issue_open|unsafe}