-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9094487
Showing
25 changed files
with
3,743 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
blib* | ||
Makefile | ||
Makefile.old | ||
pm_to_blib* | ||
*.tar.gz | ||
.lwpcookies | ||
cover_db | ||
pod2htm*.tmp | ||
/RT-Extension-ToggleTheme* | ||
*.bak | ||
*.swp | ||
/MYMETA.* | ||
/t/tmp | ||
/xt/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Revision history for RT-Extension-ToggleTheme | ||
|
||
0.01 08-28-2020 | ||
- Initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
abstract: 'RT-Extension-ToggleTheme Extension' | ||
author: | ||
- 'Craig Kaiser <[email protected]>' | ||
build_requires: | ||
ExtUtils::MakeMaker: 6.59 | ||
configure_requires: | ||
ExtUtils::MakeMaker: 6.59 | ||
distribution_type: module | ||
dynamic_config: 1 | ||
generated_by: 'Module::Install version 1.19' | ||
license: gpl_2 | ||
meta-spec: | ||
url: http://module-build.sourceforge.net/META-spec-v1.4.html | ||
version: 1.4 | ||
name: RT-Extension-ToggleTheme | ||
no_index: | ||
directory: | ||
- html | ||
- inc | ||
- static | ||
requires: | ||
perl: 5.10.1 | ||
resources: | ||
repository: https://github.com/bestpractical/rt-extension-toggletheme | ||
version: '0.01' | ||
x_module_install_rtx_version: '0.41' | ||
x_requires_rt: 4.4.0 | ||
x_rt_too_new: 5.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use lib '.'; | ||
use inc::Module::Install; | ||
|
||
RTx 'RT-Extension-ToggleTheme'; | ||
license 'gpl_2'; | ||
repository 'https://github.com/craigkai/rt-extension-toggletheme'; | ||
|
||
requires_rt '5.0.0'; | ||
rt_too_new '5.2.0'; | ||
|
||
sign; | ||
WriteAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
NAME | ||
RT-Extension-ToggleTheme - Toggle elevator light and dark theme. | ||
|
||
DESCRIPTION | ||
To save your eyes in the dark. | ||
|
||
RT VERSION | ||
Works with RT 5 | ||
|
||
INSTALLATION | ||
perl Makefile.PL | ||
make | ||
make install | ||
May need root permissions | ||
|
||
Edit your /opt/rt4/etc/RT_SiteConfig.pm | ||
Add this line: | ||
|
||
Plugin('RT::Extension::ToggleTheme'); | ||
|
||
Clear your mason cache | ||
rm -rf /opt/rt5/var/mason_data/obj | ||
|
||
Restart your webserver | ||
|
||
AUTHOR | ||
Craig Kaiser <[email protected]> | ||
|
20 changes: 20 additions & 0 deletions
20
html/Callbacks/RT-Extension-ToggleTheme/Elements/Header/MassageCSSFiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
<%init> | ||
my $style = $session{'CurrentUser'} | ||
? $session{'CurrentUser'}->Stylesheet | ||
: RT->Config->Get('WebDefaultStylesheet'); | ||
|
||
if ( RT->Config->Get('DevelMode') ) { | ||
if ( $style eq 'elevator-light' ) { | ||
push @{$CSSFiles}, "/static/css/elevator-dark/main.css"; | ||
} | ||
} | ||
elsif ( $style eq 'elevator-light' ) { | ||
my $key = RT::Interface::Web::SquishedCSS( 'elevator-dark' )->Key; | ||
push @{$CSSFiles}, "/NoAuth/css/$style/squished-$key.css"; | ||
} | ||
</%init> | ||
|
||
<%args> | ||
$CSSFiles | ||
</%args> |
13 changes: 13 additions & 0 deletions
13
html/Callbacks/RT-Extension-ToggleTheme/Elements/Tabs/Privileged
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<%init> | ||
# Only show theme toggle for either of the elevator themes light/dark | ||
if ( RT->Config->Get('WebDefaultStylesheet', $session{CurrentUser}) =~ /elevator-/ ) { | ||
my $theme = RT->Config->Get('WebDefaultStylesheet', $session{CurrentUser}) =~ /-dark$/ ? 'fa-sun' : 'fa-moon'; | ||
my $toggle = Menu->child( | ||
toggle => title => 'toggle_theme', | ||
raw_html => qq[<a href="javascript:" id="theme_toggle"><span id="theme_toggle_icon" class="].qq[fas $theme"></span></a>], | ||
sort_order => 100 | ||
); | ||
} | ||
</%init> | ||
<%args> | ||
</%args> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<%init> | ||
my $new_theme = RT->Config->Get('WebDefaultStylesheet', $session{'CurrentUser'}) =~ /-dark$/ ? 'elevator-light' : 'elevator-dark'; | ||
|
||
my ($ok, $msg) = $session{'CurrentUser'}->SetPreferences( $RT::System => { %{ $session{'CurrentUser'}->Preferences( $RT::System ) || {}}, WebDefaultStylesheet => $new_theme } ); | ||
RT::Logger->error( "$msg" ) unless $ok; | ||
|
||
$m->abort(); | ||
</%init> |
Oops, something went wrong.