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

sartak at bestpractical.com sartak at bestpractical.com
Wed Jul 29 14:11:22 EDT 2009


The branch, master has been updated
       via  9671c372661bd58d6ecdb0476d0cd4a75cb144b2 (commit)
       via  15e526d3efa1d48afc2f34edf103df730248eb02 (commit)
      from  a49ee258b05c1d02c86a2a7f3a9a4ad3b5fa3b7d (commit)

Summary of changes:
 lib/App/Changeloggr/CurrentUser.pm |   29 +++++++++++++++++
 lib/App/Changeloggr/View/Admin.pm  |   60 +++++++++++++++++++----------------
 2 files changed, 62 insertions(+), 27 deletions(-)

- Log -----------------------------------------------------------------
commit 15e526d3efa1d48afc2f34edf103df730248eb02
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Jul 28 19:42:39 2009 -0400

    Factor editing a tag out into its own function

diff --git a/lib/App/Changeloggr/View/Admin.pm b/lib/App/Changeloggr/View/Admin.pm
index ed24c9e..a6f9123 100644
--- a/lib/App/Changeloggr/View/Admin.pm
+++ b/lib/App/Changeloggr/View/Admin.pm
@@ -208,33 +208,7 @@ EOT
             ul {
                 while (my $tag = $tags->next) {
                     li {
-                        my $delete_tag = $tag->as_delete_action;
-                        render_action $delete_tag;
-                        outs $tag->text;
-                        if ($tag->hotkey) {
-                            outs " ";
-                            span {
-                                { class is "hotkey" };
-                                "(hotkey: ".$tag->hotkey.")"
-                            }
-                        }
-                        $delete_tag->button(label => "Delete", class => "inline delete");
-
-                        my $tooltip = $tag->tooltip;
-                        my $description = $tag->description;
-
-                        if ($tooltip || $description) {
-                            dl {
-                                if ($tooltip) {
-                                    dt { "Tooltip" }
-                                    dd { $tooltip  }
-                                }
-                                if ($description) {
-                                    dt { "Description" }
-                                    dd { $description  }
-                                }
-                            }
-                        }
+                        edit_tag($tag);
                     }
                 }
             }
@@ -249,5 +223,37 @@ EOT
     }
 }
 
+sub edit_tag {
+    my $tag = shift;
+
+    my $delete_tag = $tag->as_delete_action;
+    render_action $delete_tag;
+    outs $tag->text;
+    if ($tag->hotkey) {
+        outs " ";
+        span {
+            { class is "hotkey" };
+            "(hotkey: ".$tag->hotkey.")"
+        }
+    }
+    $delete_tag->button(label => "Delete", class => "inline delete");
+
+    my $tooltip = $tag->tooltip;
+    my $description = $tag->description;
+
+    if ($tooltip || $description) {
+        dl {
+            if ($tooltip) {
+                dt { "Tooltip" }
+                dd { $tooltip  }
+            }
+            if ($description) {
+                dt { "Description" }
+                dd { $description  }
+            }
+        }
+    }
+}
+
 1;
 

commit 9671c372661bd58d6ecdb0476d0cd4a75cb144b2
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Jul 29 14:11:03 2009 -0400

    get and set for the user's starting position for a changelog

diff --git a/lib/App/Changeloggr/CurrentUser.pm b/lib/App/Changeloggr/CurrentUser.pm
index e87267b..430cae7 100644
--- a/lib/App/Changeloggr/CurrentUser.pm
+++ b/lib/App/Changeloggr/CurrentUser.pm
@@ -12,5 +12,34 @@ sub is_staff {
     return $user->access_level eq 'staff';
 }
 
+sub position_for {
+    my $self      = shift;
+    my $changelog = shift;
+
+    my $session = Jifty::Web::Session->new;
+    $session->load;
+
+    my $key = "changelog-" . $changelog->id;
+    my $position = $session->get($key);
+    if (!defined($position)) {
+        $position = $changelog->get_starting_position;
+        $self->set_position_for($changelog, $position);
+    }
+
+    return $position;
+}
+
+sub set_position_for {
+    my $self      = shift;
+    my $changelog = shift;
+    my $position  = shift;
+
+    my $session = Jifty::Web::Session->new;
+    $session->load;
+
+    my $key = "changelog-" . $changelog->id;
+    $session->set($key => $position);
+}
+
 1;
 

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



More information about the Bps-public-commit mailing list