[Jifty-commit] r6037 - in wifty/trunk: lib/Wifty share/web/templates
Jifty commits
jifty-commit at lists.jifty.org
Sat Nov 29 22:15:24 EST 2008
Author: ruz
Date: Sat Nov 29 22:15:24 2008
New Revision: 6037
Removed:
wifty/trunk/share/web/templates/_elements/page_nav
Modified:
wifty/trunk/lib/Wifty/Dispatcher.pm
wifty/trunk/share/web/templates/edit
wifty/trunk/share/web/templates/history
wifty/trunk/share/web/templates/view
Log:
* replace _elements/page_nav with a function in dispatcher
Modified: wifty/trunk/lib/Wifty/Dispatcher.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Dispatcher.pm (original)
+++ wifty/trunk/lib/Wifty/Dispatcher.pm Sat Nov 29 22:15:24 2008
@@ -35,6 +35,9 @@
my $page = Wifty::Model::Page->new();
$page->load_by_cols( name => $name );
Jifty->web->redirect( '/create/' . $name ) unless ( $page->id );
+
+ setup_page_nav($name, $rev);
+
my $revision = Wifty::Model::Revision->new();
$revision->load_by_cols( page => $page->id, id => $rev ) if ($rev);
set page => $page;
@@ -54,6 +57,8 @@
$page->load_by_cols( name => $name );
redirect( '/create/' . $name ) unless ( $page->id );
+ setup_page_nav($name);
+
my $revisions = $page->revisions;
$revisions->order_by( column => 'id', order => 'desc');
@@ -95,5 +100,15 @@
set pages => $pages;
};
+sub setup_page_nav {
+ my ($page, $rev) = @_;
+
+ my $subpath = $page . ($rev ? "/$rev" : '');
+ my $top = Jifty->web->page_navigation;
+ $top->child( View => url => '/view/'.$subpath);
+ $top->child( Edit => url => '/edit/'.$subpath);
+ $top->child( History => url => '/history/'.$page);
+ $top->child( Latest => url => '/view/'.$page) if $rev;
+}
1;
Modified: wifty/trunk/share/web/templates/edit
==============================================================================
--- wifty/trunk/share/web/templates/edit (original)
+++ wifty/trunk/share/web/templates/edit Sat Nov 29 22:15:24 2008
@@ -6,7 +6,6 @@
<%init>
my $can_edit = $page->current_user_can('update');
</%init>
-<&/_elements/page_nav, page => $page->name, rev => $revision->id &>
<&|/_elements/wrapper, title => 'Edit: '.$page->name . ($revision->id ? " as of ".$revision->created : ''), id => "update" &>
<% Jifty->web->form->start %>
<div class="form_wrapper">
Modified: wifty/trunk/share/web/templates/history
==============================================================================
--- wifty/trunk/share/web/templates/history (original)
+++ wifty/trunk/share/web/templates/history Sat Nov 29 22:15:24 2008
@@ -2,7 +2,6 @@
$page
$revisions
</%args>
-<& /_elements/page_nav, page => $page->name &>
<&|/_elements/wrapper, title => $revisions->count ." revisions of " .$page->name &>
<dl id="history">
% while (my $rev = $revisions->next) {
Modified: wifty/trunk/share/web/templates/view
==============================================================================
--- wifty/trunk/share/web/templates/view (original)
+++ wifty/trunk/share/web/templates/view Sat Nov 29 22:15:24 2008
@@ -3,7 +3,6 @@
$revision
$viewer
</%args>
-<& /_elements/page_nav, page => $page->name, rev => $revision->id &>
<&|/_elements/wrapper, title => $page->name . ($revision->id ? " as of ".$revision->created : '') &>
% if ($revision->id) {
More information about the Jifty-commit
mailing list