[Bps-public-commit] App-Changeloggr branch, master, updated. 71217e8a994ee69f222db68a204265c9fa53ecca

Alex M Vandiver alexmv at bestpractical.com
Wed May 27 17:55:05 EDT 2009


The branch, master has been updated
       via  71217e8a994ee69f222db68a204265c9fa53ecca (commit)
      from  5b6630173195372fe864e7f0070eeb5fa8be9a1a (commit)

Summary of changes:
 lib/App/Changeloggr/View.pm  |   26 +++++++++++++++++++++++++-
 share/web/static/css/app.css |   14 ++++++++++++++
 2 files changed, 39 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 71217e8a994ee69f222db68a204265c9fa53ecca
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Wed May 27 17:54:35 2009 -0400

    Add global ranking and vote count

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 4aaa06e..628b61a 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -46,6 +46,11 @@ template '/changelog' => page {
     title is $changelog->name;
 
     render_region(
+        name => 'score',
+        path => '/score',
+    );
+
+    render_region(
         name => 'vote-on-change',
         path => '/vote-on-change',
         defaults => {
@@ -74,6 +79,22 @@ template '/vote-on-change' => sub {
     }
 };
 
+template '/score' => sub {
+    div {
+        {id is "score"};
+        my $votes = Jifty->web->current_user->user_object->votes->count;
+        my $place = Jifty->handle->simple_query(<<"EOSQL")->fetch->[0];
+select count(*)
+  from (select user_id
+          from votes
+         group by votes.user_id
+        having count(*) >= $votes);
+EOSQL
+        $place++ unless $votes;
+        outs _("You have %quant(%1,vote), and are currently ranked #%2!", $votes, $place);
+    };
+};
+
 sub changelog_summary {
     my $changelog = shift;
 
@@ -264,7 +285,10 @@ sub show_vote_form {
                     class       => "vote",
                     label       => $label,
                     key_binding => $valid_tag->hotkey,
-                    onclick     => { submit => $vote, refresh_self => 1 },
+                    onclick     => [
+                        { submit => $vote, refresh_self => 1 },
+                        { refresh => 'score' },
+                    ],
                     arguments   => { tag => $valid_tag->text },
                 );
             }
diff --git a/share/web/static/css/app.css b/share/web/static/css/app.css
index c093c5f..cfc7afd 100644
--- a/share/web/static/css/app.css
+++ b/share/web/static/css/app.css
@@ -61,3 +61,17 @@ hr {
 p.admin.docs {
   width: 40em;
 }
+
+h1.title {
+  border: none;
+}
+
+#score {
+  position: absolute;
+  right: 18em;
+  top: 4em;
+  width: 15em;
+  background-color: #223;
+  border: 1px solid #445;
+  padding: 0.5em;
+}
\ No newline at end of file

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



More information about the Bps-public-commit mailing list