mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Add IsGranted to TagController
This commit is contained in:
parent
4a1598165f
commit
943bfd9162
13 changed files with 310 additions and 41 deletions
|
@ -3,7 +3,7 @@
|
|||
{% for tag in tags %}
|
||||
<li class="chip">
|
||||
<a class="chip-label" href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a>
|
||||
{% if withRemove is defined and withRemove == true %}
|
||||
{% if withRemove is defined and withRemove == true and is_granted('DELETE', tag) %}
|
||||
{% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
|
||||
<a class="chip-action" href="{{ path('remove_tag', {'entry': entryId, 'tag': tag.id, redirect: current_path}) }}" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')">
|
||||
<i class="material-icons vertical-align-middle">delete</i>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
{% include "Entry/_feed_link.html.twig" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if current_route == 'search' %}<div><a href="{{ path('tag_this_search', {'filter': searchTerm, 'currentRoute': app.request.get('currentRoute'), redirect: current_path}) }}" title="{{ 'entry.list.assign_search_tag'|trans }}">{{ 'entry.list.assign_search_tag'|trans }}</a></div>{% endif %}
|
||||
{% if current_route == 'search' and is_granted('CREATE_TAGS') %}<div><a href="{{ path('tag_this_search', {'filter': searchTerm, 'currentRoute': app.request.get('currentRoute'), redirect: current_path}) }}" title="{{ 'entry.list.assign_search_tag'|trans }}">{{ 'entry.list.assign_search_tag'|trans }}</a></div>{% endif %}
|
||||
{% if entries.getNbPages > 1 %}
|
||||
{{ pagerfanta(entries, 'default_wallabag') }}
|
||||
{% endif %}
|
||||
|
|
|
@ -316,12 +316,14 @@
|
|||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% include "Entry/_tags.html.twig" with {'tags': entry.tags, 'entryId': entry.id, 'withRemove': true} only %}
|
||||
{% include "Entry/_tags.html.twig" with {'tags': entry.tags, 'entryId': entry.id, 'withRemove': is_granted('UNTAG', entry)} only %}
|
||||
</div>
|
||||
|
||||
<div class="input-field nav-panel-add-tag" style="display: none">
|
||||
{{ render(controller('Wallabag\\Controller\\TagController::addTagFormAction', {'id': entry.id})) }}
|
||||
</div>
|
||||
{% if is_granted('TAG', entry) %}
|
||||
<div class="input-field nav-panel-add-tag" style="display: none">
|
||||
{{ render(controller('Wallabag\\Controller\\TagController::addTagFormAction', {'id': entry.id})) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</aside>
|
||||
<article{% if entry.language is defined and entry.language is not null %} lang="{{ entry.getHTMLLanguage() }}"{% endif %}>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
|
||||
|
||||
<div class="results clearfix">
|
||||
{{ 'tag.list.number_on_the_page'|trans({'%count%': tags|length}) }}
|
||||
{{ 'tag.list.number_on_the_page'|trans({'%count%': allTagsWithNbEntries|length}) }}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -16,12 +16,14 @@
|
|||
<a href="{{ path('untagged') }}">{{ 'tag.list.untagged'|trans }} ({{ nbEntriesUntagged }})</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for tag in tags %}
|
||||
<li title="{{ tag.label }} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}" class="chip">
|
||||
{% for tagWithNbEntries in allTagsWithNbEntries %}
|
||||
{% set tag = tagWithNbEntries.tag %}
|
||||
{% set nbEntries = tagWithNbEntries.nbEntries %}
|
||||
<li title="{{ tag.label }} ({{ nbEntries }})" id="tag-{{ tag.id }}" class="chip">
|
||||
<a href="{{ path('tag_entries', {'slug': tag.slug}) }}" class="card-tag-link" data-handle="tag-link">
|
||||
{{ tag.label }} ({{ tag.nbEntries }})
|
||||
{{ tag.label }} ({{ nbEntries }})
|
||||
</a>
|
||||
{% if renameForms is defined and renameForms[tag.id] is defined %}
|
||||
{% if renameForms is defined and renameForms[tag.id] is defined and is_granted('EDIT', tag) %}
|
||||
<form class="card-tag-form hidden" data-handle="tag-rename-form" action="{{ path('tag_rename', {'slug': tag.slug, redirect: current_path}) }}" method="POST">
|
||||
{{ form_widget(renameForms[tag.id].label, {'attr': {'value': tag.label}}) }}
|
||||
{{ form_rest(renameForms[tag.id]) }}
|
||||
|
@ -30,9 +32,11 @@
|
|||
<i class="material-icons">mode_edit</i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a id="delete-{{ tag.slug }}" href="{{ path('tag_delete', {'slug': tag.slug, redirect: current_path}) }}" class="card-tag-icon card-tag-delete" onclick="return confirm('{{ 'tag.confirm.delete'|trans({'%name%': tag.label})|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</a>
|
||||
{% if is_granted('DELETE', tag) %}
|
||||
<a id="delete-{{ tag.slug }}" href="{{ path('tag_delete', {'slug': tag.slug, redirect: current_path}) }}" class="card-tag-icon card-tag-delete" onclick="return confirm('{{ 'tag.confirm.delete'|trans({'%name%': tag.label})|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if app.user.config.feedToken %}
|
||||
<a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="card-tag-icon"><i class="material-icons">rss_feed</i></a>
|
||||
{% endif %}
|
||||
|
|
|
@ -73,9 +73,11 @@
|
|||
<a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="items-number grey-text">{{ count_entries('all') }}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="bold {% if current_route == 'tags' %}active{% endif %}">
|
||||
<a class="waves-effect" href="{{ path('tag') }}">{{ 'menu.left.tags'|trans }} <span class="items-number grey-text">{{ count_tags() }}</span></a>
|
||||
</li>
|
||||
{% if is_granted('LIST_TAGS') %}
|
||||
<li class="bold {% if current_route == 'tags' %}active{% endif %}">
|
||||
<a class="waves-effect" href="{{ path('tag') }}">{{ 'menu.left.tags'|trans }} <span class="items-number grey-text">{{ count_tags() }}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="nav-panels">
|
||||
<div class="nav-panel-actions nav-panel-item">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue