Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gin
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
gin
Commits
c32c1442
Commit
c32c1442
authored
1 year ago
by
Jim Vomero
Committed by
Sascha Eggenberger
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3387653
: Config-import does not change theme to dark mode as value is set in localStorage
parent
0c1ed63c
No related branches found
No related tags found
1 merge request
!304
Issue #3387653: Config-import does not change theme to dark mode as value is set in localStorage
Pipeline
#169535
passed
1 year ago
Stage: build
Stage: test
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dist/js/init.js
+1
-1
1 addition, 1 deletion
dist/js/init.js
includes/page.theme
+1
-0
1 addition, 0 deletions
includes/page.theme
js/init.js
+5
-2
5 additions, 2 deletions
js/init.js
with
7 additions
and
3 deletions
dist/js/init.js
+
1
−
1
View file @
c32c1442
...
...
@@ -5,7 +5,7 @@
if
(
localStorage
.
getItem
(
"
GinDarkMode
"
)
&&
(
localStorage
.
setItem
(
"
Drupal.gin.darkmode
"
,
localStorage
.
getItem
(
"
GinDarkMode
"
)),
localStorage
.
removeItem
(
"
GinDarkMode
"
)),
localStorage
.
getItem
(
"
GinSidebarOpen
"
)
&&
(
localStorage
.
setItem
(
"
Drupal.gin.toolbarExpanded
"
,
localStorage
.
getItem
(
"
GinSidebarOpen
"
)),
localStorage
.
removeItem
(
"
GinSidebarOpen
"
)),
ginInitDarkmode
(),
window
.
addEventListener
(
"
DOMContentLoaded
"
,
(()
=>
{
localStorage
.
getItem
(
"
Drupal.gin.darkmode
"
)
||
(
localStorage
.
setItem
(
"
Drupal.gin.darkmode
"
,
drupalSettings
.
gin
.
darkmode
),
localStorage
.
getItem
(
"
Drupal.gin.darkmode
"
)
&&
(
drupalSettings
.
gin
.
darkmode
==
localStorage
.
getItem
(
"
Drupal.gin.darkmode
"
)
||
drupalSettings
.
gin
.
show_user_theme_settings
)
||
(
localStorage
.
setItem
(
"
Drupal.gin.darkmode
"
,
drupalSettings
.
gin
.
darkmode
),
ginInitDarkmode
());
})),
localStorage
.
getItem
(
"
Drupal.gin.toolbarExpanded
"
))
{
const
style
=
document
.
createElement
(
"
style
"
),
className
=
"
gin-toolbar-inline-styles
"
;
...
...
This diff is collapsed.
Click to expand it.
includes/page.theme
+
1
−
0
View file @
c32c1442
...
...
@@ -79,6 +79,7 @@ function gin_page_attachments_alter(&$page) {
$page
[
'#attached'
][
'drupalSettings'
][
'gin'
][
'highcontrastmode'
]
=
$settings
->
get
(
'high_contrast_mode'
);
$page
[
'#attached'
][
'drupalSettings'
][
'gin'
][
'highcontrastmode_class'
]
=
'gin--high-contrast-mode'
;
$page
[
'#attached'
][
'drupalSettings'
][
'gin'
][
'toolbar_variant'
]
=
$settings
->
get
(
'classic_toolbar'
);
$page
[
'#attached'
][
'drupalSettings'
][
'gin'
][
'show_user_theme_settings'
]
=
$settings
->
get
(
'show_user_theme_settings'
);
// Expose stylesheets to JS.
$basethemeurl
=
'/'
.
\Drupal
::
service
(
'extension.list.theme'
)
->
getPath
(
'gin'
);
...
...
This diff is collapsed.
Click to expand it.
js/init.js
+
5
−
2
View file @
c32c1442
...
...
@@ -32,9 +32,12 @@ function ginInitDarkmode() {
ginInitDarkmode
();
// GinDarkMode is not set yet.
// GinDarkMode is not set yet
or config changes detected
.
window
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
if
(
!
localStorage
.
getItem
(
'
Drupal.gin.darkmode
'
))
{
if
(
!
localStorage
.
getItem
(
'
Drupal.gin.darkmode
'
)
||
(
drupalSettings
.
gin
.
darkmode
!=
localStorage
.
getItem
(
'
Drupal.gin.darkmode
'
)
&&
!
drupalSettings
.
gin
.
show_user_theme_settings
)
)
{
localStorage
.
setItem
(
'
Drupal.gin.darkmode
'
,
drupalSettings
.
gin
.
darkmode
);
ginInitDarkmode
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment