[Rt-commit] rt branch, 4.0/move-default-js-out-of-config, created. rt-4.0.2-190-g6ebbd12

? sunnavy sunnavy at bestpractical.com
Fri Oct 14 23:56:25 EDT 2011


The branch, 4.0/move-default-js-out-of-config has been created
        at  6ebbd1299935db294b71e2523951bed2e8cc6b6b (commit)

- Log -----------------------------------------------------------------
commit 6ebbd1299935db294b71e2523951bed2e8cc6b6b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 15 11:17:58 2011 +0800

    move default js files out of config.
    
    "JSFiles" config should behavior like "CSSFiles", i.e.
    include additional js files only.  see also #18583
    
    you can use RT::Interface::Web->JSFiles() to get the list of all js files.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 2604f21..db1e09a 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -861,27 +861,11 @@ Set($CanonicalizeRedirectURLs, 0);
 
 =item C<@JSFiles>
 
-A list of JavaScript files to be included in head.  Removing any of
-the default entries is not suggested.
-
-=cut
-
-Set(@JSFiles, qw/
-    jquery-1.4.2.min.js
-    jquery_noconflict.js
-    jquery-ui-1.8.4.custom.min.js
-    jquery-ui-patch-datepicker.js
-    ui.timepickr.js
-    titlebox-state.js
-    util.js
-    userautocomplete.js
-    jquery.event.hover-1.0.js
-    superfish.js
-    supersubs.js
-    jquery.supposition.js
-    history-folding.js
-    late.js
-/);
+A list of additional JavaScript files to be included in head.
+
+=cut
+
+Set(@JSFiles, qw//);
 
 =item C<$JSMinPath>
 
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 9e7e141..ce40d37 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -99,6 +99,29 @@ sub SquishedJS {
     return $js;
 }
 
+=head2 JSFiles
+
+=cut
+
+sub JSFiles {
+    return qw/
+      jquery-1.4.2.min.js
+      jquery_noconflict.js
+      jquery-ui-1.8.4.custom.min.js
+      jquery-ui-patch-datepicker.js
+      ui.timepickr.js
+      titlebox-state.js
+      util.js
+      userautocomplete.js
+      jquery.event.hover-1.0.js
+      superfish.js
+      supersubs.js
+      jquery.supposition.js
+      history-folding.js
+      late.js
+      /, RT->Config->Get('JSFiles');
+}
+
 =head2 ClearSquished
 
 Removes the cached CSS and JS entries, forcing them to be regenerated
diff --git a/lib/RT/Squish/JS.pm b/lib/RT/Squish/JS.pm
index 4841a9c..4400ef7 100644
--- a/lib/RT/Squish/JS.pm
+++ b/lib/RT/Squish/JS.pm
@@ -75,7 +75,7 @@ sub Squish {
     my $self    = shift;
     my $content;
 
-    for my $file ( RT->Config->Get('JSFiles') ) {
+    for my $file ( RT::Interface::Web->JSFiles ) {
         $content .= $HTML::Mason::Commands::m->scomp("/NoAuth/js/$file");
     }
 
diff --git a/share/html/Elements/HeaderJavascript b/share/html/Elements/HeaderJavascript
index 2abe5a6..6391a1e 100644
--- a/share/html/Elements/HeaderJavascript
+++ b/share/html/Elements/HeaderJavascript
@@ -77,7 +77,7 @@ $RichText => 1
 
 my @js_files;
 if ( RT->Config->Get('DevelMode') ) {
-    @js_files = RT->Config->Get('JSFiles' );
+    @js_files = RT::Interface::Web->JSFiles();
 }
 else {
     my $key = RT::Interface::Web::SquishedJS()->Key;

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


More information about the Rt-commit mailing list