From 9ecb93fe4f455d5b19fa469c19fe3da125e23a8d Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 4 Jun 2010 18:15:23 +0200 Subject: [PATCH] rename changes to actions --- lib/MojoFacets.pm | 2 +- lib/MojoFacets/{Changes.pm => Actions.pm} | 20 ++++++++-------- public/edit_table.js | 4 ++-- public/mojo_facets.css | 8 +++---- templates/{changes => actions}/edits.html.ep | 0 templates/{changes => actions}/index.html.ep | 24 ++++++++++---------- templates/{changes => actions}/view.html.ep | 0 templates/admin.html.ep | 8 +++---- 8 files changed, 33 insertions(+), 33 deletions(-) rename lib/MojoFacets/{Changes.pm => Actions.pm} (81%) rename templates/{changes => actions}/edits.html.ep (100%) rename templates/{changes => actions}/index.html.ep (64%) rename templates/{changes => actions}/view.html.ep (100%) diff --git a/lib/MojoFacets.pm b/lib/MojoFacets.pm index e68fde8..9a5b315 100644 --- a/lib/MojoFacets.pm +++ b/lib/MojoFacets.pm @@ -28,7 +28,7 @@ sub save_tx { $time = $time_travel; } - my $path = '/tmp/changes/'; + my $path = '/tmp/actions/'; mkdir $path unless -e $path; $path .= sprintf '%.4f.%s', $time, join('.', @$parts); diff --git a/lib/MojoFacets/Changes.pm b/lib/MojoFacets/Actions.pm similarity index 81% rename from lib/MojoFacets/Changes.pm rename to lib/MojoFacets/Actions.pm index 1fb2cde..3e3f278 100644 --- a/lib/MojoFacets/Changes.pm +++ b/lib/MojoFacets/Actions.pm @@ -1,4 +1,4 @@ -package MojoFacets::Changes; +package MojoFacets::Actions; use strict; use warnings; @@ -18,28 +18,28 @@ sub index { my $actions; - my $changes; - foreach my $path ( sort { $b cmp $a } glob '/tmp/changes/*' ) { + my $stats; + foreach my $path ( sort { $b cmp $a } glob '/tmp/actions/*' ) { if ( $path =~ m{/((\d+\.\d+)\.data\.(.+))$} ) { my ( $uid, $t, $action ) = ( $1, $2, $3 ); - $actions->{$action}++; + $stats->{$action}++; next if $action_regex && $action !~ m/^($action_regex)$/; - push @$changes, { uid => $uid, t => $t, action => $action } - if $#$changes < $max; + push @$actions, { uid => $uid, t => $t, action => $action } + if $#$actions < $max; } else { warn "ignore: $path\n"; } } - # Render template "changes/index.html.ep" with message - $self->render(message => 'Latest Changes', changes => $changes, actions => $actions ); + # Render template "actions/index.html.ep" with message + $self->render(actions => $actions, stats => $stats ); } sub view { my $self = shift; my $uid = $self->param('uid'); - $self->render( change => retrieve( "/tmp/changes/$uid" ), uid => $uid ); + $self->render( change => retrieve( "/tmp/actions/$uid" ), uid => $uid ); } sub _edit_path { @@ -95,7 +95,7 @@ sub edit { unlink $self->_edit_path . '/' . $t; } - $self->redirect_to('/changes/edits'); + $self->redirect_to('/actions/edits'); } 1; diff --git a/public/edit_table.js b/public/edit_table.js index 03a1ad8..5c8d00d 100644 --- a/public/edit_table.js +++ b/public/edit_table.js @@ -32,8 +32,8 @@ var cell_blur = function() { if ( ! data ) { data = new_content; // fallback to submited data for 304 } else { - if ( $('a.save_changes').length == 0 ) - $('a.changes').before('save') + if ( $('a.save_actions').length == 0 ) + $('a.actions').before('save') } var vals = data.split('¶'); data = vals.join('¶'); diff --git a/public/mojo_facets.css b/public/mojo_facets.css index 25b0747..3db2795 100644 --- a/public/mojo_facets.css +++ b/public/mojo_facets.css @@ -48,11 +48,11 @@ span.h { font-weight: bold; } -.admin .changes { +.admin .actions { float: right; } -.admin .save_changes { +.admin .save_actions { float: right; color: #f00; padding-left: 1em; @@ -164,7 +164,7 @@ a.facet { text-decoration: none; } -/* /changes */ +/* /actions */ .change_box { border: 3px dashed #f84; } @@ -174,7 +174,7 @@ a.facet { text-decoration: line-through; } -/* /changes/edits */ +/* /actions/edits */ tr.edit pre { color: #000; diff --git a/templates/changes/edits.html.ep b/templates/actions/edits.html.ep similarity index 100% rename from templates/changes/edits.html.ep rename to templates/actions/edits.html.ep diff --git a/templates/changes/index.html.ep b/templates/actions/index.html.ep similarity index 64% rename from templates/changes/index.html.ep rename to templates/actions/index.html.ep index 8366dc6..431e9b7 100644 --- a/templates/changes/index.html.ep +++ b/templates/actions/index.html.ep @@ -1,32 +1,32 @@ % layout 'ui'; -

<%= $message %>

+

Latest actions

- + - +
-% foreach my $change ( @$changes ) { +% foreach my $action ( @$actions ) { % }
actiontimestamp
-<%= $change->{action} %> +<%= $action->{action} %> -<%= $change->{t} %> +<%= $action->{t} %>
-% my $more = ( $#$changes ) * 10; -Show <%= $more %> changes +% my $more = ( $#$actions ) * 10; +Show <%= $more %> actions