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

sartak at bestpractical.com sartak at bestpractical.com
Wed Aug 5 03:02:05 EDT 2009


The branch, master has been updated
       via  ee333319ad80a880944973caf5fe63eb1a75f76b (commit)
       via  462579575d7a8ac23f2296eb0a4fcd22bc07cb69 (commit)
       via  5b19faa6ef201d7a41448cb549ef79c75b2091c9 (commit)
       via  f54ad9c124e4750593ca9b3616291684c22b6600 (commit)
       via  61eb3493cf116f1e0cf63ed0103064106cbe3d4a (commit)
       via  910e1ad3d5e21620b79d50d0237197310f641473 (commit)
       via  63d1a59b7fc92ff3d544e6fd4624bb5f9271e7a6 (commit)
       via  fbca27f389ff5a826b6e872a64ba5b70be56d3db (commit)
       via  cf04040fe3c66532d077b8fced5d688d7e31714d (commit)
      from  565dbed93cd76e349c8010c68c410cf6e46c354c (commit)

Summary of changes:
 lib/App/Changeloggr/View.pm     |  191 +++++++++++++++++++++------------------
 share/web/static/css/app.css    |    1 -
 share/web/static/css/change.css |   30 ++-----
 3 files changed, 112 insertions(+), 110 deletions(-)

