[Catalyst] Sharing code / Feedback request: TT macro for uri_for([current uri]); same page links

2006-10-21 Thread apv
Something common that irritates me on sites is links on a page which  
point to the page they're on.

Say you're viewing / (home) and there are links which go to / --  
not sensible. The following macro, link, disables them with JS  
(makes more sense semantically than not using a tags) and adds a  
CSS class so they can be made to look different, or disappear  
altogether.

Does it look like a good way to do it? Improvements?

[% MACRO link(path,title) BLOCK %]
[% FILTER trim %]
[% IF Catalyst.uri_for(/, Catalyst.request.path) == Catalyst.uri_for 
(path)  %]
a title=The current page class=current href=javascript:void 
(0);[% title | html_entity %]/a
[% ELSE  %]
a title=[% title | truncate(50,hellip;) | html_entity %]  
href=[% Catalyst.uri_for(path) %][% title | html_entity %]/a
[% END %]
[% END %]
[% END %]


-Ashley

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Sharing code / Feedback request: TT macro for uri_for([current uri]); same page links

2006-10-21 Thread A. Pagaltzis
* Jonathan Rockway [EMAIL PROTECTED] [2006-10-22 05:20]:
 Here's a way that doesn't require javascript.
 
 http://blog.jrock.us/articles/Quantum Physics and the Template Toolkit.pod

You mean
http://blog.jrock.us/articles/Quantum%20Physics%20and%20the%20Template%20Toolkit.pod

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Sharing code / Feedback request: TT macro for uri_for([current uri]); same page links

2006-10-21 Thread Bill Moseley
On Sat, Oct 21, 2006 at 06:46:21PM -0700, apv wrote:
 Something common that irritates me on sites is links on a page which  
 point to the page they're on.

Not sure I see that as a problem.  And sometimes it can be nice (say
when search results added limits to the page).  I leave them links by
style them differently.

The TT badger book has a chapter on building menus that you might find
helpful.

-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/