Add groups rename
This commit is contained in:
parent
eacd690b18
commit
4cb1aa0056
14 changed files with 224 additions and 108 deletions
|
@ -65,13 +65,16 @@ class ACL extends \Zend\Permissions\Acl\Acl
|
|||
'/channels/send/{sid}/{cid}',
|
||||
|
||||
'/groups/{sid}',
|
||||
'/groups/{sid}/{sgid}',
|
||||
'/groups/delete/{sid}/{sgid}',
|
||||
'/groups/remove/{sid}/{sgid}/{cldbid}',
|
||||
'/groups/add/{sid}/{sgid}',
|
||||
|
||||
'/servergroups/{sid}/{sgid}',
|
||||
'/servergroups/delete/{sid}/{sgid}',
|
||||
'/servergroups/rename/{sid}/{sgid}',
|
||||
'/servergroups/remove/{sid}/{sgid}/{cldbid}',
|
||||
'/servergroups/add/{sid}/{sgid}',
|
||||
|
||||
'/channelgroups/{sid}/{cgid}',
|
||||
'/channelgroups/delete/{sid}/{cgid}',
|
||||
'/channelgroups/rename/{sid}/{cgid}',
|
||||
|
||||
'/bans/{sid}',
|
||||
'/bans/delete/{sid}/{banId}',
|
||||
|
|
|
@ -184,25 +184,31 @@ $container[GroupsAction::class] = function ($container) {
|
|||
};
|
||||
$app->get('/groups/{sid}', GroupsAction::class);
|
||||
|
||||
$container[GroupInfoAction::class] = function ($container) {
|
||||
return new GroupInfoAction($container);
|
||||
// server group
|
||||
$container[ServerGroupInfoAction::class] = function ($container) {
|
||||
return new ServerGroupInfoAction($container);
|
||||
};
|
||||
$app->get('/groups/{sid}/{sgid}', GroupInfoAction::class);
|
||||
$app->get('/servergroups/{sid}/{sgid}', ServerGroupInfoAction::class);
|
||||
|
||||
$container[GroupDeleteAction::class] = function ($container) {
|
||||
return new GroupDeleteAction($container);
|
||||
$container[ServerGroupDeleteAction::class] = function ($container) {
|
||||
return new ServerGroupDeleteAction($container);
|
||||
};
|
||||
$app->get('/groups/delete/{sid}/{sgid}', GroupDeleteAction::class);
|
||||
$app->get('/servergroups/delete/{sid}/{sgid}', ServerGroupDeleteAction::class);
|
||||
|
||||
$container[GroupRemoveAction::class] = function ($container) {
|
||||
return new GroupRemoveAction($container);
|
||||
$container[ServerGroupRemoveAction::class] = function ($container) {
|
||||
return new ServerGroupRemoveAction($container);
|
||||
};
|
||||
$app->get('/groups/remove/{sid}/{sgid}/{cldbid}', GroupRemoveAction::class);
|
||||
$app->get('/servergroups/remove/{sid}/{sgid}/{cldbid}', ServerGroupRemoveAction::class);
|
||||
|
||||
$container[GroupAddAction::class] = function ($container) {
|
||||
return new GroupAddAction($container);
|
||||
$container[ServerGroupAddAction::class] = function ($container) {
|
||||
return new ServerGroupAddAction($container);
|
||||
};
|
||||
$app->post('/groups/add/{sid}/{sgid}', GroupAddAction::class);
|
||||
$app->post('/servergroups/add/{sid}/{sgid}', ServerGroupAddAction::class);
|
||||
|
||||
$container[ServerGroupRenameAction::class] = function ($container) {
|
||||
return new ServerGroupRenameAction($container);
|
||||
};
|
||||
$app->post('/servergroups/rename/{sid}/{sgid}', ServerGroupRenameAction::class);
|
||||
|
||||
|
||||
// channel group
|
||||
|
@ -216,6 +222,11 @@ $container[ChannelGroupDeleteAction::class] = function ($container) {
|
|||
};
|
||||
$app->get('/channelgroups/delete/{sid}/{cgid}', ChannelGroupDeleteAction::class);
|
||||
|
||||
$container[ChannelGroupRenameAction::class] = function ($container) {
|
||||
return new ChannelGroupRenameAction($container);
|
||||
};
|
||||
$app->post('/channelgroups/rename/{sid}/{cgid}', ChannelGroupRenameAction::class);
|
||||
|
||||
// ban
|
||||
$container[BansAction::class] = function ($container) {
|
||||
return new BansAction($container);
|
||||
|
|
|
@ -80,7 +80,8 @@ clients.title: "Clients"
|
|||
bans.title: "Bans"
|
||||
complains.title: "Complains"
|
||||
groups.title: "Groups"
|
||||
group_info.title: "Group Info"
|
||||
servergroup_info.title: "Server Group Info"
|
||||
channelgroup_info.title: "Channelgroup"
|
||||
profile.title: "Profile"
|
||||
tokens.title: "Tokens"
|
||||
|
||||
|
@ -142,27 +143,26 @@ channel_info.h.clients: "Clients"
|
|||
channel_info.send: "Send a message"
|
||||
channel_info.send.message: "Message"
|
||||
|
||||
# channelgroups
|
||||
channelgroups.delete: "Delete"
|
||||
|
||||
# channelgroup info
|
||||
channelgroup_info.title: "Channelgroup"
|
||||
channelgroup_info.h.clients: "Clients"
|
||||
channelgroup_info.h.permissions: "Permissions"
|
||||
channelgroup_info.remove: "Remove"
|
||||
|
||||
# groups
|
||||
groups.delete: "Delete"
|
||||
groups.h.servergroups: "Server Groups"
|
||||
groups.h.channelgroups: "Channel Groups"
|
||||
|
||||
# group info
|
||||
group_info.h.clients_add: "Add"
|
||||
group_info.h.clients: "Clients"
|
||||
group_info.h.permissions: "Permissions"
|
||||
group_info.remove: "Remove"
|
||||
group_info.add: "Add a client"
|
||||
group_info.add.cldbid: "Client Database Id"
|
||||
# channelgroups
|
||||
channelgroups.delete: "Delete"
|
||||
|
||||
# channelgroup info
|
||||
channelgroup_info.h.clients: "Clients"
|
||||
channelgroup_info.h.permissions: "Permissions"
|
||||
channelgroup_info.remove: "Remove"
|
||||
|
||||
# server group info
|
||||
servergroup_info.h.clients_add: "Add"
|
||||
servergroup_info.h.clients: "Clients"
|
||||
servergroup_info.h.permissions: "Permissions"
|
||||
servergroup_info.remove: "Remove"
|
||||
servergroup_info.add: "Add a client"
|
||||
servergroup_info.add.cldbid: "Client Database Id"
|
||||
|
||||
# clients
|
||||
clients.delete: "Delete"
|
||||
|
|
25
src/Control/Actions/ChannelGroupRenameAction.php
Normal file
25
src/Control/Actions/ChannelGroupRenameAction.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
final class ChannelGroupRenameAction extends AbstractAction
|
||||
{
|
||||
public function __invoke(Request $request, Response $response, $args)
|
||||
{
|
||||
$sid = $args['sid'];
|
||||
$cgid = $args['cgid'];
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$name = $body['name'];
|
||||
|
||||
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
|
||||
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
|
||||
|
||||
$groupRenameResult = $this->ts->getInstance()->channelGroupRename($cgid, $name);
|
||||
|
||||
$this->flash->addMessage('success', $this->translator->trans('done'));
|
||||
|
||||
return $response->withRedirect('/groups/' . $sid);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
final class GroupAddAction extends AbstractAction
|
||||
final class ServerGroupAddAction extends AbstractAction
|
||||
{
|
||||
public function __invoke(Request $request, Response $response, $args)
|
||||
{
|
||||
|
@ -20,6 +20,6 @@ final class GroupAddAction extends AbstractAction
|
|||
|
||||
$this->flash->addMessage('success', $this->translator->trans('added'));
|
||||
|
||||
return $response->withRedirect('/groups/' . $sid . '/' . $sgid);
|
||||
return $response->withRedirect('/servergroups/' . $sid . '/' . $sgid);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
final class GroupDeleteAction extends AbstractAction
|
||||
final class ServerGroupDeleteAction extends AbstractAction
|
||||
{
|
||||
public function __invoke(Request $request, Response $response, $args)
|
||||
{
|
|
@ -3,7 +3,7 @@
|
|||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
final class GroupInfoAction extends AbstractAction
|
||||
final class ServerGroupInfoAction extends AbstractAction
|
||||
{
|
||||
public function __invoke(Request $request, Response $response, $args)
|
||||
{
|
||||
|
@ -18,8 +18,8 @@ final class GroupInfoAction extends AbstractAction
|
|||
$permissionsResult = $this->ts->getInstance()->serverGroupPermList($sgid, true);
|
||||
|
||||
// render GET
|
||||
$this->view->render($response, 'group_info.twig', [
|
||||
'title' => $this->translator->trans('group_info.title') . ' ' . $sgid,
|
||||
$this->view->render($response, 'servergroup_info.twig', [
|
||||
'title' => $this->translator->trans('servergroup_info.title') . ' ' . $sgid,
|
||||
'clients' => $this->ts->getInstance()->getElement('data', $clientsResult),
|
||||
'permissions' => $this->ts->getInstance()->getElement('data', $permissionsResult),
|
||||
'sid' => $sid,
|
|
@ -3,7 +3,7 @@
|
|||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
final class GroupRemoveAction extends AbstractAction
|
||||
final class ServerGroupRemoveAction extends AbstractAction
|
||||
{
|
||||
public function __invoke(Request $request, Response $response, $args)
|
||||
{
|
||||
|
@ -18,6 +18,6 @@ final class GroupRemoveAction extends AbstractAction
|
|||
|
||||
$this->flash->addMessage('success', $this->translator->trans('removed'));
|
||||
|
||||
return $response->withRedirect('/groups/' . $sid . '/' . $sgid);
|
||||
return $response->withRedirect('/servergroups/' . $sid . '/' . $sgid);
|
||||
}
|
||||
}
|
25
src/Control/Actions/ServerGroupRenameAction.php
Normal file
25
src/Control/Actions/ServerGroupRenameAction.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
final class ServerGroupRenameAction extends AbstractAction
|
||||
{
|
||||
public function __invoke(Request $request, Response $response, $args)
|
||||
{
|
||||
$sid = $args['sid'];
|
||||
$sgid = $args['sgid'];
|
||||
|
||||
$body = $request->getParsedBody();
|
||||
$name = $body['name'];
|
||||
|
||||
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
|
||||
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
|
||||
|
||||
$groupRenameResult = $this->ts->getInstance()->serverGroupRename($sgid, $name);
|
||||
|
||||
$this->flash->addMessage('success', $this->translator->trans('done'));
|
||||
|
||||
return $response->withRedirect('/groups/' . $sid);
|
||||
}
|
||||
}
|
47
src/View/material/form_inline.twig
Normal file
47
src/View/material/form_inline.twig
Normal file
|
@ -0,0 +1,47 @@
|
|||
{% set uri = editable.uri %}
|
||||
|
||||
{% if editable.uri_param is not empty %}
|
||||
{% for searchingKey, searchingValue in arr %}
|
||||
{% if searchingKey == editable.uri_param %}
|
||||
{% set uri = uri ~ '/' ~ searchingValue %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<form class="form-inline" method="{{ editable.uri_method }}" action="{{ uri }}">
|
||||
{% if editable.type == 'checkbox' %}
|
||||
|
||||
{% if item %}
|
||||
<input type="hidden" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="0"/>
|
||||
<input type="checkbox" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="1" checked/>
|
||||
{% else %}
|
||||
<input type="hidden" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="0" />
|
||||
<input type="checkbox" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="1" />
|
||||
{% endif %}
|
||||
{% elseif editable.type == 'select' %}
|
||||
<select class="form-control" name="{{ editable.key }}" id="{{ editable.key }}">
|
||||
|
||||
{% for k,v in editable.options %}
|
||||
{% if v == item %}
|
||||
<option class="form-control" value="{{ v }}" selected>{{ k }}</option>
|
||||
{% else %}
|
||||
<option class="form-control" value="{{ v }}">{{ k }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
<input class="form-control" name="{{ editable.key }}" id="{{ editable.key }}" type="{{ editable.type }}"
|
||||
{% if editable.blank is defined and editable.blank == true %}
|
||||
{% else %}
|
||||
value="{{ item }}"
|
||||
{% endif %}
|
||||
/>
|
||||
{% endif %}
|
||||
|
||||
<button class="btn btn-primary" id="{{ 'form_' ~ editable.key }}" type="submit">{{ editable.submit_label|raw }}</button>
|
||||
</form>
|
|
@ -6,14 +6,25 @@
|
|||
<h2 class="header">{% trans %}groups.h.servergroups{% endtrans %}</h2>
|
||||
{% if serverGroups|length > 0 %}
|
||||
{% include 'table.twig' with {'data': serverGroups,
|
||||
'links': [{'key': 'sgid', 'uri': '/groups/' ~ sid}],
|
||||
'links': [{'key': 'sgid', 'uri': '/servergroups/' ~ sid}],
|
||||
'hiddenColumns': ['savedb', 'sortid', 'namemode', 'n_modifyp', 'n_member_addp', 'n_member_removep'],
|
||||
'additional_links': [
|
||||
{
|
||||
'header_label': 'groups.delete'|trans,
|
||||
'label': '<i class="material-icons">delete</i>',
|
||||
'uri': '/groups/delete/' ~ sid,
|
||||
'uri': '/servergroups/delete/' ~ sid,
|
||||
'uri_param': 'sgid'
|
||||
}
|
||||
],
|
||||
'attributesEditable': [
|
||||
{
|
||||
'key': 'name',
|
||||
'type': 'text',
|
||||
'uri': '/servergroups/rename/' ~ sid,
|
||||
'uri_param': 'sgid',
|
||||
'uri_method': 'post',
|
||||
'submit_label': '<i class="material-icons">check_circle</i>'
|
||||
}
|
||||
]
|
||||
} %}
|
||||
{% else %}
|
||||
|
@ -25,6 +36,7 @@
|
|||
{% if channelGroups|length > 0 %}
|
||||
{% include 'table.twig' with {'data': channelGroups,
|
||||
'links': [{'key': 'cgid', 'uri': '/channelgroups/' ~ sid}],
|
||||
'hiddenColumns': ['savedb', 'sortid', 'namemode', 'n_modifyp', 'n_member_addp', 'n_member_removep'],
|
||||
'additional_links': [
|
||||
{
|
||||
'header_label': 'channelgroups.delete'|trans,
|
||||
|
@ -32,6 +44,16 @@
|
|||
'uri': '/channelgroups/delete/' ~ sid,
|
||||
'uri_param': 'cgid'
|
||||
}
|
||||
],
|
||||
'attributesEditable': [
|
||||
{
|
||||
'key': 'name',
|
||||
'type': 'text',
|
||||
'uri': '/channelgroups/rename/' ~ sid,
|
||||
'uri_param': 'cgid',
|
||||
'uri_method': 'post',
|
||||
'submit_label': '<i class="material-icons">check_circle</i>'
|
||||
}
|
||||
]
|
||||
} %}
|
||||
{% else %}
|
||||
|
|
|
@ -13,63 +13,27 @@
|
|||
<td>{{ key|replace({'_' : ' '})|title }}</td>
|
||||
|
||||
<td>
|
||||
<!-- determine if cell should -->
|
||||
{% set editable = null %}
|
||||
|
||||
{% for attr in attributesEditable %}
|
||||
{% if attr.key == key %}
|
||||
{% set editable = attr %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<!-- apply filters to item -->
|
||||
{% set item = value %}
|
||||
|
||||
{% for filter in filters %}
|
||||
{% if filter.key == key %}
|
||||
{% set item = value|apply_filter(filter.apply)|raw %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<!-- cell is editable, generate a form -->
|
||||
{% if editable is not empty %}
|
||||
{% include 'form_inline.twig' with {'editable': editable} %}
|
||||
|
||||
<form class="form-inline" method="{{ editable.uri_method }}" action="{{ editable.uri }}">
|
||||
{% if editable.type == 'checkbox' %}
|
||||
|
||||
{% if item %}
|
||||
<input type="hidden" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="0"/>
|
||||
<input type="checkbox" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="1" checked/>
|
||||
{% else %}
|
||||
<input type="hidden" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="0" />
|
||||
<input type="checkbox" name="{{ editable.key }}"
|
||||
id="{{ editable.key }}" value="1" />
|
||||
{% endif %}
|
||||
{% elseif editable.type == 'select' %}
|
||||
<select class="form-control" name="{{ editable.key }}" id="{{ editable.key }}">
|
||||
|
||||
{% for k,v in editable.options %}
|
||||
{% if v == item %}
|
||||
<option class="form-control" value="{{ v }}" selected>{{ k }}</option>
|
||||
{% else %}
|
||||
<option class="form-control" value="{{ v }}">{{ k }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
<input class="form-control" name="{{ editable.key }}" id="{{ editable.key }}" type="{{ editable.type }}"
|
||||
{% if editable.blank is defined and editable.blank == true %}
|
||||
{% else %}
|
||||
value="{{ item }}"
|
||||
{% endif %}
|
||||
/>
|
||||
{% endif %}
|
||||
|
||||
<button class="btn btn-primary" id="{{ 'form_' ~ editable.key }}" type="submit">{{ editable.submit_label|raw }}</button>
|
||||
</form>
|
||||
<!-- cell is static or a link-->
|
||||
{% else %}
|
||||
{{ item }}
|
||||
{% endif %}
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
{% block content %}
|
||||
<h1 class="header">{{ title }}</h1>
|
||||
|
||||
<h2 class="header">{% trans %}group_info.h.clients_add{% endtrans %}</h2>
|
||||
<h2 class="header">{% trans %}servergroup_info.h.clients_add{% endtrans %}</h2>
|
||||
{% include 'form.twig' with {
|
||||
'fields': [
|
||||
{
|
||||
'header_label': 'group_info.add'|trans,
|
||||
'header_label': 'servergroup_info.add'|trans,
|
||||
'label': '<i class="material-icons">check_circle</i>',
|
||||
'uri': '/groups/add/' ~ sid ~ '/' ~ sgid,
|
||||
'uri': '/servergroups/add/' ~ sid ~ '/' ~ sgid,
|
||||
'uri_method': 'post',
|
||||
'fields': [
|
||||
{'type': 'text', 'key': 'cldbid', 'label': 'group_info.add.cldbid'|trans},
|
||||
{'type': 'text', 'key': 'cldbid', 'label': 'servergroup_info.add.cldbid'|trans},
|
||||
]
|
||||
}
|
||||
]
|
||||
} %}
|
||||
|
||||
{% if clients|length > 0 %}
|
||||
<h2 class="header">{% trans %}group_info.h.clients{% endtrans %}</h2>
|
||||
<h2 class="header">{% trans %}servergroup_info.h.clients{% endtrans %}</h2>
|
||||
{% include 'table.twig' with {'data': clients,
|
||||
'links': [
|
||||
{'key': 'cldbid', 'uri': '/clients/' ~ sid, 'uri_param': 'cldbid'}
|
||||
],
|
||||
'additional_links': [
|
||||
{
|
||||
'header_label': 'group_info.remove'|trans,
|
||||
'header_label': 'servergroup_info.remove'|trans,
|
||||
'label': '<i class="material-icons">delete</i>',
|
||||
'uri': '/groups/remove/' ~ sid ~ '/' ~ sgid,
|
||||
'uri': '/servergroups/remove/' ~ sid ~ '/' ~ sgid,
|
||||
'uri_param': 'cldbid'
|
||||
}
|
||||
]
|
||||
|
@ -36,7 +36,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if permissions|length > 0 %}
|
||||
<h2 class="header">{% trans %}group_info.h.permissions{% endtrans %}</h2>
|
||||
<h2 class="header">{% trans %}servergroup_info.h.permissions{% endtrans %}</h2>
|
||||
{% include 'table.twig' with {'data': permissions} %}
|
||||
{% endif %}
|
||||
|
|
@ -2,11 +2,13 @@
|
|||
<table class="table small sortable-bootstrap" data-sortable>
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- determine if to hide entire column header -->
|
||||
{% set added = [] %}
|
||||
{% for arr in data %}
|
||||
{% set added = arr|keys %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- determine if column should be hidden -->
|
||||
{% for key in added %}
|
||||
{% if key not in hiddenColumns %}
|
||||
<th>{{ key|replace({'_' : ' '})|title }}</th>
|
||||
|
@ -22,8 +24,8 @@
|
|||
|
||||
{% for arr in data %}
|
||||
|
||||
<!-- determine if row should be hidden -->
|
||||
{% set show = true %}
|
||||
|
||||
{% for hidden in hiddenDependingOnAttribute %}
|
||||
{% if hidden.key in arr|keys and attribute(arr, hidden.key) in hidden.values %}
|
||||
{% set show = false %}
|
||||
|
@ -35,41 +37,58 @@
|
|||
{% for key, value in arr %}
|
||||
{% set value = value %}
|
||||
|
||||
<!-- apply filters to item -->
|
||||
{% for filter in filters %}
|
||||
{% if filter.key == key %}
|
||||
{% set value = value|apply_filter(filter.apply)|raw %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- determine if to hide entire column cell -->
|
||||
{% set showColumn = true %}
|
||||
|
||||
{% if key in hiddenColumns %}
|
||||
{% set showColumn = false %}
|
||||
{% endif %}
|
||||
|
||||
{% if showColumn %}
|
||||
{% set item = '<td>' ~ value ~ '</td>' %}
|
||||
<td>
|
||||
{% set item = value %}
|
||||
|
||||
{% for link in links %}
|
||||
{% if link.key == key %}
|
||||
{% if link.uri_param is not empty %}
|
||||
{% for searchingKey, searchingValue in arr %}
|
||||
{% if searchingKey == link.uri_param %}
|
||||
{% set item = "<td><a href=\"#{link.uri}\/#{searchingValue}\">#{value}</a></td>" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% set item = "<td><a href=\"#{link.uri}\/#{value}\">#{value}</a></td>" %}
|
||||
<!-- determine if cell should -->
|
||||
{% set editable = null %}
|
||||
{% for attr in attributesEditable %}
|
||||
{% if attr.key == key %}
|
||||
{% set editable = attr %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{{ item|raw }}
|
||||
<!-- cell is editable, generate a form -->
|
||||
{% if editable is not empty %}
|
||||
{% include 'form_inline.twig' with {'editable': editable} %}
|
||||
<!-- cell is static or a link-->
|
||||
{% else %}
|
||||
{% for link in links %}
|
||||
{% if link.key == key %}
|
||||
{% if link.uri_param is not empty %}
|
||||
{% for searchingKey, searchingValue in arr %}
|
||||
{% if searchingKey == link.uri_param %}
|
||||
{% set item = "<a href=\"#{link.uri}\/#{searchingValue}\">#{value}</a>" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% set item = "<a href=\"#{link.uri}\/#{value}\">#{value}</a>" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{{ item|raw }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- generate additional columns as links, maybe apply filters -->
|
||||
{% for link in additional_links %}
|
||||
|
||||
<td>
|
||||
{% set item = "<a href=\"#{link.uri}\">#{link.label}" %}
|
||||
|
||||
|
|
Reference in a new issue