1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-06 17:41:01 +00:00

Initialize filters and export sidenav with common ones

This commit is contained in:
Yassine Guedidi 2025-02-23 10:44:50 +01:00
parent 1e61a51e82
commit 63cf403eaf
3 changed files with 7 additions and 22 deletions

View file

@ -27,7 +27,7 @@ import './js/highlight';
/* Tools */ /* Tools */
import { import {
savePercent, retrievePercent, initExport, initFilters, initPreviewText, savePercent, retrievePercent, initPreviewText,
} from './js/tools'; } from './js/tools';
/* Import shortcuts */ /* Import shortcuts */
@ -273,7 +273,10 @@ const articleScroll = () => {
$(document).ready(() => { $(document).ready(() => {
// sidenav // sidenav
$('.sidenav').sidenav(); document.querySelectorAll('.sidenav').forEach((element) => {
$(element).sidenav({ edge: element.getAttribute('data-edge') ?? 'left' });
});
$('select').formSelect(); $('select').formSelect();
$('.collapsible[data-collapsible="accordion"]').collapsible(); $('.collapsible[data-collapsible="accordion"]').collapsible();
$('.collapsible[data-collapsible="expandable"]').collapsible({ $('.collapsible[data-collapsible="expandable"]').collapsible({
@ -291,8 +294,6 @@ $(document).ready(() => {
$('.tooltipped').tooltip(); $('.tooltipped').tooltip();
$('.fixed-action-btn').floatingActionButton(); $('.fixed-action-btn').floatingActionButton();
initFilters();
initExport();
stickyNav(); stickyNav();
articleScroll(); articleScroll();
initPreviewText(); initPreviewText();

View file

@ -31,20 +31,6 @@ function retrievePercent(id, resized) {
return true; return true;
} }
function initFilters() {
// no display if filters not available
if ($('div').is('#filters')) {
$('#filters.sidenav').sidenav({ edge: 'right' });
}
}
function initExport() {
// no display if export not available
if ($('div').is('#export')) {
$('#export.sidenav').sidenav({ edge: 'right' });
}
}
function initPreviewText() { function initPreviewText() {
// no display if preview_text not available // no display if preview_text not available
if ($('div').is('#preview-article')) { if ($('div').is('#preview-article')) {
@ -64,7 +50,5 @@ function initPreviewText() {
export { export {
savePercent, savePercent,
retrievePercent, retrievePercent,
initExport,
initFilters,
initPreviewText, initPreviewText,
}; };

View file

@ -114,7 +114,7 @@
<!-- Export --> <!-- Export -->
{% if has_exports and is_granted('EXPORT_ENTRIES') %} {% if has_exports and is_granted('EXPORT_ENTRIES') %}
<div id="export" class="sidenav"> <div id="export" class="sidenav" data-edge="right">
{% set current_tag = null %} {% set current_tag = null %}
{% if tag is defined %} {% if tag is defined %}
{% set current_tag = tag.slug %} {% set current_tag = tag.slug %}
@ -140,7 +140,7 @@
<!-- Filters --> <!-- Filters -->
{% if has_filters %} {% if has_filters %}
<div id="filters" class="sidenav"> <div id="filters" class="sidenav" data-edge="right">
<form action="{{ path('all') }}"> <form action="{{ path('all') }}">
<h4 class="center">{{ 'entry.filters.title'|trans }}</h4> <h4 class="center">{{ 'entry.filters.title'|trans }}</h4>