summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/comment_forbidden.php9
-rw-r--r--templates/comment_remove.php18
-rw-r--r--templates/comment_show.php36
-rw-r--r--templates/task_show.php21
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&amp;action=remove&amp;project_id=<?= $project_id ?>&amp;comment_id=<?= $comment['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a>
+ <?= t('or') ?> <a href="?controller=task&amp;action=show&amp;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&amp;action=confirm&amp;project_id=<?= $task['project_id'] ?>&amp;comment_id=<?= $comment['id'] ?>"><?= t('remove') ?></a>
+ </li>
+ <li>
+ <a href="?controller=comment&amp;action=edit&amp;task_id=<?= $task['id'] ?>&amp;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&amp;action=update&amp;task_id=<?= $task['id'] ?>&amp;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&amp;action=show&amp;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&amp;action=comment&amp;task_id=<?= $task['id'] ?>" autocomplete="off">
+ <?php if (! isset($hide_comment_form) || $hide_comment_form === false): ?>
+ <form method="post" action="?controller=comment&amp;action=save&amp;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>