[Jifty-commit] r3370 - in jifty/branches/js-refactor: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jun 6 18:22:35 EDT 2007
Author: trs
Date: Wed Jun 6 18:22:33 2007
New Revision: 3370
Modified:
jifty/branches/js-refactor/ (props changed)
jifty/branches/js-refactor/lib/Jifty/Web.pm
Log:
r21744 at zot (orig r3369): trs | 2007-06-06 18:20:52 -0400
r21743 at zot: tom | 2007-06-06 18:20:23 -0400
add_javascript method to simplify adding JS libs and updated doc
Modified: jifty/branches/js-refactor/lib/Jifty/Web.pm
==============================================================================
--- jifty/branches/js-refactor/lib/Jifty/Web.pm (original)
+++ jifty/branches/js-refactor/lib/Jifty/Web.pm Wed Jun 6 18:22:33 2007
@@ -1085,15 +1085,17 @@
However if you want to include other javascript libraries you need to
add them to the javascript_libs array of your application. Do this in
-the C<start> sub of your main application class. For example if your application is Foo then in L<lib/Foo.pm>
+the C<start> sub of your main application class. For example if your
+application is Foo then in L<lib/Foo.pm>
sub start {
- Jifty->web->javascript_libs([
- @{ Jifty->web->javascript_libs },
- "yourJavascriptLib.js",
- ]);
+ Jifty->web->add_javascript(qw( jslib1.js jslib2.js ) );
}
+The L<add_javascript> method will append the files to javascript_libs.
+If you need a different order, you'll have to massage javascript_libs
+directly.
+
Jifty will look for javascript libraries under share/web/static/js/ by
default.
@@ -1189,6 +1191,20 @@
}
}
+=head3 add_javascript FILE1, FILE2, ...
+
+Pushes files onto C<Jifty->web->javascript_libs>
+
+=cut
+
+sub add_javascript {
+ my $self = shift;
+ Jifty->web->javascript_libs([
+ @{ Jifty->web->javascript_libs },
+ @_
+ ]);
+}
+
=head2 STATE VARIABLES
=head3 get_variable NAME
More information about the Jifty-commit
mailing list