diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-03-05 17:40:49 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-03-05 17:40:49 -0500 |
commit | 22c5e32def94560881ad9ec032158cd570be44f4 (patch) | |
tree | 7cfe346a2b7d384c9cdcd143693bc8189ac18259 /app/Template | |
parent | a19dc88567e6869b9082064e70db380f84032cef (diff) |
Improve automatic action creation
Diffstat (limited to 'app/Template')
-rw-r--r-- | app/Template/action/index.php | 130 | ||||
-rw-r--r-- | app/Template/action_creation/create.php | 16 | ||||
-rw-r--r-- | app/Template/action_creation/event.php (renamed from app/Template/action/event.php) | 10 | ||||
-rw-r--r-- | app/Template/action_creation/params.php (renamed from app/Template/action/params.php) | 15 | ||||
-rw-r--r-- | app/Template/action_project/project.php | 36 |
5 files changed, 108 insertions, 99 deletions
diff --git a/app/Template/action/index.php b/app/Template/action/index.php index 1cc14782..63d63887 100644 --- a/app/Template/action/index.php +++ b/app/Template/action/index.php @@ -3,79 +3,69 @@ <ul> <li> <i class="fa fa-plus fa-fw"></i> + <?= $this->url->link(t('Add a new action'), 'ActionCreation', 'create', array('project_id' => $project['id']), false, 'popover') ?> + </li> + <li> + <i class="fa fa-copy fa-fw"></i> <?= $this->url->link(t('Import from another project'), 'ActionProject', 'project', array('project_id' => $project['id']), false, 'popover') ?> </li> </ul> </div> -<?php if (! empty($actions)): ?> - -<h3><?= t('Defined actions') ?></h3> -<table> - <tr> - <th><?= t('Automatic actions') ?></th> - <th><?= t('Action parameters') ?></th> - <th><?= t('Action') ?></th> - </tr> - - <?php foreach ($actions as $action): ?> - <tr> - <td> - <ul> - <li> - <?= t('Event name') ?> = - <strong><?= $this->text->in($action['event_name'], $available_events) ?></strong> - </li> - <li> - <?= t('Action name') ?> = - <strong><?= $this->text->in($action['action_name'], $available_actions) ?></strong> - </li> - <ul> - </td> - <td> - <ul> - <?php foreach ($action['params'] as $param_name => $param_value): ?> - <li> - <?= $this->text->in($param_name, $available_params[$action['action_name']]) ?> = - <strong> - <?php if ($this->text->contains($param_name, 'column_id')): ?> - <?= $this->text->in($param_value, $columns_list) ?> - <?php elseif ($this->text->contains($param_name, 'user_id')): ?> - <?= $this->text->in($param_value, $users_list) ?> - <?php elseif ($this->text->contains($param_name, 'project_id')): ?> - <?= $this->text->in($param_value, $projects_list) ?> - <?php elseif ($this->text->contains($param_name, 'color_id')): ?> - <?= $this->text->in($param_value, $colors_list) ?> - <?php elseif ($this->text->contains($param_name, 'category_id')): ?> - <?= $this->text->in($param_value, $categories_list) ?> - <?php elseif ($this->text->contains($param_name, 'link_id')): ?> - <?= $this->text->in($param_value, $links_list) ?> - <?php else: ?> - <?= $this->text->e($param_value) ?> - <?php endif ?> - </strong> - </li> - <?php endforeach ?> - </ul> - </td> - <td> - <?= $this->url->link(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id']), false, 'popover') ?> - </td> - </tr> - <?php endforeach ?> -</table> - -<?php endif ?> - -<h3><?= t('Add an action') ?></h3> -<form method="post" action="<?= $this->url->href('action', 'event', array('project_id' => $project['id'])) ?>" class="listing"> - <?= $this->form->csrf() ?> - <?= $this->form->hidden('project_id', $values) ?> - - <?= $this->form->label(t('Action'), 'action_name') ?> - <?= $this->form->select('action_name', $available_actions, $values) ?> +<?php if (empty($actions)): ?> + <p class="alert"><?= t('There is no action at the moment.') ?></p> +<?php else: ?> + <table> + <tr> + <th><?= t('Automatic actions') ?></th> + <th><?= t('Action parameters') ?></th> + <th><?= t('Action') ?></th> + </tr> - <div class="form-actions"> - <button type="submit" class="btn btn-blue"><?= t('Next step') ?></button> - </div> -</form>
\ No newline at end of file + <?php foreach ($actions as $action): ?> + <tr> + <td> + <ul> + <li> + <?= t('Event name') ?> = + <strong><?= $this->text->in($action['event_name'], $available_events) ?></strong> + </li> + <li> + <?= t('Action name') ?> = + <strong><?= $this->text->in($action['action_name'], $available_actions) ?></strong> + </li> + <ul> + </td> + <td> + <ul> + <?php foreach ($action['params'] as $param_name => $param_value): ?> + <li> + <?= $this->text->in($param_name, $available_params[$action['action_name']]) ?> = + <strong> + <?php if ($this->text->contains($param_name, 'column_id')): ?> + <?= $this->text->in($param_value, $columns_list) ?> + <?php elseif ($this->text->contains($param_name, 'user_id')): ?> + <?= $this->text->in($param_value, $users_list) ?> + <?php elseif ($this->text->contains($param_name, 'project_id')): ?> + <?= $this->text->in($param_value, $projects_list) ?> + <?php elseif ($this->text->contains($param_name, 'color_id')): ?> + <?= $this->text->in($param_value, $colors_list) ?> + <?php elseif ($this->text->contains($param_name, 'category_id')): ?> + <?= $this->text->in($param_value, $categories_list) ?> + <?php elseif ($this->text->contains($param_name, 'link_id')): ?> + <?= $this->text->in($param_value, $links_list) ?> + <?php else: ?> + <?= $this->text->e($param_value) ?> + <?php endif ?> + </strong> + </li> + <?php endforeach ?> + </ul> + </td> + <td> + <?= $this->url->link(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id']), false, 'popover') ?> + </td> + </tr> + <?php endforeach ?> + </table> +<?php endif ?>
\ No newline at end of file diff --git a/app/Template/action_creation/create.php b/app/Template/action_creation/create.php new file mode 100644 index 00000000..bccb19b3 --- /dev/null +++ b/app/Template/action_creation/create.php @@ -0,0 +1,16 @@ +<div class="page-header"> + <h2><?= t('Add an action') ?></h2> +</div> +<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreation', 'event', array('project_id' => $project['id'])) ?>"> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('project_id', $values) ?> + + <?= $this->form->label(t('Action'), 'action_name') ?> + <?= $this->form->select('action_name', $available_actions, $values) ?> + + <div class="form-actions"> + <button type="submit" class="btn btn-blue"><?= t('Next step') ?></button> + <?= t('or') ?> + <?= $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?> + </div> +</form>
\ No newline at end of file diff --git a/app/Template/action/event.php b/app/Template/action_creation/event.php index f4f12db3..e7e5aaf9 100644 --- a/app/Template/action/event.php +++ b/app/Template/action_creation/event.php @@ -1,15 +1,17 @@ <div class="page-header"> - <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2> + <h2><?= t('Choose an event') ?></h2> </div> -<h3><?= t('Choose an event') ?></h3> -<form method="post" action="<?= $this->url->href('action', 'params', array('project_id' => $project['id'])) ?>"> +<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreation', 'params', array('project_id' => $project['id'])) ?>"> <?= $this->form->csrf() ?> <?= $this->form->hidden('project_id', $values) ?> <?= $this->form->hidden('action_name', $values) ?> + <?= $this->form->label(t('Action'), 'action_name') ?> + <?= $this->form->select('action_name', $available_actions, $values, array(), array('disabled')) ?> + <?= $this->form->label(t('Event'), 'event_name') ?> <?= $this->form->select('event_name', $events, $values) ?> @@ -20,6 +22,6 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Next step') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/action/params.php b/app/Template/action_creation/params.php index 99e9206f..59ff6ce9 100644 --- a/app/Template/action/params.php +++ b/app/Template/action_creation/params.php @@ -1,9 +1,8 @@ <div class="page-header"> - <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2> + <h2><?= t('Define action parameters') ?></h2> </div> -<h3><?= t('Define action parameters') ?></h3> -<form method="post" action="<?= $this->url->href('action', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<form class="popover-form" method="post" action="<?= $this->url->href('ActionCreation', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> @@ -11,8 +10,13 @@ <?= $this->form->hidden('event_name', $values) ?> <?= $this->form->hidden('action_name', $values) ?> - <?php foreach ($action_params as $param_name => $param_desc): ?> + <?= $this->form->label(t('Action'), 'action_name') ?> + <?= $this->form->select('action_name', $available_actions, $values, array(), array('disabled')) ?> + + <?= $this->form->label(t('Event'), 'event_name') ?> + <?= $this->form->select('event_name', $events, $values, array(), array('disabled')) ?> + <?php foreach ($action_params as $param_name => $param_desc): ?> <?php if ($this->text->contains($param_name, 'column_id')): ?> <?= $this->form->label($param_desc, $param_name) ?> <?= $this->form->select('params['.$param_name.']', $columns_list, $values) ?> @@ -38,12 +42,11 @@ <?= $this->form->label($param_desc, $param_name) ?> <?= $this->form->text('params['.$param_name.']', $values) ?> <?php endif ?> - <?php endforeach ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id'])) ?> + <?= $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> </form>
\ No newline at end of file diff --git a/app/Template/action_project/project.php b/app/Template/action_project/project.php index d056239b..226f3b19 100644 --- a/app/Template/action_project/project.php +++ b/app/Template/action_project/project.php @@ -1,22 +1,20 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Import actions from another project') ?></h2> - </div> - <?php if (empty($projects_list)): ?> - <p class="alert"><?= t('There is no available project.') ?></p> - <?php else: ?> - <form class="popover-form" method="post" action="<?= $this->url->href('ActionProject', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> +<div class="page-header"> + <h2><?= t('Import actions from another project') ?></h2> +</div> +<?php if (empty($projects_list)): ?> + <p class="alert"><?= t('There is no available project.') ?></p> +<?php else: ?> + <form class="popover-form" method="post" action="<?= $this->url->href('ActionProject', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off"> - <?= $this->form->csrf() ?> + <?= $this->form->csrf() ?> - <?= $this->form->label(t('Create from another project'), 'src_project_id') ?> - <?= $this->form->select('src_project_id', $projects_list) ?> + <?= $this->form->label(t('Create from another project'), 'src_project_id') ?> + <?= $this->form->select('src_project_id', $projects_list) ?> - <div class="form-actions"> - <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> - <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?> - </div> - </form> - <?php endif ?> -</section>
\ No newline at end of file + <div class="form-actions"> + <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> + <?= t('or') ?> + <?= $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?> + </div> + </form> +<?php endif ?>
\ No newline at end of file |