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

sartak at bestpractical.com sartak at bestpractical.com
Thu Feb 26 23:36:28 EST 2009


The branch, master has been updated
       via  e1f6883e99204c66cf4ce4389d9d15f2d6640696 (commit)
      from  5e14e2b30f108d2e12b5d3fc843946b988d4a2dd (commit)

Summary of changes:
 lib/App/Changeloggr/Model/ChangelogCollection.pm |   27 ++++++++++++++++++++++
 lib/App/Changeloggr/View.pm                      |    1 +
 2 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 lib/App/Changeloggr/Model/ChangelogCollection.pm

- Log -----------------------------------------------------------------
commit e1f6883e99204c66cf4ce4389d9d15f2d6640696
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Feb 26 23:36:12 2009 -0500

    Add a with_changes method to Changelogs so we can avoid asking for help
    for projects without any changes

diff --git a/lib/App/Changeloggr/Model/ChangelogCollection.pm b/lib/App/Changeloggr/Model/ChangelogCollection.pm
new file mode 100644
index 0000000..c62938e
--- /dev/null
+++ b/lib/App/Changeloggr/Model/ChangelogCollection.pm
@@ -0,0 +1,27 @@
+package App::Changeloggr::Model::ChangelogCollection;
+use strict;
+use warnings;
+use base 'App::Changeloggr::Collection';
+
+sub with_changes {
+    my $self = shift;
+    Carp::croak("with_changes takes no arguments") if @_;
+
+    my $changes = $self->join(
+        type    => 'left',
+        alias1  => 'main',
+        column1 => 'id',
+        table2  => 'changes',
+        column2 => 'changelog',
+    );
+
+    $self->limit(
+        leftjoin => $changes,
+        # hmm..
+    );
+
+    return $self;
+}
+
+1;
+
diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 35d37f8..11a0513 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -6,6 +6,7 @@ use warnings;
 
 template '/' => page {
     my $changelogs = M(ChangelogCollection => done => 0);
+    $changelogs->with_changes;
 
     if ($changelogs->count) {
         h2 { "These projects need your help!" };

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



More information about the Bps-public-commit mailing list