[Rt-commit] rt branch, 4.6-theme-trunk, updated. rt-4.4.4-176-g19983ce0c

? sunnavy sunnavy at bestpractical.com
Fri Apr 5 17:21:46 EDT 2019


The branch, 4.6-theme-trunk has been updated
       via  19983ce0c1cfabd663009ffeb3587adf9efc9e32 (commit)
      from  d3c438a8c8b01aec0d3d406740d2d349819c2d03 (commit)

Summary of changes:
 etc/RT_Config.pm.in     | 43 +++++++++++++++++++++++++++++++++++++++++++
 lib/RT/Interface/Web.pm | 39 +++++++--------------------------------
 2 files changed, 50 insertions(+), 32 deletions(-)

- Log -----------------------------------------------------------------
commit 19983ce0c1cfabd663009ffeb3587adf9efc9e32
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Apr 6 05:14:19 2019 +0800

    Add %ThemeJSFiles config to serve different js for different themes
    
    Usually people don't need to touch it, so its documentation is hidden
    intentionally.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index f4abf7d89..8cebfd240 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1061,6 +1061,49 @@ If you're a plugin author, refer to RT->AddStyleSheets.
 
 Set(@CSSFiles, qw//);
 
+=for comment
+=item C<%ThemeJSFiles>
+
+Define JavaScript files each theme should include.  I<base> is special as
+every theme will include files specified there.
+
+=cut
+
+Set(%ThemeJSFiles,
+    base => [
+        qw{jquery-1.12.4p1.min.js
+          jquery_noconflict.js
+          jquery-ui.min.js
+          jquery-ui-timepicker-addon.js
+          jquery-ui-patch-datepicker.js
+          jquery.modal.min.js
+          jquery.modal-defaults.js
+          jquery.cookie.js
+          titlebox-state.js
+          i18n.js
+          util.js
+          autocomplete.js
+          jquery.event.hover-1.0.js
+          superfish.js
+          supersubs.js
+          jquery.supposition.js
+          chosen.jquery.min.js
+          history-folding.js
+          cascaded.js
+          forms.js
+          event-registration.js
+          late.js
+          mousetrap.min.js
+          keyboard-shortcuts.js
+          assets.js
+          /static/RichText/ckeditor.js
+          dropzone.min.js
+          }
+    ],
+    'elevator-light' => [qw{popper.min.js bootstrap.min.js bootstrap-select.min.js}],
+    'elevator-dark'  => [qw{popper.min.js bootstrap.min.js bootstrap-select.min.js}],
+);
+
 =item C<$UsernameFormat>
 
 This determines how user info is displayed. 'concise' will show the
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 0b3566a19..096ab96cf 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -109,38 +109,13 @@ sub SquishedJS {
 =cut
 
 sub JSFiles {
-    return qw{
-      jquery-1.12.4p1.min.js
-      jquery_noconflict.js
-      jquery-ui.min.js
-      jquery-ui-timepicker-addon.js
-      jquery-ui-patch-datepicker.js
-      jquery.modal.min.js
-      jquery.modal-defaults.js
-      jquery.cookie.js
-      popper.min.js
-      bootstrap.min.js
-      bootstrap-select.min.js
-      titlebox-state.js
-      i18n.js
-      util.js
-      autocomplete.js
-      jquery.event.hover-1.0.js
-      superfish.js
-      supersubs.js
-      jquery.supposition.js
-      chosen.jquery.min.js
-      history-folding.js
-      cascaded.js
-      forms.js
-      event-registration.js
-      late.js
-      mousetrap.min.js
-      keyboard-shortcuts.js
-      assets.js
-      /static/RichText/ckeditor.js
-      dropzone.min.js
-      }, RT->Config->Get('JSFiles');
+    my $theme_js     = RT->Config->Get('ThemeJSFiles');
+    my $current_user = $HTML::Mason::Commands::session{CurrentUser};
+    my @js = map { @{ $theme_js->{$_} || [] } } 'base',
+      RT->Config->Get( 'WebDefaultStylesheet', $current_user && $current_user->id ? $current_user : () );
+
+    push @js, RT->Config->Get('JSFiles');
+    return @js;
 }
 
 =head2 ClearSquished

-----------------------------------------------------------------------


More information about the rt-commit mailing list