mirror of
https://github.com/wallabag/wallabag.git
synced 2025-03-13 22:52:39 +00:00
Merge 37d6279c9f
into a4a6eb580b
This commit is contained in:
commit
083b78b7e8
6 changed files with 59 additions and 84 deletions
|
@ -27,7 +27,7 @@ import './js/highlight';
|
|||
|
||||
/* Tools */
|
||||
import {
|
||||
savePercent, retrievePercent, initExport, initFilters, initRandom, initPreviewText,
|
||||
savePercent, retrievePercent, initPreviewText,
|
||||
} from './js/tools';
|
||||
|
||||
/* Import shortcuts */
|
||||
|
@ -273,7 +273,10 @@ const articleScroll = () => {
|
|||
|
||||
$(document).ready(() => {
|
||||
// sidenav
|
||||
$('.sidenav').sidenav();
|
||||
document.querySelectorAll('.sidenav').forEach((element) => {
|
||||
$(element).sidenav({ edge: element.getAttribute('data-edge') ?? 'left' });
|
||||
});
|
||||
|
||||
$('select').formSelect();
|
||||
$('.collapsible[data-collapsible="accordion"]').collapsible();
|
||||
$('.collapsible[data-collapsible="expandable"]').collapsible({
|
||||
|
@ -291,9 +294,6 @@ $(document).ready(() => {
|
|||
$('.tooltipped').tooltip();
|
||||
$('.fixed-action-btn').floatingActionButton();
|
||||
|
||||
initFilters();
|
||||
initExport();
|
||||
initRandom();
|
||||
stickyNav();
|
||||
articleScroll();
|
||||
initPreviewText();
|
||||
|
|
|
@ -31,35 +31,6 @@ function retrievePercent(id, resized) {
|
|||
return true;
|
||||
}
|
||||
|
||||
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('');
|
||||
$('#filters :checked').removeAttr('checked');
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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')) {
|
||||
|
@ -79,8 +50,5 @@ function initPreviewText() {
|
|||
export {
|
||||
savePercent,
|
||||
retrievePercent,
|
||||
initExport,
|
||||
initFilters,
|
||||
initRandom,
|
||||
initPreviewText,
|
||||
};
|
||||
|
|
|
@ -143,14 +143,6 @@ nav {
|
|||
margin: 0 1%;
|
||||
}
|
||||
|
||||
.button-filters {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.button-export {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.entry-nav-top--sticky {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
|
|
|
@ -6,6 +6,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use Doctrine\ORM\QueryBuilder;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
@ -136,6 +137,7 @@ class TagController extends AbstractController
|
|||
* @param int $page
|
||||
*
|
||||
* @Route("/tag/list/{slug}/{page}", name="tag_entries", methods={"GET"}, defaults={"page" = "1"})
|
||||
* @IsGranted("LIST_ENTRIES")
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
*
|
||||
* @return Response
|
||||
|
|
|
@ -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 %}
|
||||
<li>
|
||||
<a class="waves-effect tooltipped js-random-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.random_entry'|trans }}" href="{{ path('random_entry', {'type': active_route}) }}">
|
||||
<i class="material-icons">casino</i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if has_filters %}
|
||||
<li class="button-filters">
|
||||
<a class="nav-panel-menu sidenav-trigger tooltipped js-filters-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-target="filters">
|
||||
<i class="material-icons">filter_list</i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if has_exports %}
|
||||
<li class="button-export">
|
||||
<a class="nav-panel-menu sidenav-trigger tooltipped js-export-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.export'|trans }}" href="#" data-target="export">
|
||||
<i class="material-icons">file_download</i>
|
||||
</a>
|
||||
</li>
|
||||
{% 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,8 @@
|
|||
{% endif %}
|
||||
|
||||
<!-- Export -->
|
||||
<div id="export" class="sidenav">
|
||||
{% if has_exports %}
|
||||
<div id="export" class="sidenav" data-edge="right">
|
||||
{% set current_tag = null %}
|
||||
{% if tag is defined %}
|
||||
{% set current_tag = tag.slug %}
|
||||
|
@ -108,10 +136,11 @@
|
|||
{% if craue_setting('export_md') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'md', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route, 'entry': entry}) }}">Markdown</a></li>{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Filters -->
|
||||
{% if form is not null and is_granted('LIST_ENTRIES') %}
|
||||
<div id="filters" class="sidenav">
|
||||
{% if has_filters %}
|
||||
<div id="filters" class="sidenav" data-edge="right">
|
||||
<form action="{{ path('all') }}">
|
||||
|
||||
<h4 class="center">{{ 'entry.filters.title'|trans }}</h4>
|
||||
|
@ -233,7 +262,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col s6">
|
||||
<a href="#!" class="center waves-effect waves-green btn-flat" id="clear_form_filters">{{ 'entry.filters.action.clear'|trans }}</a>
|
||||
<button type="reset" class="center waves-effect waves-green btn-flat">{{ 'entry.filters.action.clear'|trans }}</button>
|
||||
</div>
|
||||
|
||||
<div class="col s6">
|
||||
|
|
|
@ -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 @@
|
|||
</li>
|
||||
{% 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') %}
|
||||
<li class="bold {% if active_route == 'unread' %}active{% endif %}">
|
||||
<a class="waves-effect" href="{{ path('unread') }}">{{ 'menu.left.unread'|trans }} <span class="items-number grey-text">{{ count_entries('unread') }}</span></a>
|
||||
|
@ -97,23 +97,7 @@
|
|||
<i class="material-icons">search</i>
|
||||
</a>
|
||||
</li>
|
||||
{% if active_route and is_granted('LIST_ENTRIES') %}
|
||||
<li id="button_random">
|
||||
<a class="waves-effect tooltipped js-random-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.random_entry'|trans }}" href="{{ path('random_entry', {'type': active_route}) }}">
|
||||
<i class="material-icons">casino</i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li id="button_filters" class="button-filters">
|
||||
<a class="nav-panel-menu sidenav-trigger tooltipped js-filters-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-target="filters">
|
||||
<i class="material-icons">filter_list</i>
|
||||
</a>
|
||||
</li>
|
||||
<li id="button_export" class="button-export">
|
||||
<a class="nav-panel-menu sidenav-trigger tooltipped js-export-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.export'|trans }}" href="#" data-target="export">
|
||||
<i class="material-icons">file_download</i>
|
||||
</a>
|
||||
</li>
|
||||
{% block nav_panel_extra_actions '' %}
|
||||
<li class="bold">
|
||||
<a class="wave-effect tooltipped dropdown-trigger" data-covertrigger="false" data-constrainwidth="false" data-target="dropdown-account" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.account'|trans }}" href="#" id="news_menu">
|
||||
<i class="material-icons" id="news_link">account_circle</i>
|
||||
|
|
Loading…
Reference in a new issue