Add configurable list of predefined subjects when sending a task by email

This commit is contained in:
Frederic Guillot 2017-06-03 17:31:32 -04:00
parent 9668723af4
commit dd8d7ef49d
35 changed files with 110 additions and 5 deletions

View File

@ -6,6 +6,7 @@ New features:
* Automatic action to assign tasks to its creator
* Add the possibility to create a comment when a task is sent by email
* Add dropdown menu to autocomplete email field from project members
* Add configurable list of predefined subjects when sending a task by email
Version 1.0.44 (May 28, 2017)
-----------------------------

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
'Assign the task to its creator' => 'Assigner une tâche à son créateur',
'This task was sent by email to "%s" with subject "%s".' => 'Cette tâche a été envoyée par courrier électronique à « %s » avec le sujet « %s ».',
'Log this action in a comment' => 'Enregistrez cette action dans un commentaire',
'Predefined Email Subjects' => 'Sujets de courrier électronique prédéfinis',
'Write one subject by line.' => 'Écrivez un sujet par ligne.',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -1337,4 +1337,6 @@ return array(
// 'Assign the task to its creator' => '',
// 'This task was sent by email to "%s" with subject "%s".' => '',
// 'Log this action in a comment' => '',
// 'Predefined Email Subjects' => '',
// 'Write one subject by line.' => '',
);

View File

@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
const VERSION = 123;
const VERSION = 124;
function version_124(PDO $pdo)
{
$pdo->exec('ALTER TABLE projects ADD COLUMN predefined_email_subjects TEXT');
}
function version_123(PDO $pdo)
{

View File

@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
const VERSION = 102;
const VERSION = 103;
function version_103(PDO $pdo)
{
$pdo->exec('ALTER TABLE projects ADD COLUMN predefined_email_subjects TEXT');
}
function version_102(PDO $pdo)
{

View File

@ -8,7 +8,12 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
use PDO;
const VERSION = 114;
const VERSION = 115;
function version_115(PDO $pdo)
{
$pdo->exec('ALTER TABLE projects ADD COLUMN predefined_email_subjects TEXT');
}
function version_114(PDO $pdo)
{

View File

@ -63,5 +63,11 @@
<?= $this->form->number('priority_end', $values, $errors, array('tabindex="10"')) ?>
</fieldset>
<fieldset>
<legend><?= t('Predefined Email Subjects') ?></legend>
<?= $this->form->textarea('predefined_email_subjects', $values, $errors, array('tabindex="11"')) ?>
<p class="form-help"><?= t('Write one subject by line.') ?></p>
</fieldset>
<?= $this->modal->submitButtons(array('tabindex' => 11)) ?>
</form>

View File

@ -22,6 +22,22 @@
<?= $this->form->label(t('Subject'), 'subject') ?>
<?= $this->form->text('subject', $values, $errors, array('required', 'tabindex="2"')) ?>
<?php if (! empty($project['predefined_email_subjects'])): ?>
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-archive"></i><i class="fa fa-caret-down"></i></a>
<ul>
<?php foreach (explode("\r\n", trim($project['predefined_email_subjects'])) as $subject): ?>
<?php $subject = trim($subject); ?>
<?php if (! empty($subject)): ?>
<li data-subject="<?= $this->text->e($subject) ?>" class="js-autocomplete-subject">
<?= $this->text->e($subject) ?>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
</div>
<?php endif ?>
<?= $this->form->checkbox('add_comment', t('Log this action in a comment'), 1) ?>

File diff suppressed because one or more lines are too long

View File

@ -10,3 +10,16 @@ KB.onClick('.js-autocomplete-email', function (e) {
}
}
});
KB.onClick('.js-autocomplete-subject', function (e) {
var subject = KB.dom(e.target).data('subject');
if (subject) {
var subjectField = KB.find('.js-task-mail-form input[name="subject"]');
if (subjectField) {
subjectField.attr('value', subject);
_KB.controllers['Dropdown'].close();
}
}
});