summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-08 12:16:05 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-08 12:16:05 -0500
commite377f450ad9a97ae9031d852e9195b9092d3e9db (patch)
tree235f505e6c2136ba713e3bf642ece335fd98254f /app/Template
parentbb222a79cd6a663dcbb78dc34cff2405cb16f3c2 (diff)
Open form to create customer filters in modal box
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/custom_filter/create.php (renamed from app/Template/custom_filter/add.php)7
-rw-r--r--app/Template/custom_filter/index.php90
-rw-r--r--app/Template/project_header/dropdown.php2
3 files changed, 49 insertions, 50 deletions
diff --git a/app/Template/custom_filter/add.php b/app/Template/custom_filter/create.php
index 0b91226a..24e896ee 100644
--- a/app/Template/custom_filter/add.php
+++ b/app/Template/custom_filter/create.php
@@ -2,12 +2,11 @@
<h2><?= t('Add a new filter') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('CustomFilterController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
-
<?= $this->form->csrf() ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Name'), 'name') ?>
- <?= $this->form->text('name', $values, $errors, array('required', 'maxlength="100"')) ?>
+ <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="100"')) ?>
<?= $this->form->label(t('Filter'), 'filter') ?>
<?= $this->form->text('filter', $values, $errors, array('required', 'maxlength="100"')) ?>
@@ -18,7 +17,5 @@
<?= $this->form->checkbox('append', t('Append filter (instead of replacement)'), 1) ?>
- <div class="form-actions">
- <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
- </div>
+ <?= $this->modal->submitButtons() ?>
</form>
diff --git a/app/Template/custom_filter/index.php b/app/Template/custom_filter/index.php
index 95356e64..d8d1c8e0 100644
--- a/app/Template/custom_filter/index.php
+++ b/app/Template/custom_filter/index.php
@@ -1,51 +1,53 @@
<?php if (! empty($custom_filters)): ?>
<div class="page-header">
<h2><?= t('Custom filters') ?></h2>
+ <ul>
+ <li>
+ <?= $this->modal->medium('filter', t('Add custom filters'), 'CustomFilterController', 'create', array('project_id' => $project['id'])) ?>
+ </li>
+ </ul>
</div>
-<div>
- <table class="table-striped table-scrolling">
- <tr>
- <th class="column-15"><?= t('Name') ?></th>
- <th class="column-30"><?= t('Filter') ?></th>
- <th class="column-10"><?= t('Shared') ?></th>
- <th class="column-15"><?= t('Append/Replace') ?></th>
- <th class="column-25"><?= t('Owner') ?></th>
- <th class="column-5"><?= t('Actions') ?></th>
- </tr>
- <?php foreach ($custom_filters as $filter): ?>
- <tr>
- <td><?= $this->text->e($filter['name']) ?></td>
- <td><?= $this->text->e($filter['filter']) ?></td>
- <td>
- <?php if ($filter['is_shared'] == 1): ?>
- <?= t('Yes') ?>
- <?php else: ?>
- <?= t('No') ?>
+<table class="table-striped table-scrolling">
+ <tr>
+ <th class="column-15"><?= t('Name') ?></th>
+ <th class="column-30"><?= t('Filter') ?></th>
+ <th class="column-10"><?= t('Shared') ?></th>
+ <th class="column-15"><?= t('Append/Replace') ?></th>
+ <th class="column-25"><?= t('Owner') ?></th>
+ <th class="column-5"><?= t('Actions') ?></th>
+ </tr>
+<?php foreach ($custom_filters as $filter): ?>
+ <tr>
+ <td><?= $this->text->e($filter['name']) ?></td>
+ <td><?= $this->text->e($filter['filter']) ?></td>
+ <td>
+ <?php if ($filter['is_shared'] == 1): ?>
+ <?= t('Yes') ?>
+ <?php else: ?>
+ <?= t('No') ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <?php if ($filter['append'] == 1): ?>
+ <?= t('Append') ?>
+ <?php else: ?>
+ <?= t('Replace') ?>
+ <?php endif ?>
+ </td>
+ <td><?= $this->text->e($filter['owner_name'] ?: $filter['owner_username']) ?></td>
+ <td>
+ <?php if ($filter['user_id'] == $this->user->getId() || $this->user->hasProjectAccess('CustomFilterController', 'edit', $project['id'])): ?>
+ <div class="dropdown">
+ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
+ <ul>
+ <li><?= $this->modal->medium('edit', t('Edit'), 'CustomFilterController', 'edit', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id'])) ?></li>
+ <li><?= $this->modal->confirm('trash-o', t('Remove'), 'CustomFilterController', 'confirm', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id'])) ?></li>
+ </ul>
+ </div>
<?php endif ?>
- </td>
- <td>
- <?php if ($filter['append'] == 1): ?>
- <?= t('Append') ?>
- <?php else: ?>
- <?= t('Replace') ?>
- <?php endif ?>
- </td>
- <td><?= $this->text->e($filter['owner_name'] ?: $filter['owner_username']) ?></td>
- <td>
- <?php if ($filter['user_id'] == $this->user->getId() || $this->user->hasProjectAccess('CustomFilterController', 'edit', $project['id'])): ?>
- <div class="dropdown">
- <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
- <ul>
- <li><?= $this->modal->medium('edit', t('Edit'), 'CustomFilterController', 'edit', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id'])) ?></li>
- <li><?= $this->modal->confirm('trash-o', t('Remove'), 'CustomFilterController', 'confirm', array('project_id' => $filter['project_id'], 'filter_id' => $filter['id'])) ?></li>
- </ul>
- </div>
- <?php endif ?>
- </td>
- </tr>
- <?php endforeach ?>
- </table>
-</div>
+ </td>
+ </tr>
+<?php endforeach ?>
+</table>
<?php endif ?>
-<?= $this->render('custom_filter/add', array('project' => $project, 'values' => $values, 'errors' => $errors)) ?>
diff --git a/app/Template/project_header/dropdown.php b/app/Template/project_header/dropdown.php
index 7fcdfb55..3f11838d 100644
--- a/app/Template/project_header/dropdown.php
+++ b/app/Template/project_header/dropdown.php
@@ -32,7 +32,7 @@
<?php if ($this->user->hasProjectAccess('CustomFilterController', 'index', $project['id'])): ?>
<li>
- <?= $this->url->icon('filter', t('Custom filters'), 'CustomFilterController', 'index', array('project_id' => $project['id'])) ?>
+ <?= $this->modal->medium('filter', t('Add custom filters'), 'CustomFilterController', 'create', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>