summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/App.php19
-rw-r--r--app/Locale/da_DK/translations.php3
-rw-r--r--app/Locale/de_DE/translations.php3
-rw-r--r--app/Locale/es_ES/translations.php3
-rw-r--r--app/Locale/fi_FI/translations.php3
-rw-r--r--app/Locale/fr_FR/translations.php3
-rw-r--r--app/Locale/it_IT/translations.php3
-rw-r--r--app/Locale/ja_JP/translations.php3
-rw-r--r--app/Locale/pl_PL/translations.php3
-rw-r--r--app/Locale/pt_BR/translations.php3
-rw-r--r--app/Locale/ru_RU/translations.php3
-rw-r--r--app/Locale/sv_SE/translations.php3
-rw-r--r--app/Locale/th_TH/translations.php3
-rw-r--r--app/Locale/zh_CN/translations.php3
-rw-r--r--app/Model/Acl.php2
-rw-r--r--app/Template/comment_create.php19
-rw-r--r--app/Template/comment_edit.php20
-rw-r--r--app/Template/task_edit.php19
-rw-r--r--app/Template/task_edit_description.php20
-rw-r--r--app/Template/task_new.php19
-rw-r--r--app/helpers.php1
21 files changed, 150 insertions, 8 deletions
diff --git a/app/Controller/App.php b/app/Controller/App.php
index 86b06076..56124da2 100644
--- a/app/Controller/App.php
+++ b/app/Controller/App.php
@@ -4,6 +4,7 @@ namespace Controller;
use Model\Project as ProjectModel;
use Model\SubTask;
+use Helper;
/**
* Application controller
@@ -153,4 +154,22 @@ class App extends Base
)
);
}
+
+ /**
+ * Render Markdown Text and reply with the HTML Code
+ *
+ * @access public
+ */
+ public function preview()
+ {
+ $payload = $this->request->getJson();
+
+ if (empty($payload['text'])) {
+ $this->response->html('<p>'.t('Nothing to preview...').'</p>');
+ }
+ else {
+ $this->response->html(Helper\markdown($payload['text']));
+ }
+ }
+
}
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index 5c2002ec..c4fcc1c4 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index b304fc18..7ff2258a 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 5740279c..a2618326 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 9565178f..c0bc4bbe 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index b6735322..4eb0dc72 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -599,4 +599,7 @@ return array(
'Daily project summary export for "%s"' => 'Export du résumé quotidien du projet pour « %s »',
'Exports' => 'Exports',
'This export contains the number of tasks per column grouped per day.' => 'Cet export contient le nombre de tâches par colonne groupé par jour.',
+ 'Nothing to preview...' => 'Rien à prévisualiser...',
+ 'Preview' => 'Prévisualiser',
+ 'Write' => 'Écrire',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 9a0fd02e..b7132bc2 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 1885d779..7a59ec05 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 34ea087f..edc696b8 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 9aa52bc3..f249a5e6 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index b584b759..a1cc7cfe 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index e1997f6c..ece0b2a2 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index a5c7a251..42a1bcb3 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index d176b081..0fc3b2a8 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -599,4 +599,7 @@ return array(
// 'Daily project summary export for "%s"' => '',
// 'Exports' => '',
// 'This export contains the number of tasks per column grouped per day.' => '',
+ // 'Nothing to preview...' => '',
+ // 'Preview' => '',
+ // 'Write' => '',
);
diff --git a/app/Model/Acl.php b/app/Model/Acl.php
index 4a161714..d96d5deb 100644
--- a/app/Model/Acl.php
+++ b/app/Model/Acl.php
@@ -31,7 +31,7 @@ class Acl extends Base
* @var array
*/
private $user_actions = array(
- 'app' => array('index'),
+ 'app' => array('index', 'preview'),
'board' => array('index', 'show', 'save', 'check', 'changeassignee', 'updateassignee', 'changecategory', 'updatecategory', 'movecolumn', 'edit', 'update', 'add', 'confirm', 'remove'),
'project' => array('index', 'show', 'exporttasks', 'exportdaily', 'share', 'edit', 'update', 'users', 'remove', 'duplicate', 'disable', 'enable', 'activity', 'search', 'tasks', 'create', 'save'),
'user' => array('edit', 'forbidden', 'logout', 'show', 'external', 'unlinkgoogle', 'unlinkgithub', 'sessions', 'removesession', 'last', 'notifications', 'password'),
diff --git a/app/Template/comment_create.php b/app/Template/comment_create.php
index 11772f75..5590b77d 100644
--- a/app/Template/comment_create.php
+++ b/app/Template/comment_create.php
@@ -6,7 +6,24 @@
<?= Helper\form_csrf() ?>
<?= Helper\form_hidden('task_id', $values) ?>
<?= Helper\form_hidden('user_id', $values) ?>
- <?= Helper\form_textarea('comment', $values, $errors, array(! isset($skip_cancel) ? 'autofocus' : '', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?><br/>
+
+ <div class="form-tabs">
+ <ul class="form-tabs-nav">
+ <li class="form-tab form-tab-selected">
+ <i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
+ </li>
+ <li class="form-tab">
+ <a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
+ </li>
+ </ul>
+ <div class="write-area">
+ <?= Helper\form_textarea('comment', $values, $errors, array(! isset($skip_cancel) ? 'autofocus' : '', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?>
+ </div>
+ <div class="preview-area">
+ <div class="markdown"></div>
+ </div>
+ </div>
+
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<div class="form-actions">
diff --git a/app/Template/comment_edit.php b/app/Template/comment_edit.php
index 4ce48964..96b7a872 100644
--- a/app/Template/comment_edit.php
+++ b/app/Template/comment_edit.php
@@ -7,7 +7,25 @@
<?= Helper\form_csrf() ?>
<?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_hidden('task_id', $values) ?>
- <?= Helper\form_textarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?><br/>
+
+ <div class="form-tabs">
+ <ul class="form-tabs-nav">
+ <li class="form-tab form-tab-selected">
+ <i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
+ </li>
+ <li class="form-tab">
+ <a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
+ </li>
+ </ul>
+ <div class="write-area">
+ <?= Helper\form_textarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?>
+ </div>
+ <div class="preview-area">
+ <div class="markdown"></div>
+ </div>
+ </div>
+
+ <div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<div class="form-actions">
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>
diff --git a/app/Template/task_edit.php b/app/Template/task_edit.php
index 73e00a31..701bd08e 100644
--- a/app/Template/task_edit.php
+++ b/app/Template/task_edit.php
@@ -12,7 +12,24 @@
<?= Helper\form_text('title', $values, $errors, array('required')) ?><br/>
<?= Helper\form_label(t('Description'), 'description') ?>
- <?= Helper\form_textarea('description', $values, $errors) ?><br/>
+
+ <div class="form-tabs">
+ <ul class="form-tabs-nav">
+ <li class="form-tab form-tab-selected">
+ <i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
+ </li>
+ <li class="form-tab">
+ <a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
+ </li>
+ </ul>
+ <div class="write-area">
+ <?= Helper\form_textarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?>
+ </div>
+ <div class="preview-area">
+ <div class="markdown"></div>
+ </div>
+ </div>
+
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
</div>
diff --git a/app/Template/task_edit_description.php b/app/Template/task_edit_description.php
index 09dca30a..f805c034 100644
--- a/app/Template/task_edit_description.php
+++ b/app/Template/task_edit_description.php
@@ -5,9 +5,25 @@
<form method="post" action="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>&amp;ajax=<?= $ajax ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
-
<?= Helper\form_hidden('id', $values) ?>
- <?= Helper\form_textarea('description', $values, $errors, array('autofocus', 'placeholder="'.t('Leave a description').'"'), 'description-textarea') ?><br/>
+
+ <div class="form-tabs">
+ <ul class="form-tabs-nav">
+ <li class="form-tab form-tab-selected">
+ <i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
+ </li>
+ <li class="form-tab">
+ <a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
+ </li>
+ </ul>
+ <div class="write-area">
+ <?= Helper\form_textarea('description', $values, $errors, array('autofocus', 'placeholder="'.t('Leave a description').'"'), 'description-textarea') ?>
+ </div>
+ <div class="preview-area">
+ <div class="markdown"></div>
+ </div>
+ </div>
+
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<div class="form-actions">
diff --git a/app/Template/task_new.php b/app/Template/task_new.php
index 43916551..ee8aed7c 100644
--- a/app/Template/task_new.php
+++ b/app/Template/task_new.php
@@ -14,7 +14,24 @@
<?= Helper\form_text('title', $values, $errors, array('autofocus', 'required'), 'form-input-large') ?><br/>
<?= Helper\form_label(t('Description'), 'description') ?>
- <?= Helper\form_textarea('description', $values, $errors) ?><br/>
+
+ <div class="form-tabs">
+ <ul class="form-tabs-nav">
+ <li class="form-tab form-tab-selected">
+ <i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
+ </li>
+ <li class="form-tab">
+ <a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
+ </li>
+ </ul>
+ <div class="write-area">
+ <?= Helper\form_textarea('description', $values, $errors, array('placeholder="'.t('Leave a description').'"')) ?>
+ </div>
+ <div class="preview-area">
+ <div class="markdown"></div>
+ </div>
+ </div>
+
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
<?php if (! isset($duplicate)): ?>
diff --git a/app/helpers.php b/app/helpers.php
index ac5b788f..6c8e8955 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -445,7 +445,6 @@ function form_textarea($name, $values = array(), array $errors = array(), array
$html .= implode(' ', $attributes).'>';
$html .= isset($values->$name) ? escape($values->$name) : isset($values[$name]) ? $values[$name] : '';
$html .= '</textarea>';
- if (in_array('required', $attributes)) $html .= '<span class="form-required">*</span>';
$html .= error_list($errors, $name);
return $html;