Add a "Me" button to assignee form element

This commit is contained in:
Frederic Guillot 2016-01-31 11:05:47 -05:00
parent 3279768c1c
commit 9570793f68
34 changed files with 83 additions and 9 deletions

View File

@ -10,6 +10,7 @@ Breaking changes:
New features:
* Add a "Me" button to assignee form element
* Add external links for tasks with plugin api
* Add project owner (Directly Responsible Individual)
* Add configurable task priority

View File

@ -45,6 +45,17 @@ class Task extends Base
return $this->taskPermission->canRemoveTask($task);
}
public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array())
{
$attributes = array_merge(array('tabindex="3"'), $attributes);
$html = $this->helper->form->label(t('Assignee'), 'owner_id');
$html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes);
$html .= '<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'">'.t('Me').'</a>';
return $html;
}
public function selectPriority(array $project, array $values)
{
$html = '';

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1126,4 +1126,6 @@ return array(
'There is no external link for the moment.' => 'Il n\'y a pas de lien externe pour le moment.',
'Internal links' => 'Liens internes',
'There is no internal link for the moment.' => 'Il n\'y a pas de lien interne pour le moment.',
'Assign to me' => 'Assigner à moi',
'Me' => 'Moi',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -1123,4 +1123,6 @@ return array(
// 'There is no external link for the moment.' => '',
// 'Internal links' => '',
// 'There is no internal link for the moment.' => '',
// 'Assign to me' => '',
// 'Me' => '',
);

View File

@ -9,8 +9,7 @@
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Assignee'), 'owner_id') ?>
<?= $this->form->select('owner_id', $users_list, $values, array(), array('autofocus')) ?><br/>
<?= $this->task->selectAssignee($users_list, $values, array(), array('autofocus')) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>

View File

@ -48,8 +48,7 @@
<div class="form-column">
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Assignee'), 'owner_id') ?>
<?= $this->form->select('owner_id', $users_list, $values, $errors, array('tabindex="3"')) ?>
<?= $this->task->selectAssignee($users_list, $values, $errors) ?>
<?= $this->form->label(t('Category'), 'category_id') ?>
<?= $this->form->select('category_id', $categories_list, $values, $errors, array('tabindex="4"')) ?>

View File

@ -44,8 +44,7 @@
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Assignee'), 'owner_id') ?>
<?= $this->form->select('owner_id', $users_list, $values, $errors, array('tabindex="3"')) ?>
<?= $this->task->selectAssignee($users_list, $values, $errors) ?>
<?= $this->form->label(t('Category'), 'category_id') ?>
<?= $this->form->select('category_id', $categories_list, $values, $errors, array('tabindex="4"')) ?>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -329,3 +329,9 @@ div.color-square-selected {
height: 28px;
box-shadow: 3px 2px 10px 0 rgba(180,180,180,0.9);
}
/* Assign to me */
.assign-me {
font-size: 0.8em;
vertical-align: bottom;
}

File diff suppressed because one or more lines are too long

View File

@ -7,4 +7,15 @@ Task.prototype.listen = function() {
$(this).addClass("color-square-selected");
$("#form-color_id").val($(this).data("color-id"));
});
$(document).on("click", ".assign-me", function(e) {
e.preventDefault();
var currentId = $(this).data("current-id");
var dropdownId = "#" + $(this).data("target-id");
if ($(dropdownId + ' option[value=' + currentId + ']').length) {
$(dropdownId).val(currentId);
}
});
};