added /data/export
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 3 Jun 2010 12:25:51 +0000 (14:25 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 3 Jun 2010 12:38:09 +0000 (14:38 +0200)
lib/MojoFacets/Data.pm
templates/admin.html.ep
templates/data/export.html.ep [new file with mode: 0644]

index 466ea41..dffc48b 100644 (file)
@@ -846,4 +846,12 @@ sub save {
        $self->redirect_to( '/data/items' );
 }
 
+sub export {
+       my $self = shift;
+       $self->render( export => [
+               map { s{^.+/public/export/}{}; $_ }
+               glob( $self->_export_path . '*' )
+       ] );
+}
+
 1;
index 322b2c3..4e1f431 100644 (file)
@@ -14,7 +14,9 @@ items:
 % if ( my $path = session('save_path') ) {
 <a class=save_changes title="<%= $path %>" href="<%= url_for( controller => 'data', action => 'save', path => $path ) %>">save</a>
 % }
-
+% if ( $self->can('_export_path') && glob $self->_export_path('*') ) {
+<a href="<%= url_for( controller => 'data', action => 'export' ) %>">export</a>
+% }
 <a href="<%= url_for( controller => 'changes', action => 'edits' ) %>">edits</a>
 <a href="<%= url_for( controller => 'changes', action => 'index' ) %>">changes</a>
 </span>
diff --git a/templates/data/export.html.ep b/templates/data/export.html.ep
new file mode 100644 (file)
index 0000000..2333993
--- /dev/null
@@ -0,0 +1,9 @@
+% layout 'default';
+
+<ul>
+% foreach my $e ( @$export ) {
+<li><a target="<%= $e %>" href="/export/<%= $e %>"><%= $e %></a>
+% }
+</ul>
+
+<pre class=debug><%= dumper $export %></pre>