[Jifty-commit] r2749 - in jifty/branches/template-declare: . lib
share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Feb 1 16:37:06 EST 2007
Author: jesse
Date: Thu Feb 1 16:37:05 2007
New Revision: 2749
Modified:
jifty/branches/template-declare/ (props changed)
jifty/branches/template-declare/lib/Jifty.pm
jifty/branches/template-declare/lib/Jifty/Manual/PageRegions.pod
jifty/branches/template-declare/share/web/static/js/jifty_utils.js
Log:
r21685 at hualien (orig r2726): audreyt | 2007-01-30 03:52:08 +1300
* Jifty.pm - Instead of randol popping @ISA (which works only if
Class::Accessor::Fast is somehow in the inheritance chain leading
up to WithFilter.pm), do an explicit pop.
r21712 at hualien (orig r2737): hlb | 2007-01-31 10:37:18 +1300
* fix JScript conditional compilation bug. Jifty.Utils.isMSIE works now.
r21729 at hualien (orig r2747): ruz | 2007-02-01 12:54:11 +1300
* add an example with regions
Modified: jifty/branches/template-declare/lib/Jifty.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty.pm (original)
+++ jifty/branches/template-declare/lib/Jifty.pm Thu Feb 1 16:37:05 2007
@@ -120,9 +120,11 @@
# Now that we've loaded the configuration, we can remove the temporary
# Jifty::DBI::Record baseclass for records and insert our "real" baseclass,
# which is likely Record::Cachable or Record::Memcached
- pop @Jifty::Record::ISA;
- Jifty::Util->require( Jifty->config->framework('Database')->{'RecordBaseClass'});
- push @Jifty::Record::ISA, Jifty->config->framework('Database')->{'RecordBaseClass'};
+ @Jifty::Record::ISA = grep { $_ ne 'Jifty::DBI::Record' } @Jifty::Record::ISA;
+
+ my $record_base_class = Jifty->config->framework('Database')->{'RecordBaseClass'};
+ Jifty::Util->require( $record_base_class );
+ push @Jifty::Record::ISA, $record_base_class unless $record_base_class eq 'Jifty::Record';
Jifty->logger( Jifty::Logger->new( $args{'logger_component'} ) );
Modified: jifty/branches/template-declare/lib/Jifty/Manual/PageRegions.pod
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Manual/PageRegions.pod (original)
+++ jifty/branches/template-declare/lib/Jifty/Manual/PageRegions.pod Thu Feb 1 16:37:05 2007
@@ -168,4 +168,69 @@
which were mapped by the request mapper. Finally, it displays
any messages and errors from actions.
+=head2 EXAMPLES
+
+=head3 Hidden information that shows after click on a link
+
+It's ofetn required to hide some extra information, a list of objects
+or something else under a link. User clicks on the link and the
+information you're hiding shows up instead of the link. Regions could
+help you to do this task very easy.
+
+First of all you'll need a region's component F<templates/additional_info>:
+
+ <%args>
+ $collapsed => 1
+ ... some other arguments required to show correct info ...
+ </%args>
+ % if ( $collapsed ) {
+ <% Jifty->web->link(
+ label => _('text of the link'),
+ onclick => {
+ refresh_self => 1,
+ args => { %ARGS, collapsed => 0 },
+ },
+ ) %>
+ % } else {
+ .... here we show our additional info ...
+ % }
+
+In this component we have one argument C<$collapsed> that controls either
+we show link or information. By default we prefer hidden state and in this
+case we show only the link with an C<onclick> action that refreshes the
+current region, however value of the argument is overriden.
+
+You can add any arguments you want to this component that may be required
+to show the additional information, for example an id of some object, but
+you should remeber to use this arguments during links generation.
+
+Next thing you should do is to add a region to some page:
+
+ ... and region:
+ <% Jifty->web->region(
+ name => 'block_name',
+ path => '/additional_info',
+ defaults => { ... some args required to show the info ... },
+ ) %>
+ ... other information on the page
+
+That's all. Things should just work.
+
+Smarty ones should mention that the link disappears after click, but may
+be you want show/hide functionality. This is very easy task when we know how
+to use links generation. In the component's else branch add:
+
+ % } else {
+ <% Jifty->web->link(
+ label => _('text of the link that hides'),
+ onclick => {
+ refresh_self => 1,
+ args => { %ARGS, collapsed => 1 },
+ },
+ ) %>
+ .... here we show our additional info ...
+ % }
+
+Wow! Works again. Enjoy.
+
=cut
Modified: jifty/branches/template-declare/share/web/static/js/jifty_utils.js
==============================================================================
--- jifty/branches/template-declare/share/web/static/js/jifty_utils.js (original)
+++ jifty/branches/template-declare/share/web/static/js/jifty_utils.js Thu Feb 1 16:37:05 2007
@@ -141,7 +141,7 @@
};
/* This sets Jifty.Utils.isMSIE to true in IE */
-/*@cc_on
+/* @cc_on
Jifty.Utils.isMSIE = true;
@*/
More information about the Jifty-commit
mailing list