Pick initial issue type and priority from the particular first item of the predefined issue labels list (thanks Jakub Vitak, closes issue 556)
This commit is contained in:
parent
e776fc0713
commit
8993d2988b
@ -108,14 +108,39 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
'size' => 15,
|
'size' => 15,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get predefined tags for issues from current project
|
||||||
|
*
|
||||||
|
* first Type:<...> and Priority:<...> will be used
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$predefined = preg_split("/[\r\n]+/", $extra['project']->getConf()->getVal(
|
||||||
|
'labels_issue_predefined'
|
||||||
|
));
|
||||||
|
$predefined_type = 'Type:Defect';
|
||||||
|
foreach ($predefined as $tag) {
|
||||||
|
if (strpos($tag, 'Type:') === 0) {
|
||||||
|
$predefined_type = $tag;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$predefined_priority = 'Priority:Medium';
|
||||||
|
foreach ($predefined as $tag) {
|
||||||
|
if (strpos($tag, 'Priority:') === 0) {
|
||||||
|
$predefined_priority = $tag;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ($i=1;$i<7;$i++) {
|
for ($i=1;$i<7;$i++) {
|
||||||
$initial = '';
|
$initial = '';
|
||||||
switch ($i) {
|
switch ($i) {
|
||||||
case 1:
|
case 1:
|
||||||
$initial = 'Type:Defect';
|
$initial = $predefined_type;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$initial = 'Priority:Medium';
|
$initial = $predefined_priority;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->fields['label'.$i] = new Pluf_Form_Field_Varchar(
|
$this->fields['label'.$i] = new Pluf_Form_Field_Varchar(
|
||||||
|
@ -105,6 +105,7 @@ Maintainability = Hinders future changes';
|
|||||||
array('required' => true,
|
array('required' => true,
|
||||||
'label' => __('Predefined issue labels'),
|
'label' => __('Predefined issue labels'),
|
||||||
'initial' => self::init_predefined,
|
'initial' => self::init_predefined,
|
||||||
|
'help_text' => __('The first "Type:" and "Priority:" entries found in this list are automatically chosen as defaults for new issues.'),
|
||||||
'widget_attrs' => array('rows' => 7,
|
'widget_attrs' => array('rows' => 7,
|
||||||
'cols' => 75),
|
'cols' => 75),
|
||||||
'widget' => 'Pluf_Form_Widget_TextareaInput',
|
'widget' => 'Pluf_Form_Widget_TextareaInput',
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><strong>{$form.f.labels_issue_predefined.labelTag}:</strong><br />
|
<td colspan="2"><strong>{$form.f.labels_issue_predefined.labelTag}:</strong><br />
|
||||||
{if $form.f.labels_issue_predefined.errors}{$form.f.labels_issue_predefined.fieldErrors}{/if}
|
{if $form.f.labels_issue_predefined.errors}{$form.f.labels_issue_predefined.fieldErrors}{/if}
|
||||||
{$form.f.labels_issue_predefined|unsafe}
|
{$form.f.labels_issue_predefined|unsafe}<br />
|
||||||
|
<span class="helptext">{$form.f.labels_issue_predefined.help_text}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user