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

Alex M Vandiver alexmv at bestpractical.com
Wed Apr 29 13:10:26 EDT 2009


The branch, master has been updated
       via  7472dfa91e2d3e65cc3dc917f987e54fbeb700eb (commit)
       via  c291f0c271f95b37621de65a82c40a7aafc4e1aa (commit)
      from  bfe2879c439848f9588a56a0dec23f0109aa2ee2 (commit)

Summary of changes:
 .../Changeloggr/Action/Mixin/RequiresAdminToken.pm |    1 +
 lib/App/Changeloggr/Model/Change.pm                |    8 ++++++++
 lib/App/Changeloggr/Model/Changelog.pm             |    6 ++++++
 lib/App/Changeloggr/View.pm                        |    8 ++++++++
 lib/App/Changeloggr/View/Admin.pm                  |    2 +-
 share/web/static/css/app.css                       |    3 +++
 6 files changed, 27 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit c291f0c271f95b37621de65a82c40a7aafc4e1aa
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Wed Apr 29 13:07:21 2009 -0400

    Fix UpdateChangelog permissions problem, and make it scream visibly

diff --git a/lib/App/Changeloggr/Action/Mixin/RequiresAdminToken.pm b/lib/App/Changeloggr/Action/Mixin/RequiresAdminToken.pm
index c35cf6e..e16bca2 100644
--- a/lib/App/Changeloggr/Action/Mixin/RequiresAdminToken.pm
+++ b/lib/App/Changeloggr/Action/Mixin/RequiresAdminToken.pm
@@ -29,6 +29,7 @@ sub validate_admin_token {
         return $self->validation_ok('admin_token');
     }
     else {
+        $self->result->error("You do not have permission to modify this changelog.");
         return $self->validation_error(admin_token => "You do not have permission to modify this changelog.");
     }
 }
diff --git a/lib/App/Changeloggr/View/Admin.pm b/lib/App/Changeloggr/View/Admin.pm
index 73bb038..450f00c 100644
--- a/lib/App/Changeloggr/View/Admin.pm
+++ b/lib/App/Changeloggr/View/Admin.pm
@@ -14,7 +14,7 @@ template '/create-changelog' => page {
 };
 
 template '/changelog' => page {
-    my $changelog = Changelog(id => get('id'));
+    my $changelog = Changelog(id => get('id'))->as_superuser;
 
     my $update = $changelog->as_update_action;
     form {

commit 7472dfa91e2d3e65cc3dc917f987e54fbeb700eb
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Wed Apr 29 13:08:12 2009 -0400

    Add "external source" links, to full diffs, etc
    
    For perl, for instance, it would be http://perl5.git.perl.org/perl.git/commitdiff/

diff --git a/lib/App/Changeloggr/Model/Change.pm b/lib/App/Changeloggr/Model/Change.pm
index 59503c7..fdf86ee 100644
--- a/lib/App/Changeloggr/Model/Change.pm
+++ b/lib/App/Changeloggr/Model/Change.pm
@@ -74,5 +74,13 @@ sub grouped_votes {
     return $votes;
 }
 
+sub external_source {
+    my $self = shift;
+    my $url = $self->changelog->external_source;
+    return unless $url;
+    $url .= $self->identifier unless $url =~ s/__ID__/$self->identifier/ge;
+    return $url;
+}
+
 1;
 
diff --git a/lib/App/Changeloggr/Model/Changelog.pm b/lib/App/Changeloggr/Model/Changelog.pm
index 212bc5c..0674d1f 100644
--- a/lib/App/Changeloggr/Model/Changelog.pm
+++ b/lib/App/Changeloggr/Model/Changelog.pm
@@ -20,6 +20,12 @@ use App::Changeloggr::Record schema {
         is immutable,
         render as 'hidden',
         default is defer { _generate_admin_token() };
+
+    column external_source =>
+        type is 'text',
+        render as 'text',
+        label is 'External URL per commit',
+        since '0.0.3';
 };
 
 # has to go below schema
diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 65c3d57..2c051f6 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -97,6 +97,14 @@ sub show_change {
         };
 
         my $id = $change->id;
+        if (my $url = $change->external_source) {
+            hyperlink(
+                label  => "Full diff",
+                url    => $url,
+                target => "diff",
+                class  => "external_source",
+            );
+        }
         hyperlink(
             label => 'more...',
             onclick => [{
diff --git a/share/web/static/css/app.css b/share/web/static/css/app.css
index 85f8d78..3583477 100644
--- a/share/web/static/css/app.css
+++ b/share/web/static/css/app.css
@@ -100,3 +100,6 @@ hr {
    color: #f99;
 }
 
+.external_source {
+  float: right;
+}
\ No newline at end of file

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



More information about the Bps-public-commit mailing list