[Bps-public-commit] App-Changeloggr branch, master, updated. 0ae2f9e1ca83bdb8467bcfb5d6bfa8356c4d75e7

sartak at bestpractical.com sartak at bestpractical.com
Tue Jun 9 11:25:08 EDT 2009


The branch, master has been updated
       via  0ae2f9e1ca83bdb8467bcfb5d6bfa8356c4d75e7 (commit)
      from  eb12360a5c612191b7a61ed46d9abb9ebfe19829 (commit)

Summary of changes:
 lib/App/Changeloggr/Action/UndoVote.pm |   13 +++++++++++++
 lib/App/Changeloggr/View.pm            |   10 ++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 lib/App/Changeloggr/Action/UndoVote.pm

- Log -----------------------------------------------------------------
commit 0ae2f9e1ca83bdb8467bcfb5d6bfa8356c4d75e7
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Jun 9 11:25:01 2009 -0400

    UndoVote action and UI

diff --git a/lib/App/Changeloggr/Action/UndoVote.pm b/lib/App/Changeloggr/Action/UndoVote.pm
new file mode 100644
index 0000000..1df967c
--- /dev/null
+++ b/lib/App/Changeloggr/Action/UndoVote.pm
@@ -0,0 +1,13 @@
+package App::Changeloggr::Action::UndoVote;
+use strict;
+use warnings;
+use base 'Jifty::Action';
+
+sub take_action {
+    my $self = shift;
+    my $user = Jifty->web->current_user->user_object;
+    $user->undo_vote;
+}
+
+1;
+
diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index f7a20c9..48275f4 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -293,6 +293,16 @@ sub show_vote_form {
             onclick     => { submit => $vote, refresh_self => 1 },
             arguments   => { tag => '_skip' },
         );
+
+        my $user = Jifty->web->current_user->user_object;
+        if ($user->votes->count) {
+            my $undo = new_action('UndoVote');
+            $undo->button(
+                class   => "vote",
+                label   => "Undo previous vote",
+                onclick => { submit => $undo, refresh_self => 1 },
+            );
+        }
     }
 }
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list