summaryrefslogtreecommitdiff
path: root/app/Template/action
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-09 20:04:27 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-09 20:04:27 -0500
commit7eadf7cfd80176ab9b74c9c6a55c28db0f43fa88 (patch)
treeb55b32bf9200f4ed045adfabaadb00d0ce20fc65 /app/Template/action
parente89ba5e9e692f33427fedb05a095255f27480a6b (diff)
Start templates cleanup and reorganisation
Diffstat (limited to 'app/Template/action')
-rw-r--r--app/Template/action/event.php25
-rw-r--r--app/Template/action/index.php64
-rw-r--r--app/Template/action/params.php43
-rw-r--r--app/Template/action/remove.php15
4 files changed, 147 insertions, 0 deletions
diff --git a/app/Template/action/event.php b/app/Template/action/event.php
new file mode 100644
index 00000000..565e900c
--- /dev/null
+++ b/app/Template/action/event.php
@@ -0,0 +1,25 @@
+<div class="page-header">
+ <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2>
+</div>
+
+<h3><?= t('Choose an event') ?></h3>
+<form method="post" action="<?= Helper\u('action', 'params', array('project_id' => $project['id'])) ?>">
+
+ <?= Helper\form_csrf() ?>
+
+ <?= Helper\form_hidden('project_id', $values) ?>
+ <?= Helper\form_hidden('action_name', $values) ?>
+
+ <?= Helper\form_label(t('Event'), 'event_name') ?>
+ <?= Helper\form_select('event_name', $events, $values) ?><br/>
+
+ <div class="form-help">
+ <?= t('When the selected event occurs execute the corresponding action.') ?>
+ </div>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Next step') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/action/index.php b/app/Template/action/index.php
new file mode 100644
index 00000000..85839098
--- /dev/null
+++ b/app/Template/action/index.php
@@ -0,0 +1,64 @@
+<div class="page-header">
+ <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2>
+</div>
+
+<?php if (! empty($actions)): ?>
+
+<h3><?= t('Defined actions') ?></h3>
+<table>
+ <tr>
+ <th><?= t('Event name') ?></th>
+ <th><?= t('Action name') ?></th>
+ <th><?= t('Action parameters') ?></th>
+ <th><?= t('Action') ?></th>
+ </tr>
+
+ <?php foreach ($actions as $action): ?>
+ <tr>
+ <td><?= Helper\in_list($action['event_name'], $available_events) ?></td>
+ <td><?= Helper\in_list($action['action_name'], $available_actions) ?></td>
+ <td>
+ <ul>
+ <?php foreach ($action['params'] as $param): ?>
+ <li>
+ <?= Helper\in_list($param['name'], $available_params) ?> =
+ <strong>
+ <?php if (Helper\contains($param['name'], 'column_id')): ?>
+ <?= Helper\in_list($param['value'], $columns_list) ?>
+ <?php elseif (Helper\contains($param['name'], 'user_id')): ?>
+ <?= Helper\in_list($param['value'], $users_list) ?>
+ <?php elseif (Helper\contains($param['name'], 'project_id')): ?>
+ <?= Helper\in_list($param['value'], $projects_list) ?>
+ <?php elseif (Helper\contains($param['name'], 'color_id')): ?>
+ <?= Helper\in_list($param['value'], $colors_list) ?>
+ <?php elseif (Helper\contains($param['name'], 'category_id')): ?>
+ <?= Helper\in_list($param['value'], $categories_list) ?>
+ <?php elseif (Helper\contains($param['name'], 'label')): ?>
+ <?= Helper\escape($param['value']) ?>
+ <?php endif ?>
+ </strong>
+ </li>
+ <?php endforeach ?>
+ </ul>
+ </td>
+ <td>
+ <?= Helper\a(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id'])) ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+</table>
+
+<?php endif ?>
+
+<h3><?= t('Add an action') ?></h3>
+<form method="post" action="<?= Helper\u('action', 'event', array('project_id' => $project['id'])) ?>">
+ <?= Helper\form_csrf() ?>
+ <?= Helper\form_hidden('project_id', $values) ?>
+
+ <?= Helper\form_label(t('Action'), 'action_name') ?>
+ <?= Helper\form_select('action_name', $available_actions, $values) ?><br/>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Next step') ?>" class="btn btn-blue"/>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/action/params.php b/app/Template/action/params.php
new file mode 100644
index 00000000..f221d92e
--- /dev/null
+++ b/app/Template/action/params.php
@@ -0,0 +1,43 @@
+<div class="page-header">
+ <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2>
+</div>
+
+<h3><?= t('Define action parameters') ?></h3>
+<form method="post" action="<?= Helper\u('action', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off">
+
+ <?= Helper\form_csrf() ?>
+
+ <?= Helper\form_hidden('project_id', $values) ?>
+ <?= Helper\form_hidden('event_name', $values) ?>
+ <?= Helper\form_hidden('action_name', $values) ?>
+
+ <?php foreach ($action_params as $param_name => $param_desc): ?>
+
+ <?php if (Helper\contains($param_name, 'column_id')): ?>
+ <?= Helper\form_label($param_desc, $param_name) ?>
+ <?= Helper\form_select('params['.$param_name.']', $columns_list, $values) ?><br/>
+ <?php elseif (Helper\contains($param_name, 'user_id')): ?>
+ <?= Helper\form_label($param_desc, $param_name) ?>
+ <?= Helper\form_select('params['.$param_name.']', $users_list, $values) ?><br/>
+ <?php elseif (Helper\contains($param_name, 'project_id')): ?>
+ <?= Helper\form_label($param_desc, $param_name) ?>
+ <?= Helper\form_select('params['.$param_name.']', $projects_list, $values) ?><br/>
+ <?php elseif (Helper\contains($param_name, 'color_id')): ?>
+ <?= Helper\form_label($param_desc, $param_name) ?>
+ <?= Helper\form_select('params['.$param_name.']', $colors_list, $values) ?><br/>
+ <?php elseif (Helper\contains($param_name, 'category_id')): ?>
+ <?= Helper\form_label($param_desc, $param_name) ?>
+ <?= Helper\form_select('params['.$param_name.']', $categories_list, $values) ?><br/>
+ <?php elseif (Helper\contains($param_name, 'label')): ?>
+ <?= Helper\form_label($param_desc, $param_name) ?>
+ <?= Helper\form_text('params['.$param_name.']', $values) ?>
+ <?php endif ?>
+
+ <?php endforeach ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save this action') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/action/remove.php b/app/Template/action/remove.php
new file mode 100644
index 00000000..131c2b54
--- /dev/null
+++ b/app/Template/action/remove.php
@@ -0,0 +1,15 @@
+<div class="page-header">
+ <h2><?= t('Remove an automatic action') ?></h2>
+</div>
+
+<div class="confirm">
+ <p class="alert alert-info">
+ <?= t('Do you really want to remove this action: "%s"?', Helper\in_list($action['event_name'], $available_events).'/'.Helper\in_list($action['action_name'], $available_actions)) ?>
+ </p>
+
+ <div class="form-actions">
+ <?= Helper\a(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?>
+ </div>
+</div> \ No newline at end of file