Open comments in board view with a modal dialog instead of tooltip

This commit is contained in:
Frederic Guillot
2017-02-11 17:22:10 -05:00
parent 28052edb22
commit 8bf054a480
26 changed files with 195 additions and 95 deletions

View File

@@ -95,8 +95,15 @@
<span title="<?= t('Attachments') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-paperclip"></i>&nbsp;<?= $task['nb_files'] ?></span>
<?php endif ?>
<?php if (! empty($task['nb_comments'])): ?>
<span title="<?= $task['nb_comments'] == 1 ? t('%d comment', $task['nb_comments']) : t('%d comments', $task['nb_comments']) ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltipController', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-comment-o"></i>&nbsp;<?= $task['nb_comments'] ?></span>
<?php if ($task['nb_comments'] > 0): ?>
<?= $this->modal->medium(
'comments-o',
$task['nb_comments'],
'CommentListController',
'show',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
$task['nb_comments'] == 1 ? t('%d comment', $task['nb_comments']) : t('%d comments', $task['nb_comments'])
) ?>
<?php endif ?>
<?php if (! empty($task['description'])): ?>

View File

@@ -28,7 +28,7 @@
<?= $this->text->e($this->user->getInitials($task['assignee_name'] ?: $task['assignee_username'])) ?>
</span> -
<?php endif ?>
<?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title tooltip', $this->text->e($task['title'])) ?>
<?= $this->text->e($task['title']) ?>
</div>
<?php else: ?>
<div class="task-board-expanded">
@@ -50,7 +50,7 @@
<?= $this->hook->render('template:board:private:task:before-title', array('task' => $task)) ?>
<div class="task-board-title">
<?= $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
<?= $this->text->e($task['title']) ?>
</div>
<?= $this->hook->render('template:board:private:task:after-title', array('task' => $task)) ?>

View File

@@ -1,9 +0,0 @@
<div class="tooltip-large">
<?php foreach ($comments as $comment): ?>
<?= $this->render('comment/show', array(
'comment' => $comment,
'task' => $task,
'hide_actions' => true,
)) ?>
<?php endforeach ?>
</div>

View File

@@ -9,13 +9,6 @@
<small class="comment-date"><?= t('Created at:') ?> <?= $this->dt->datetime($comment['date_creation']) ?></small>
<small class="comment-date"><?= t('Updated at:')?> <?= $this->dt->datetime($comment['date_modification']) ?></small>
</div>
<div class="comment-content">
<div class="markdown">
<?= $this->text->markdown($comment['comment'], isset($is_public) && $is_public) ?>
</div>
</div>
<?php if (! isset($hide_actions)): ?>
@@ -36,4 +29,10 @@
</ul>
</div>
<?php endif ?>
<div class="comment-content">
<div class="markdown">
<?= $this->text->markdown($comment['comment'], isset($is_public) && $is_public) ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,8 @@
<div class="page-header">
<h2><?= t('Add a comment') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('CommentListController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->textEditor('comment', array(), array(), array('required' => true)) ?>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -0,0 +1,27 @@
<div class="page-header">
<h2><?= $this->text->e($task['title']) ?> &gt; <?= t('Comments') ?></h2>
<?php if (!isset($is_public) || !$is_public): ?>
<div class="comment-sorting">
<small>
<?= $this->url->icon('sort', t('change sorting'), 'CommentListController', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'js-modal-replace') ?>
</small>
</div>
<?php endif ?>
</div>
<div class="comments">
<?php foreach ($comments as $comment): ?>
<?= $this->render('comment/show', array(
'comment' => $comment,
'task' => $task,
'project' => $project,
'editable' => $editable,
'is_public' => isset($is_public) && $is_public,
)) ?>
<?php endforeach ?>
<?php if ($editable): ?>
<?= $this->render('comment_list/create', array(
'task' => $task,
)) ?>
<?php endif ?>
</div>

View File

@@ -26,7 +26,7 @@
'is_public' => true,
)) ?>
<?= $this->render('comments/show', array(
<?= $this->render('task_comments/show', array(
'task' => $task,
'comments' => $comments,
'project' => $project,

View File

@@ -54,7 +54,7 @@
<?php if (!empty($comments)): ?>
<?= $this->hook->render('template:task:show:before-comments', array('task' => $task, 'project' => $project)) ?>
<?= $this->render('comments/show', array(
<?= $this->render('task_comments/show', array(
'task' => $task,
'comments' => $comments,
'project' => $project,

View File

@@ -4,8 +4,5 @@
<?= $this->form->hidden('user_id', $values) ?>
<?= $this->form->textEditor('comment', $values, $errors, array('required' => true)) ?>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
</div>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -2,7 +2,7 @@
<div class="accordion-title">
<h3><a href="#" class="fa accordion-toggle"></a> <?= t('Comments') ?></h3>
</div>
<div class="accordion-content" id="comments">
<div class="accordion-content comments" id="comments">
<?php if (!isset($is_public) || !$is_public): ?>
<div class="comment-sorting">
<small>
@@ -21,12 +21,8 @@
<?php endforeach ?>
<?php if ($editable): ?>
<?= $this->render('comments/create', array(
'values' => array(
'user_id' => $this->user->getId(),
'task_id' => $task['id'],
'project_id' => $task['project_id'],
),
<?= $this->render('task_comments/create', array(
'values' => array(),
'errors' => array(),
'task' => $task,
)) ?>