diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/comment_forbidden.php | 9 | ||||
-rw-r--r-- | templates/comment_remove.php | 18 | ||||
-rw-r--r-- | templates/comment_show.php | 36 | ||||
-rw-r--r-- | templates/task_show.php | 21 |
4 files changed, 76 insertions, 8 deletions
diff --git a/templates/comment_forbidden.php b/templates/comment_forbidden.php new file mode 100644 index 00000000..eeea8404 --- /dev/null +++ b/templates/comment_forbidden.php @@ -0,0 +1,9 @@ +<section id="main"> + <div class="page-header"> + <h2><?= t('Forbidden') ?></h2> + </div> + + <p class="alert alert-error"> + <?= t('Only administrators or the creator of the comment can access to this page.') ?> + </p> +</section>
\ No newline at end of file diff --git a/templates/comment_remove.php b/templates/comment_remove.php new file mode 100644 index 00000000..ad1b8e4a --- /dev/null +++ b/templates/comment_remove.php @@ -0,0 +1,18 @@ +<section id="main"> + <div class="page-header"> + <h2><?= t('Remove a comment') ?></h2> + </div> + + <div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to remove this comment?') ?> + </p> + + <?= Helper\template('comment_show', array('comment' => $comment)) ?> + + <div class="form-actions"> + <a href="?controller=comment&action=remove&project_id=<?= $project_id ?>&comment_id=<?= $comment['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=task&action=show&task_id=<?= $comment['task_id'] ?>#comment-<?= $comment['id'] ?>"><?= t('cancel') ?></a> + </div> + </div> +</section>
\ No newline at end of file diff --git a/templates/comment_show.php b/templates/comment_show.php new file mode 100644 index 00000000..24bf9070 --- /dev/null +++ b/templates/comment_show.php @@ -0,0 +1,36 @@ +<div class="<?= isset($display_edit_form) && $display_edit_form === true ? 'comment-edit' : 'comment' ?>" id="comment-<?= $comment['id'] ?>"> + <p class="comment-title"> + <span class="comment-username"><?= Helper\escape($comment['username']) ?></span> @ <span class="comment-date"><?= dt('%B %e, %G at %k:%M %p', $comment['date']) ?></span> + </p> + <?php if (isset($task)): ?> + <ul class="comment-actions"> + <li><a href="#comment-<?= $comment['id'] ?>"><?= t('link') ?></a></li> + <?php if (Helper\is_admin() || Helper\is_current_user($comment['user_id'])): ?> + <li> + <a href="?controller=comment&action=confirm&project_id=<?= $task['project_id'] ?>&comment_id=<?= $comment['id'] ?>"><?= t('remove') ?></a> + </li> + <li> + <a href="?controller=comment&action=edit&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>#comment-<?= $comment['id'] ?>"><?= t('edit') ?></a> + </li> + <?php endif ?> + </ul> + <?php endif ?> + + <?php if (isset($display_edit_form) && $display_edit_form === true): ?> + <form method="post" action="?controller=comment&action=update&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>" autocomplete="off"> + + <?= Helper\form_hidden('id', $values) ?> + <?= Helper\form_textarea('comment', $values, $errors, array('required', 'placeholder="'.t('Leave a comment').'"')) ?><br/> + + <div class="form-actions"> + <input type="submit" value="<?= t('Update this comment') ?>" class="btn btn-blue"/> + <?= t('or') ?> + <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> + </div> + </form> + <?php else: ?> + <div class="markdown"> + <?= Helper\markdown($comment['comment']) ?> + </div> + <?php endif ?> +</div>
\ No newline at end of file diff --git a/templates/task_show.php b/templates/task_show.php index 986b240d..409e5205 100644 --- a/templates/task_show.php +++ b/templates/task_show.php @@ -8,7 +8,7 @@ </ul> </div> <section> - <h3><?= t('Details') ?></h3> + <h2><?= t('Details') ?></h2> <article id="infos" class="task task-<?= $task['color_id'] ?>"> <?php if ($task['score']): ?> <span class="task-score"><?= Helper\escape($task['score']) ?></span> @@ -60,7 +60,7 @@ </ul> </article> - <h3><?= t('Description') ?></h3> + <h2><?= t('Description') ?></h2> <?php if ($task['description']): ?> <article id="description" class="markdown"> <?= Helper\markdown($task['description']) ?: t('There is no description.') ?> @@ -78,19 +78,23 @@ </form> <?php endif ?> - <h3><?= t('Comments') ?></h3> + <h2><?= t('Comments') ?></h2> <?php if ($comments): ?> <ul id="comments"> <?php foreach ($comments as $comment): ?> - <div class="comment markdown" id="comment-<?= $comment['id'] ?>"> - <p><span class="username"><?= Helper\escape($comment['username']) ?></span> @ <a href="#comment-<?= $comment['id'] ?>"><?= dt('%B %e, %G at %k:%M %p', $comment['date']) ?></a></p> - <?= Helper\markdown($comment['comment']) ?> - </div> + <?= Helper\template('comment_show', array( + 'comment' => $comment, + 'task' => $task, + 'display_edit_form' => $comment['id'] == $comment_edit_form['values']['id'], + 'values' => $comment_edit_form['values'] + array('comment' => $comment['comment']), + 'errors' => $comment_edit_form['errors'] + )) ?> <?php endforeach ?> </ul> <?php endif ?> - <form method="post" action="?controller=task&action=comment&task_id=<?= $task['id'] ?>" autocomplete="off"> + <?php if (! isset($hide_comment_form) || $hide_comment_form === false): ?> + <form method="post" action="?controller=comment&action=save&task_id=<?= $task['id'] ?>" autocomplete="off"> <?= Helper\form_hidden('task_id', $comment_form['values']) ?> <?= Helper\form_hidden('user_id', $comment_form['values']) ?> @@ -101,5 +105,6 @@ <input type="submit" value="<?= t('Post comment') ?>" class="btn btn-blue"/> </div> </form> + <?php endif ?> </section> </section> |