[Bps-public-commit] r9186 - in SVKUI: . trunk/share/web/templates

clsung at bestpractical.com clsung at bestpractical.com
Mon Oct 1 05:15:54 EDT 2007


Author: clsung
Date: Mon Oct  1 05:15:23 2007
New Revision: 9186

Added:
   SVKUI/trunk/share/web/templates/svksync
Modified:
   SVKUI/   (props changed)
   SVKUI/trunk/lib/SVKUI/Dispatcher.pm
   SVKUI/trunk/lib/SVKUI/View.pm

Log:
 r9274 at going04:  clsung | 2007-10-01 16:53:01 +0800
 - move svk syncing code to templates/svksync, 
   - try to ajax it
 r9275 at going04:  clsung | 2007-10-01 17:10:07 +0800
 - onclick triggers ajax
 r9276 at going04:  clsung | 2007-10-01 17:14:50 +0800
 - refine template


Modified: SVKUI/trunk/lib/SVKUI/Dispatcher.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Dispatcher.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/Dispatcher.pm	Mon Oct  1 05:15:23 2007
@@ -49,6 +49,13 @@
     show '/projects';
 };
 
+on qr'^/index2/?$' => run {
+    my $projects = SVKUI::Model::ProjectCollection->new();
+    $projects->unlimit();
+    set projects => $projects;
+    show '/index2';
+};
+
 on qr'^/project/([^/]+)/?$' => run {
     my $name    = $1;
     warn "Got project $1";

Modified: SVKUI/trunk/lib/SVKUI/View.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/View.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/View.pm	Mon Oct  1 05:15:23 2007
@@ -94,6 +94,7 @@
     unless ($project->id) {
         redirect '/';
     }
+    warn "sync/view entering...";
     title { _('Sync project') };
     h2 { _('Information') };
 #    outs_raw(
@@ -102,24 +103,25 @@
 	{ id is 'jifty-result-popup' }
     };
     Jifty->web->region (name => 'message', path => '/__jifty/empty');
-    if ($project->synced) {
-	dl { 
-	    dt {'This project already synced' }
+    Jifty->web->region (name => 'syncing', path => '/svksync');
+#    if ($project->synced) {
+#	dl { 
+#	    dt {'This project already synced' }
 	    #set(message => 'yoyo');show('notify');
-	    SVKUI::Event::Notification->new( 'haha' )->publish;
-	    dt {Jifty->web->link( url => '/project/'.$project->name, label => "Go to project page");}
-	}
-    } else {
-	set(message => 'test');show('notify');
+#	    SVKUI::Event::Notification->new( 'haha' )->publish;
+#	    dt {Jifty->web->link( url => '/project/'.$project->name, label => "Go to project page");}
+#	}
+#    } else {
+#	set(message => 'test');show('notify');
 	#SVKUI::Event::Notification->new( 'ahaha' )->publish;
-	if ($project->try_sync()) {
-	    redirect '/__jifty/error/sync_failed';
-	}
-	dl { 
-	    dt {'This project synced' }
+#	if ($project->try_sync()) {
+#	    redirect '/__jifty/error/sync_failed';
+#	}
+#	dl { 
+#	    dt {'This project synced' }
 	    #    blockquote { SVKUI->output };
-	};
-    }
+#	};
+#    }
 
 };
 

Added: SVKUI/trunk/share/web/templates/svksync
==============================================================================
--- (empty file)
+++ SVKUI/trunk/share/web/templates/svksync	Mon Oct  1 05:15:23 2007
@@ -0,0 +1,27 @@
+<%args>
+$project_name
+$dosync => 0
+</%args>
+<%init>
+my $project = SVKUI::Model::Project->new();
+$project->load_by_cols( name => $project_name );
+my $message = '';
+if ($project->id and $dosync) {
+    if ($project->try_sync()) {
+	$message = 'sync failed';
+    } else {
+	$message = 'success';
+    }
+}
+</%init>
+% if ($dosync > 0) {
+<h3>Syncing project <% $project_name %> ... </h3>
+% } else {
+<h3><% $project_name %> does not synced... </h3>
+% }
+<% $message %>
+% if ($project->synced == 1) {
+<% Jifty->web->link( label => "Project synced", url => '/project/'.$project->name ) %>
+% } elsif ($dosync == 0) {
+<% Jifty->web->link( label => "Sync $project_name", onclick => { args => { project_name => $project_name, dosync => 1 } } ) %>
+% }



More information about the Bps-public-commit mailing list