diff --git a/assets/index.js b/assets/index.js index f4d6c6940..7a4a27120 100755 --- a/assets/index.js +++ b/assets/index.js @@ -27,7 +27,7 @@ import './js/highlight'; /* Tools */ import { - savePercent, retrievePercent, initExport, initFilters, initRandom, initPreviewText, + savePercent, retrievePercent, initExport, initFilters, initPreviewText, } from './js/tools'; /* Import shortcuts */ @@ -293,7 +293,6 @@ $(document).ready(() => { initFilters(); initExport(); - initRandom(); stickyNav(); articleScroll(); initPreviewText(); diff --git a/assets/js/tools.js b/assets/js/tools.js index 55e5fc000..338bb91cc 100644 --- a/assets/js/tools.js +++ b/assets/js/tools.js @@ -34,7 +34,6 @@ function retrievePercent(id, resized) { function initFilters() { // no display if filters not available if ($('div').is('#filters')) { - $('#button_filters').show(); $('#filters.sidenav').sidenav({ edge: 'right' }); $('#clear_form_filters').on('click', () => { $('#filters input').val(''); @@ -48,18 +47,10 @@ function initFilters() { function initExport() { // no display if export not available if ($('div').is('#export')) { - $('#button_export').show(); $('#export.sidenav').sidenav({ edge: 'right' }); } } -function initRandom() { - // no display if export (ie: entries) not available - if ($('div').is('#export')) { - $('#button_random').show(); - } -} - function initPreviewText() { // no display if preview_text not available if ($('div').is('#preview-article')) { @@ -81,6 +72,5 @@ export { retrievePercent, initExport, initFilters, - initRandom, initPreviewText, }; diff --git a/assets/scss/_nav.scss b/assets/scss/_nav.scss index 798a3a44a..a1db43486 100644 --- a/assets/scss/_nav.scss +++ b/assets/scss/_nav.scss @@ -143,14 +143,6 @@ nav { margin: 0 1%; } -.button-filters { - display: none; -} - -.button-export { - display: none; -} - .entry-nav-top--sticky { position: sticky; top: 0; diff --git a/templates/Entry/entries.html.twig b/templates/Entry/entries.html.twig index d437b1afd..7b1575ec8 100644 --- a/templates/Entry/entries.html.twig +++ b/templates/Entry/entries.html.twig @@ -1,5 +1,8 @@ {% extends "layout.html.twig" %} +{% set has_filters = form is not null %} +{% set has_exports = craue_setting('export_epub') or craue_setting('export_pdf') or craue_setting('export_json') or craue_setting('export_csv') or craue_setting('export_txt') or craue_setting('export_xml') or craue_setting('export_md') %} + {% block head %} {{ parent() }} {% if tag is defined and app.user.config.feedToken %} @@ -18,6 +21,30 @@ {% include "Entry/_title.html.twig" with {'filter': filter} %} {% endblock %} +{% block nav_panel_extra_actions %} + {% if active_route %} +
  • + + casino + +
  • + {% endif %} + {% if has_filters %} +
  • + + filter_list + +
  • + {% endif %} + {% if has_exports %} +
  • + + file_download + +
  • + {% endif %} +{% endblock %} + {% block content %} {% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} {% set list_mode = app.user.config.listMode %} @@ -86,7 +113,7 @@ {% endif %} - {% if is_granted('EXPORT_ENTRIES') %} + {% if has_exports and is_granted('EXPORT_ENTRIES') %}
    {% set current_tag = null %} {% if tag is defined %} @@ -112,7 +139,7 @@ {% endif %} - {% if form is not null and is_granted('LIST_ENTRIES') %} + {% if has_filters %}
    diff --git a/templates/layout.html.twig b/templates/layout.html.twig index e80072931..9ceb4a32e 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -1,5 +1,23 @@ {% extends "base.html.twig" %} +{% set current_route = app.request.attributes.get('_route') %} +{% set current_route_from_query_params = app.request.query.get('currentRoute') %} + +{% set active_route = null %} +{% if current_route == 'all' or current_route_from_query_params == 'all' %} + {% set active_route = 'all' %} +{% elseif current_route == 'annotated' or current_route_from_query_params == 'annotated' %} + {% set active_route = 'annotated' %} +{% elseif current_route == 'archive' or current_route_from_query_params == 'archive' %} + {% set active_route = 'archive' %} +{% elseif current_route == 'starred' or current_route_from_query_params == 'starred' %} + {% set active_route = 'starred' %} +{% elseif current_route == 'unread' or current_route == 'homepage' or current_route_from_query_params == 'unread' %} + {% set active_route = 'unread' %} +{% elseif current_route == 'untagged' %} + {% set active_route = 'untagged' %} +{% endif %} + {% block css %} {{ parent() }} @@ -38,24 +56,6 @@ {% endblock %} - {% set current_route = app.request.attributes.get('_route') %} - {% set current_route_from_query_params = app.request.query.get('currentRoute') %} - - {% set active_route = null %} - {% if current_route == 'all' or current_route_from_query_params == 'all' %} - {% set active_route = 'all' %} - {% elseif current_route == 'annotated' or current_route_from_query_params == 'annotated' %} - {% set active_route = 'annotated' %} - {% elseif current_route == 'archive' or current_route_from_query_params == 'archive' %} - {% set active_route = 'archive' %} - {% elseif current_route == 'starred' or current_route_from_query_params == 'starred' %} - {% set active_route = 'starred' %} - {% elseif current_route == 'unread' or current_route == 'homepage' or current_route_from_query_params == 'unread' %} - {% set active_route = 'unread' %} - {% elseif current_route == 'untagged' %} - {% set active_route = 'untagged' %} - {% endif %} - {% if is_granted('LIST_ENTRIES') %}
  • {{ 'menu.left.unread'|trans }} {{ count_entries('unread') }} @@ -99,23 +99,7 @@ search
  • - {% if active_route and is_granted('LIST_ENTRIES') %} -
  • - - casino - -
  • - {% endif %} -
  • - - filter_list - -
  • -
  • - - file_download - -
  • + {% block nav_panel_extra_actions '' %}
  • account_circle