[Bps-public-commit] App-Changeloggr branch, master, updated. 6f6b7187e39596f772e82ff988ec1f14c15d5806

sartak at bestpractical.com sartak at bestpractical.com
Wed Apr 1 14:36:41 EDT 2009


The branch, master has been updated
       via  6f6b7187e39596f772e82ff988ec1f14c15d5806 (commit)
      from  aa47fb86d6a6b8aa3b302b4b7739df5e48dadac1 (commit)

Summary of changes:
 lib/App/Changeloggr/View.pm |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 6f6b7187e39596f772e82ff988ec1f14c15d5806
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Apr 1 14:36:18 2009 -0400

    If the changelog has valid tags, then voting consists of clicking the
    particular tag button

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 6a40b63..7012ff9 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -128,16 +128,31 @@ sub show_change {
 sub show_vote_form {
     my $change = shift;
 
+    my $valid_tags = $change->changelog->tags;
+
     form {
         my $vote = new_action(
             class     => "CreateVote",
             arguments => { change => $change->id }
         );
-        render_action $vote ;
-        form_submit(
-            label   => 'Vote',
-            onclick => { submit => $vote, refresh_self => 1 }
-        );
+
+        if ($valid_tags->count == 0) {
+            render_action $vote;
+            form_submit(
+                label   => 'Vote',
+                onclick => { submit => $vote, refresh_self => 1 }
+            );
+        }
+        else {
+            render_action $vote, ['change'];
+            while (my $valid_tag = $valid_tags->next) {
+                form_submit(
+                    label => $valid_tag->text,
+                    onclick => { submit => $vote, refresh_self => 1 },
+                    parameters => { tag => $valid_tag->text },
+                );
+            }
+        }
     }
 }
 

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



More information about the Bps-public-commit mailing list