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

sartak at bestpractical.com sartak at bestpractical.com
Fri Feb 27 21:08:17 EST 2009


The branch, master has been updated
       via  beafe14ea92433475b2a3b568404df42a76a6661 (commit)
       via  7b9fa010ed6591aedc440f3b2f85f8c5694781a3 (commit)
       via  645845512ff3e578ee4757c5752b3ef1f7849870 (commit)
      from  a97bb9ce99b476e389ae3a90fa0987a6e9b62243 (commit)

Summary of changes:
 lib/App/Changeloggr/Action/AddChanges.pm         |   49 ++++++++++++++++++++++
 lib/App/Changeloggr/Model/ChangelogCollection.pm |    8 ++--
 lib/App/Changeloggr/View.pm                      |   19 ++++++++
 3 files changed, 72 insertions(+), 4 deletions(-)
 create mode 100644 lib/App/Changeloggr/Action/AddChanges.pm

- Log -----------------------------------------------------------------
commit 645845512ff3e578ee4757c5752b3ef1f7849870
Author: Shawn M Moore <sartak at gmail.com>
Date:   Fri Feb 27 21:07:18 2009 -0500

    Wait on this until we actually have changes in changelogs

diff --git a/lib/App/Changeloggr/Model/ChangelogCollection.pm b/lib/App/Changeloggr/Model/ChangelogCollection.pm
index c62938e..dd87935 100644
--- a/lib/App/Changeloggr/Model/ChangelogCollection.pm
+++ b/lib/App/Changeloggr/Model/ChangelogCollection.pm
@@ -15,10 +15,10 @@ sub with_changes {
         column2 => 'changelog',
     );
 
-    $self->limit(
-        leftjoin => $changes,
-        # hmm..
-    );
+    #$self->limit(
+    #    leftjoin => $changes,
+    #    # hmm..
+    #);
 
     return $self;
 }

commit 7b9fa010ed6591aedc440f3b2f85f8c5694781a3
Author: Shawn M Moore <sartak at gmail.com>
Date:   Fri Feb 27 21:07:44 2009 -0500

    Begin an AddChanges action

diff --git a/lib/App/Changeloggr/Action/AddChanges.pm b/lib/App/Changeloggr/Action/AddChanges.pm
new file mode 100644
index 0000000..6b47515
--- /dev/null
+++ b/lib/App/Changeloggr/Action/AddChanges.pm
@@ -0,0 +1,49 @@
+package App::Changeloggr::Action::AddChanges;
+use strict;
+use warnings;
+
+use JiftyX::ModelHelpers;
+
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+    param admin_token =>
+        type is 'text';
+
+    param changes =>
+        type is 'text',
+        render as 'textarea',
+        is mandatory,
+        hints is 'We accept the output of svn log and git log.';
+};
+
+sub get_changelog {
+    my $self = shift;
+
+    my $changelog = Changelog(
+        admin_token => $self->argument_value('admin_token'),
+        { current_user => App::Changeloggr::CurrentUser->superuser },
+    );
+
+    return $changelog;
+}
+
+sub validate_admin_token {
+    my $self        = shift;
+    my $admin_token = shift;
+
+    my $changelog = $self->get_changelog;
+    if ($changelog->id) {
+        return $self->validation_ok('admin_token');
+    }
+    else {
+        return $self->validation_error(admin_token => "You do not have permission to add changes to this changelog.");
+    }
+}
+
+sub take_action {
+    my $self = shift;
+    my $changelog = $self->get_changelog;
+}
+
+1;
+

commit beafe14ea92433475b2a3b568404df42a76a6661
Author: Shawn M Moore <sartak at gmail.com>
Date:   Fri Feb 27 21:07:49 2009 -0500

    Include the AddChanges action in the admin form

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 11a0513..0b9362b 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -41,6 +41,8 @@ template '/changelog/admin' => page {
         form_submit(label => 'Update');
     };
 
+    add_changes_to($changelog);
+
     my $delete = $changelog->as_delete_action;
     form {
         render_action($delete);
@@ -49,6 +51,23 @@ template '/changelog/admin' => page {
     };
 };
 
+sub add_changes_to {
+    my $changelog = shift;
+
+    my $add_changes = new_action('AddChanges');
+
+    form {
+        render_action($add_changes => ['changes']);
+
+        render_param($add_changes => admin_token => (
+            default_value => $changelog->as_superuser->admin_token,
+            render_as     => 'hidden',
+        ));
+
+        form_submit(label => 'Add');
+    };
+}
+
 sub changelog_summary {
     my $changelog = shift;
 

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



More information about the Bps-public-commit mailing list