improved tag auto-completion and added tag management (#1083)
This commit is contained in:
@@ -203,7 +203,8 @@
|
||||
{
|
||||
locale: '{{ app.request.locale }}',
|
||||
twentyFourHours: {{ 'true'|hour24('false') }},
|
||||
autoReloadDatatable: {% if theme_config('auto_reload_datatable') %}true{% else %}false{% endif %}
|
||||
autoReloadDatatable: {% if theme_config('auto_reload_datatable') %}true{% else %}false{% endif %},
|
||||
autoComplete: {{ theme_config('autocomplete_chars') }}
|
||||
},
|
||||
{
|
||||
'confirm': '{{ 'confirm'|trans }}',
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
{% set actions = {'search': {'class': 'search-toggle visible-xs-inline'}} %}
|
||||
|
||||
{% if is_granted('manage_tag') %}
|
||||
{% set actions = actions|merge({'create': {'url': path('tags_create'), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% set actions = actions|merge({'help': {'url': 'tags.html'|docu_link, 'target': '_blank'}}) %}
|
||||
|
||||
{% set event = trigger('actions.tags', {'actions': actions, 'view': view}) %}
|
||||
@@ -14,14 +18,32 @@
|
||||
|
||||
{% set actions = {} %}
|
||||
|
||||
{% if is_granted('view_other_timesheet') %}
|
||||
{% set actions = actions|merge({'timesheet': path('admin_timesheet', {'tags': tag.name})}) %}
|
||||
{% if tag.id is not empty %}
|
||||
{% if is_granted('manage_tag') %}
|
||||
{% set class = '' %}
|
||||
{% if view != 'edit' %}
|
||||
{% set class = 'modal-ajax-form' %}
|
||||
{% endif %}
|
||||
{% set actions = actions|merge({'edit': {'url': path('tags_edit', {'id': tag.id}), 'class': class}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('view_other_timesheet') %}
|
||||
{% set actions = actions|merge({'timesheet': path('admin_timesheet', {'tags': tag.name})}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('delete_tag') %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('delete_tag', {'id' : tag.id}), 'class': 'api-link', 'attr': {'data-event': 'kimai.tagDelete kimai.tagUpdate', 'data-method': 'DELETE', 'data-question': 'confirm.delete', 'data-msg-error': 'action.delete.error', 'data-msg-success': 'action.delete.success'}}}) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('delete_tag') %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('delete_tag', {'id' : tag.id}), 'class': 'api-link', 'attr': {'data-event': 'kimai.tagDelete kimai.tagUpdate', 'data-method': 'DELETE', 'data-question': 'confirm.delete', 'data-msg-error': 'action.delete.error', 'data-msg-success': 'action.delete.success'}}}) %}
|
||||
{% if view != 'index' %}
|
||||
{% set actions = actions|merge({'back': path('tags')}) %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% set event = trigger('actions.tag', {'actions': actions, 'view': view, 'tag': tag}) %}
|
||||
{{ widgets.table_actions(event.payload.actions) }}
|
||||
{% if view == 'index' %}
|
||||
{{ widgets.table_actions(event.payload.actions) }}
|
||||
{% else %}
|
||||
{{ widgets.entity_actions(event.payload.actions) }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
14
templates/tags/edit.html.twig
Normal file
14
templates/tags/edit.html.twig
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "tags/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'tags.title'|trans({}, 'tags') }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.tag(tag, 'edit') }}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig', {
|
||||
'title': tag.name|default('create'|trans),
|
||||
'form': form,
|
||||
'back': path('tags')
|
||||
}) }}
|
||||
{% endblock %}
|
||||
@@ -21,6 +21,7 @@
|
||||
} %}
|
||||
|
||||
{% set tableName = 'admin_tags' %}
|
||||
{% set manageAllowed = is_granted('manage_tag') %}
|
||||
|
||||
{{ tables.data_table_header(tableName, columns, false, 'kimai.tagUpdate') }}
|
||||
{% for tag in tags %}
|
||||
@@ -29,7 +30,7 @@
|
||||
{% set type = 'warning' %}
|
||||
{% endif %}
|
||||
|
||||
<tr>
|
||||
<tr{% if manageAllowed %} class="modal-ajax-form open-edit" data-href="{{ path('tags_edit', {'id': tag.id}) }}"{% endif %}>
|
||||
<td>{{ tag.name }}</td>
|
||||
<td>{{ widgets.label(tag.amount, type) }}</td>
|
||||
<td class="actions">
|
||||
|
||||
Reference in New Issue
Block a user