Improve link labels pages navigation
This commit is contained in:
@@ -15,6 +15,7 @@ Improvements:
|
|||||||
* Display project exports in modal box
|
* Display project exports in modal box
|
||||||
* Improve accordion component
|
* Improve accordion component
|
||||||
* Improve currencies pages navigation
|
* Improve currencies pages navigation
|
||||||
|
* Improve link labels pages navigation
|
||||||
* Offer the possibility to define version compatibility from plugins
|
* Offer the possibility to define version compatibility from plugins
|
||||||
|
|
||||||
Version 1.0.36 (Dec 30, 2016)
|
Version 1.0.36 (Dec 30, 2016)
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ class CurrencyController extends BaseController
|
|||||||
{
|
{
|
||||||
$this->response->html($this->helper->layout->config('currency/show', array(
|
$this->response->html($this->helper->layout->config('currency/show', array(
|
||||||
'application_currency' => $this->configModel->get('application_currency'),
|
'application_currency' => $this->configModel->get('application_currency'),
|
||||||
'rates' => $this->currencyModel->getAll(),
|
'rates' => $this->currencyModel->getAll(),
|
||||||
'currencies' => $this->currencyModel->getCurrencies(),
|
'currencies' => $this->currencyModel->getCurrencies(),
|
||||||
'title' => t('Settings').' > '.t('Currency rates'),
|
'title' => t('Settings') . ' > ' . t('Currency rates'),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,9 +34,9 @@ class CurrencyController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function create(array $values = array(), array $errors = array())
|
public function create(array $values = array(), array $errors = array())
|
||||||
{
|
{
|
||||||
$this->response->html($this->helper->layout->config('currency/create', array(
|
$this->response->html($this->template->render('currency/create', array(
|
||||||
'values' => $values,
|
'values' => $values,
|
||||||
'errors' => $errors,
|
'errors' => $errors,
|
||||||
'currencies' => $this->currencyModel->getCurrencies(),
|
'currencies' => $this->currencyModel->getCurrencies(),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
@@ -77,9 +77,9 @@ class CurrencyController extends BaseController
|
|||||||
$values['application_currency'] = $this->configModel->get('application_currency');
|
$values['application_currency'] = $this->configModel->get('application_currency');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->html($this->helper->layout->config('currency/change', array(
|
$this->response->html($this->template->render('currency/change', array(
|
||||||
'values' => $values,
|
'values' => $values,
|
||||||
'errors' => $errors,
|
'errors' => $errors,
|
||||||
'currencies' => $this->currencyModel->getCurrencies(),
|
'currencies' => $this->currencyModel->getCurrencies(),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ class LinkController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* Get the current link
|
* Get the current link
|
||||||
*
|
*
|
||||||
* @access private
|
* @access protected
|
||||||
* @return array
|
* @return array
|
||||||
* @throws PageNotFoundException
|
* @throws PageNotFoundException
|
||||||
*/
|
*/
|
||||||
private function getLink()
|
protected function getLink()
|
||||||
{
|
{
|
||||||
$link = $this->linkModel->getById($this->request->getIntegerParam('link_id'));
|
$link = $this->linkModel->getById($this->request->getIntegerParam('link_id'));
|
||||||
|
|
||||||
@@ -32,19 +32,31 @@ class LinkController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of links
|
* List of labels
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
$this->response->html($this->helper->layout->config('link/show', array(
|
||||||
|
'links' => $this->linkModel->getMergedList(),
|
||||||
|
'title' => t('Settings').' > '.t('Link labels'),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new link label
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $values
|
* @param array $values
|
||||||
* @param array $errors
|
* @param array $errors
|
||||||
*/
|
*/
|
||||||
public function index(array $values = array(), array $errors = array())
|
public function create(array $values = array(), array $errors = array())
|
||||||
{
|
{
|
||||||
$this->response->html($this->helper->layout->config('link/index', array(
|
$this->response->html($this->template->render('link/create', array(
|
||||||
'links' => $this->linkModel->getMergedList(),
|
'links' => $this->linkModel->getMergedList(),
|
||||||
'values' => $values,
|
'values' => $values,
|
||||||
'errors' => $errors,
|
'errors' => $errors,
|
||||||
'title' => t('Settings').' > '.t('Task\'s links'),
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,21 +73,22 @@ class LinkController extends BaseController
|
|||||||
if ($valid) {
|
if ($valid) {
|
||||||
if ($this->linkModel->create($values['label'], $values['opposite_label']) !== false) {
|
if ($this->linkModel->create($values['label'], $values['opposite_label']) !== false) {
|
||||||
$this->flash->success(t('Link added successfully.'));
|
$this->flash->success(t('Link added successfully.'));
|
||||||
return $this->response->redirect($this->helper->url->to('LinkController', 'index'));
|
$this->response->redirect($this->helper->url->to('LinkController', 'show'), true);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
$this->flash->failure(t('Unable to create your link.'));
|
$this->flash->failure(t('Unable to create your link.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->index($values, $errors);
|
$this->create($values, $errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit form
|
* Edit form
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $values
|
* @param array $values
|
||||||
* @param array $errors
|
* @param array $errors
|
||||||
* @throws PageNotFoundException
|
* @throws PageNotFoundException
|
||||||
*/
|
*/
|
||||||
public function edit(array $values = array(), array $errors = array())
|
public function edit(array $values = array(), array $errors = array())
|
||||||
@@ -83,12 +96,11 @@ class LinkController extends BaseController
|
|||||||
$link = $this->getLink();
|
$link = $this->getLink();
|
||||||
$link['label'] = t($link['label']);
|
$link['label'] = t($link['label']);
|
||||||
|
|
||||||
$this->response->html($this->helper->layout->config('link/edit', array(
|
$this->response->html($this->template->render('link/edit', array(
|
||||||
'values' => $values ?: $link,
|
'values' => $values ?: $link,
|
||||||
'errors' => $errors,
|
'errors' => $errors,
|
||||||
'labels' => $this->linkModel->getList($link['id']),
|
'labels' => $this->linkModel->getList($link['id']),
|
||||||
'link' => $link,
|
'link' => $link,
|
||||||
'title' => t('Link modification')
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,13 +117,14 @@ class LinkController extends BaseController
|
|||||||
if ($valid) {
|
if ($valid) {
|
||||||
if ($this->linkModel->update($values)) {
|
if ($this->linkModel->update($values)) {
|
||||||
$this->flash->success(t('Link updated successfully.'));
|
$this->flash->success(t('Link updated successfully.'));
|
||||||
return $this->response->redirect($this->helper->url->to('LinkController', 'index'));
|
$this->response->redirect($this->helper->url->to('LinkController', 'show'), true);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
$this->flash->failure(t('Unable to update your link.'));
|
$this->flash->failure(t('Unable to update your link.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->edit($values, $errors);
|
$this->edit($values, $errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,9 +136,8 @@ class LinkController extends BaseController
|
|||||||
{
|
{
|
||||||
$link = $this->getLink();
|
$link = $this->getLink();
|
||||||
|
|
||||||
$this->response->html($this->helper->layout->config('link/remove', array(
|
$this->response->html($this->template->render('link/remove', array(
|
||||||
'link' => $link,
|
'link' => $link,
|
||||||
'title' => t('Remove a link')
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +157,6 @@ class LinkController extends BaseController
|
|||||||
$this->flash->failure(t('Unable to remove this link.'));
|
$this->flash->failure(t('Unable to remove this link.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect($this->helper->url->to('LinkController', 'index'));
|
$this->response->redirect($this->helper->url->to('LinkController', 'show'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
<?= $this->url->link(t('Tags management'), 'TagController', 'index') ?>
|
<?= $this->url->link(t('Tags management'), 'TagController', 'index') ?>
|
||||||
</li>
|
</li>
|
||||||
<li <?= $this->app->checkMenuSelection('LinkController') ?>>
|
<li <?= $this->app->checkMenuSelection('LinkController') ?>>
|
||||||
<?= $this->url->link(t('Link settings'), 'LinkController', 'index') ?>
|
<?= $this->url->link(t('Link labels'), 'LinkController', 'show') ?>
|
||||||
</li>
|
</li>
|
||||||
<li <?= $this->app->checkMenuSelection('CurrencyController', 'show') ?>>
|
<li <?= $this->app->checkMenuSelection('CurrencyController') ?>>
|
||||||
<?= $this->url->link(t('Currency rates'), 'CurrencyController', 'show') ?>
|
<?= $this->url->link(t('Currency rates'), 'CurrencyController', 'show') ?>
|
||||||
</li>
|
</li>
|
||||||
<li <?= $this->app->checkMenuSelection('ConfigController', 'integrations') ?>>
|
<li <?= $this->app->checkMenuSelection('ConfigController', 'integrations') ?>>
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2><?= t('Add a new link') ?></h2>
|
<h2><?= t('Add link label') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="<?= $this->url->href('LinkController', 'save') ?>" method="post" autocomplete="off">
|
<form action="<?= $this->url->href('LinkController', 'save') ?>" method="post" autocomplete="off">
|
||||||
|
|
||||||
<?= $this->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
|
|
||||||
<?= $this->form->label(t('Label'), 'label') ?>
|
<?= $this->form->label(t('Label'), 'label') ?>
|
||||||
<?= $this->form->text('label', $values, $errors, array('required')) ?>
|
<?= $this->form->text('label', $values, $errors, array('required', 'autofocus')) ?>
|
||||||
|
|
||||||
<?= $this->form->label(t('Opposite label'), 'opposite_label') ?>
|
<?= $this->form->label(t('Opposite label'), 'opposite_label') ?>
|
||||||
<?= $this->form->text('opposite_label', $values, $errors) ?>
|
<?= $this->form->text('opposite_label', $values, $errors) ?>
|
||||||
|
<?= $this->modal->submitButtons() ?>
|
||||||
<div class="form-actions">
|
|
||||||
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<div class="page-header">
|
|
||||||
<h2><?= t('Link labels') ?></h2>
|
|
||||||
</div>
|
|
||||||
<?php if (! empty($links)): ?>
|
|
||||||
<table class="table-striped table-scrolling">
|
|
||||||
<tr>
|
|
||||||
<th class="column-70"><?= t('Link labels') ?></th>
|
|
||||||
<th><?= t('Actions') ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php foreach ($links as $link): ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><?= t($link['label']) ?></strong>
|
|
||||||
|
|
||||||
<?php if (! empty($link['opposite_label'])): ?>
|
|
||||||
| <?= t($link['opposite_label']) ?>
|
|
||||||
<?php endif ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<?= $this->modal->medium('edit', t('Edit'), 'LinkController', 'edit', array('link_id' => $link['id'])) ?>
|
|
||||||
<?= t('or') ?>
|
|
||||||
<?= $this->modal->confirm('trash-o', t('Remove'), 'LinkController', 'confirm', array('link_id' => $link['id'])) ?>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= t('There is no link.') ?>
|
|
||||||
<?php endif ?>
|
|
||||||
|
|
||||||
<?= $this->render('link/create', array('values' => $values, 'errors' => $errors)) ?>
|
|
||||||
36
app/Template/link/show.php
Normal file
36
app/Template/link/show.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<h2><?= t('Link labels') ?></h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?= $this->modal->medium('plus', t('Add link label'), 'LinkController', 'create') ?>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php if (! empty($links)): ?>
|
||||||
|
<table class="table-striped table-scrolling">
|
||||||
|
<tr>
|
||||||
|
<th class="column-70"><?= t('Link labels') ?></th>
|
||||||
|
<th><?= t('Actions') ?></th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach ($links as $link): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong><?= t($link['label']) ?></strong>
|
||||||
|
|
||||||
|
<?php if (! empty($link['opposite_label'])): ?>
|
||||||
|
| <?= t($link['opposite_label']) ?>
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<?= $this->modal->medium('edit', t('Edit'), 'LinkController', 'edit', array('link_id' => $link['id'])) ?>
|
||||||
|
<?= t('or') ?>
|
||||||
|
<?= $this->modal->confirm('trash-o', t('Remove'), 'LinkController', 'confirm', array('link_id' => $link['id'])) ?>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</table>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= t('There is no link.') ?>
|
||||||
|
<?php endif ?>
|
||||||
Reference in New Issue
Block a user