- Log -----------------------------------------------------------------
commit cf04040fe3c66532d077b8fced5d688d7e31714d
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Aug 4 20:35:05 2009 -0400

    Begin moving the vote form to the sidebar

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index d76e7bf..6f81dd6 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -152,7 +152,15 @@ sub show_change {
     my $change = shift;
     my %args = @_;
 
-    div { id is 'keybindings' };
+    my $id = $change->id;
+
+    render_region(
+        name      => "vote_$id",
+        path      => '/change/vote',
+        arguments => {
+            change => $id,
+        },
+    );
 
     div {
         { class is "change" };
@@ -190,7 +198,6 @@ sub show_change {
             li { "Date: " . $change->date };
         };
 
-        my $id = $change->id;
         render_region(
             name      => "change_$id",
             path      => '/change/more',
@@ -234,8 +241,6 @@ sub show_change {
 
         if ($args{voting_form}) {
             hr {};
-            show_vote_form($change);
-            hr {};
             show_rewording_form($change);
         }
     };
@@ -268,103 +273,109 @@ template '/change/more' => sub {
     };
 };
 
-sub show_vote_form {
-    my $change = shift;
-
+template '/change/vote' => sub {
+    my $change = M('Change', id => get('change'));
     my $changelog = $change->changelog;
     my $valid_tags = $change->prioritized_tags;
 
-    form {
+    div {
+        id is 'vote_buttons';
         h4 { 'Vote!' };
-        my $vote = new_action(
-            class     => "CreateVote",
-            arguments => { change_id => $change->id }
-        );
 
-        render_param($vote, 'change_id');
-        if ($valid_tags->count == 0 || $changelog->incremental_tags) {
-            render_param($vote, 'tag');
-
-            my $label = $changelog->incremental_tags ? 'Vote and add tag' : 'Vote';
-            form_submit(
-                label   => $label,
-                onclick     => [
-                    { submit => $vote, refresh_self => 1 },
-                    { refresh => 'score' },
-                ],
-            );
-        }
+        form {
+            ul {
+                my $vote = new_action(
+                    class     => "CreateVote",
+                    arguments => { change_id => $change->id }
+                );
 
-        if ($valid_tags->count) {
-            my $tag_number = 0;
-            my $voted_cusp = 0;
-            while (my $valid_tag = $valid_tags->next) {
-                my $label;
-                my $count = $change->count_of_tag($valid_tag);
-
-                # This is actually checking count+1, not id. It's count+1
-                # because id 0 (aka count 0) records are not loaded. :/
-                ++$tag_number;
-                if ($count > 0) {
-                    $label = _('%1 (%2)', $valid_tag->text, $count);
-                }
-                else {
-                    $label = $valid_tag->text;
-
-                    # Add a newline between tags that have been selected for
-                    # this change and tags that haven't
-                    if (!$voted_cusp) {
-                        $voted_cusp = 1;
-                        br {} unless $tag_number == 1;
+                render_param($vote, 'change_id');
+                if ($valid_tags->count == 0 || $changelog->incremental_tags) {
+                    render_param($vote, 'tag');
+
+                    my $label = $changelog->incremental_tags ? 'Vote and add tag' : 'Vote';
+                    li {
+                        form_submit(
+                            label   => $label,
+                            onclick     => [
+                                { submit => $vote, refresh_self => 1 },
+                                { refresh => 'score' },
+                            ],
+                        );
                     }
                 }
 
-                $vote->button(
-                    class       => "vote",
-                    label       => $label,
-                    key_binding => $valid_tag->hotkey,
-                    tooltip     => $valid_tag->tooltip,
-                    onclick     => [
-                        { submit => $vote, refresh_self => 1 },
-                        { refresh => 'score' },
-                    ],
-                    arguments   => { tag => $valid_tag->text },
-                );
-            }
+                if ($valid_tags->count) {
+                    my $tag_number = 0;
+                    my $voted_cusp = 0;
+                    while (my $valid_tag = $valid_tags->next) {
+                        my $label;
+                        my $count = $change->count_of_tag($valid_tag);
+
+                        # This is actually checking count+1, not id. It's count+1
+                        # because id 0 (aka count 0) records are not loaded. :/
+                        ++$tag_number;
+                        if ($count > 0) {
+                            $label = _('%1 (%2)', $valid_tag->text, $count);
+                        }
+                        else {
+                            $label = $valid_tag->text;
+                        }
+
+                        li {
+                            $vote->button(
+                                class       => "vote",
+                                label       => $label,
+                                key_binding => $valid_tag->hotkey,
+                                tooltip     => $valid_tag->tooltip,
+                                onclick     => [
+                                    { submit => $vote, refresh_self => 1 },
+                                    { refresh => 'score' },
+                                ],
+                                arguments   => { tag => $valid_tag->text },
+                            );
+                        };
+                    }
 
-            p {
-                attr { class => 'tags_link' };
-                hyperlink(
-                    label => _('Legend'),
-                    url   => '/changelog/' . $changelog->name . '/tags',
-                );
-            }
-        }
-        hr {};
-        $vote->button(
-            class       => "vote",
-            label       => 'Skip this change',
-            onclick     => [
-                { submit => $vote, refresh_self => 1 },
-                { refresh => 'score' },
-            ],
-            arguments   => { tag => '_skip' },
-        );
+                    p {
+                        attr { class => 'tags_link' };
+                        hyperlink(
+                            label => _('Legend'),
+                            url   => '/changelog/' . $changelog->name . '/tags',
+                        );
+                    }
+                }
+                hr {};
+                li {
+                    $vote->button(
+                        class       => "vote",
+                        label       => 'Skip this change',
+                        onclick     => [
+                            { submit => $vote, refresh_self => 1 },
+                            { refresh => 'score' },
+                        ],
+                        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 },
-                    { refresh => 'score' },
-                ],
-            );
+                my $user = Jifty->web->current_user->user_object;
+                if ($user->votes->count) {
+                    my $undo = new_action('UndoVote');
+                    li {
+                        $undo->button(
+                            class   => "vote",
+                            label   => "Undo previous vote",
+                            onclick     => [
+                                { submit => $undo, refresh_self => 1 },
+                                { refresh => 'score' },
+                            ],
+                        );
+                    };
+                }
+            }
         }
-    }
-}
+    };
+};
 
 sub show_rewording_form {
     my $change = shift;

commit fbca27f389ff5a826b6e872a64ba5b70be56d3db
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Aug 4 20:35:14 2009 -0400

    CSS updates

diff --git a/share/web/static/css/change.css b/share/web/static/css/change.css
index c61dc85..7d09134 100644
--- a/share/web/static/css/change.css
+++ b/share/web/static/css/change.css
@@ -7,7 +7,7 @@ input.button.vote {
   margin: 0.3em;
 }
 
-#region-vote-on-change div#keybindings {
+#region-vote-on-change div#vote_buttons {
   background: #224;
   border: 1px solid #445;
   border-left: none;
@@ -22,30 +22,6 @@ input.button.vote {
   -moz-border-radius-bottomright: 10px;
 }
 
-dl.keybindings {
-  margin-top: 0;
-}
-
-dl.keybindings dt {
-  clear: left;
-  float: left;
-  text-align: right;
-  font-family: monospace;
-  font-size: 125%;
-}
-
-dl.keybindings dt:after {
-  content: "";
-}
-
-dl.keybindings dd:before {
-  content: " - ";
-}
-
-dl.keybindings dd {
-  float: left;
-}
-
 .change_message {
   font-family: monospace;
 }

commit 63d1a59b7fc92ff3d544e6fd4624bb5f9271e7a6
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 00:13:37 2009 -0400

    Improve vote button styling

diff --git a/share/web/static/css/change.css b/share/web/static/css/change.css
index 7d09134..e3b75ea 100644
--- a/share/web/static/css/change.css
+++ b/share/web/static/css/change.css
@@ -22,6 +22,12 @@ input.button.vote {
   -moz-border-radius-bottomright: 10px;
 }
 
+div#vote_buttons ul {
+    list-style-type: none;
+    margin: 0;
+    padding: 0;
+}
+
 .change_message {
   font-family: monospace;
 }

commit 910e1ad3d5e21620b79d50d0237197310f641473
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 00:20:23 2009 -0400

    Underline the Legend link so people know it's a link

diff --git a/share/web/static/css/app.css b/share/web/static/css/app.css
index 361bf2f..b320c0f 100644
--- a/share/web/static/css/app.css
+++ b/share/web/static/css/app.css
@@ -78,5 +78,4 @@ h1.title {
 
 .tags_link a {
   font-size: .8em;
-  text-decoration: none;
 }

commit 61eb3493cf116f1e0cf63ed0103064106cbe3d4a
Merge: 910e1ad... 565dbed...
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 00:27:03 2009 -0400

    Merge branch 'master' into vote-sidebar


commit f54ad9c124e4750593ca9b3616291684c22b6600
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 01:48:03 2009 -0400

    Include hotkeys in the legend

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 38fb93a..d9e91b8 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -82,7 +82,10 @@ template '/changelog/tags' => page {
     my $tags = $changelog->tags;
     dl {
         while (my $tag = $tags->next) {
-            dt { $tag->text }
+            dt {
+                outs $tag->text;
+                outs _(" (hotkey: %1)", $tag->hotkey) if $tag->hotkey;
+            }
             dd { $tag->description || $tag->tooltip || '' }
         }
     }

commit 5b19faa6ef201d7a41448cb549ef79c75b2091c9
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 02:56:14 2009 -0400

    Don't use a new region for vote buttons
    
        Both the change and the buttons need to be refreshed anyway

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index d9e91b8..ab338f7 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -157,13 +157,7 @@ sub show_change {
 
     my $id = $change->id;
 
-    render_region(
-        name      => "vote_$id",
-        path      => '/change/vote',
-        arguments => {
-            change => $id,
-        },
-    );
+    show_vote_form($change);
 
     div {
         { class is "change" };
@@ -280,8 +274,8 @@ template '/change/more' => sub {
     };
 };
 
-template '/change/vote' => sub {
-    my $change = M('Change', id => get('change'));
+sub show_vote_form {
+    my $change = shift;
     my $changelog = $change->changelog;
     my $valid_tags = $change->prioritized_tags;
 

commit 462579575d7a8ac23f2296eb0a4fcd22bc07cb69
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 02:59:10 2009 -0400

    Display hotkey for each button

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index ab338f7..4081434 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -324,6 +324,13 @@ sub show_vote_form {
                         }
 
                         li {
+                            if ($valid_tag->hotkey) {
+                                span {
+                                    class is 'hotkey';
+                                    $valid_tag->hotkey
+                                };
+                            }
+
                             $vote->button(
                                 class       => "vote",
                                 label       => $label,
diff --git a/share/web/static/css/change.css b/share/web/static/css/change.css
index e3b75ea..9f87a4a 100644
--- a/share/web/static/css/change.css
+++ b/share/web/static/css/change.css
@@ -28,6 +28,10 @@ div#vote_buttons ul {
     padding: 0;
 }
 
+div#vote_buttons .hotkey {
+    font-size: 1.2em;
+}
+
 .change_message {
   font-family: monospace;
 }

commit ee333319ad80a880944973caf5fe63eb1a75f76b
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Aug 5 03:00:25 2009 -0400

    Better styling for hotkeys

diff --git a/share/web/static/css/change.css b/share/web/static/css/change.css
index 9f87a4a..2d3e760 100644
--- a/share/web/static/css/change.css
+++ b/share/web/static/css/change.css
@@ -29,7 +29,9 @@ div#vote_buttons ul {
 }
 
 div#vote_buttons .hotkey {
-    font-size: 1.2em;
+    font-family: monospace;
+    font-size: 125%;
+    text-transform: uppercase;
 }
 
 .change_message {

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



More information about the Bps-public-commit mailing list