mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
Basic dark theme handling
This commit is contained in:
parent
7f49e5cd1b
commit
a562f6b943
16 changed files with 165 additions and 11 deletions
|
@ -34,6 +34,7 @@ menu:
|
|||
site_credentials: Accès aux sites
|
||||
ignore_origin_instance_rules: "Règles globales d'omission d'origine"
|
||||
quickstart: "Pour bien débuter"
|
||||
theme_toggle: "Changer le thème"
|
||||
top:
|
||||
add_new_entry: Sauvegarder un nouvel article
|
||||
search: Rechercher
|
||||
|
@ -273,6 +274,7 @@ entry:
|
|||
delete_public_link: Supprimer le lien public
|
||||
export: Exporter
|
||||
print: Imprimer
|
||||
theme_toggle: Changer le thème
|
||||
problem:
|
||||
label: Un problème ?
|
||||
description: Est-ce que cet article s’affiche mal ?
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!--[if lte IE 7]><html class="no-js ie7 ie67 ie678"{% if lang is not empty %} lang="{{ lang }}"{% endif %}><![endif]-->
|
||||
<!--[if IE 8]><html class="no-js ie8 ie678"{% if lang is not empty %} lang="{{ lang }}"{% endif %}><![endif]-->
|
||||
<!--[if gt IE 8]><html class="no-js"{% if lang is not empty %} lang="{{ lang }}"{% endif %}><![endif]-->
|
||||
<html{% if lang is not empty %} lang="{{ lang }}"{% endif %}>
|
||||
<html{% if lang is not empty %} class="{{ theme_class() }}" lang="{{ lang }}"{% endif %}>
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
|
|
|
@ -97,6 +97,12 @@
|
|||
<div class="collapsible-body"></div>
|
||||
</li>
|
||||
|
||||
<li class="bold">
|
||||
<a class="waves-effect collapsible-header js-theme-toggle">
|
||||
<i class="material-icons small">brightness_medium</i>
|
||||
<span>{{ 'entry.view.left_menu.theme_toggle'|trans }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if craue_setting('share_public')
|
||||
or craue_setting('share_twitter')
|
||||
or craue_setting('share_shaarli')
|
||||
|
|
|
@ -117,6 +117,13 @@
|
|||
<li><a href="{{ path('site_credentials_index') }}"><i class="material-icons">vpn_key</i> {{ 'menu.left.site_credentials'|trans }}</a></li>
|
||||
{% endif %}
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a class="waves-effect js-theme-toggle">
|
||||
<i class="material-icons small">brightness_medium</i>
|
||||
<span>{{ 'menu.left.theme_toggle'|trans }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
<li><a href="{{ path('user_index') }}"><i class="material-icons">people</i>{{ 'menu.left.users_management'|trans }}</a></li>
|
||||
<li><a href="{{ path('craue_config_settings_modify') }}"><i class="material-icons">settings</i> {{ 'menu.left.internal_settings'|trans }}</a></li>
|
||||
|
|
|
@ -51,6 +51,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
|
|||
new TwigFunction('count_tags', [$this, 'countTags']),
|
||||
new TwigFunction('display_stats', [$this, 'displayStats']),
|
||||
new TwigFunction('asset_file_exists', [$this, 'assetFileExists']),
|
||||
new TwigFunction('theme_class', [$this, 'themeClass']),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -171,6 +172,11 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
|
|||
return file_exists(realpath($this->rootDir . '/../web/' . $name));
|
||||
}
|
||||
|
||||
public function themeClass()
|
||||
{
|
||||
return isset($_COOKIE['theme']) && 'dark' === $_COOKIE['theme'] ? 'dark-theme' : '';
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'wallabag_extension';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue