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

sartak at bestpractical.com sartak at bestpractical.com
Wed May 20 19:41:51 EDT 2009


The branch, master has been updated
       via  a5f97d4459fb6950ffa03fe87e573ff462c07600 (commit)
      from  0da63f7d846f8d062ddeafd71613b5d56ebc68e5 (commit)

Summary of changes:
 lib/App/Changeloggr/View.pm |   49 ++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit a5f97d4459fb6950ffa03fe87e573ff462c07600
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed May 20 19:41:38 2009 -0400

    If the user has submitted a rewording, display it instead of the form

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index cf65234..942a7ba 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -252,23 +252,48 @@ sub show_vote_form {
 sub show_rewording_form {
     my $change = shift;
 
-    my $create_rewording = new_action('CreateRewording');
+    render_region(
+        name => 'rewording',
+        path => '/change/reword',
+        arguments => {
+            change => $change->id,
+        },
+    );
+}
 
-    p { "Do you want to improve the content or wording of this change's message?" };
+template '/change/reword' => sub {
+    my $change_id = get('change');
+    my $change = Change($change_id);
 
-    render_hidden $create_rewording => 'change_id' => $change->id;
-    render_param $create_rewording => (
-        'message',
-        label => '',
-        default_value => $change->message,
+    my $rewording = Rewording(
+        change_id => $change_id,
+        user_id => Jifty->web->current_user->id,
     );
+    if ($rewording->id) {
+        p { "You submitted the following rewording:" };
+        pre { $rewording->message };
+    }
+    else {
+        my $create_rewording = new_action('CreateRewording');
 
-    $create_rewording->button(
-        label => 'Reword',
-        onclick => { submit => $create_rewording },
-    );
-}
+        p { "Do you want to improve the content or wording of this change's message?" };
 
+        render_hidden $create_rewording => 'change_id' => $change_id;
+        render_param $create_rewording => (
+            'message',
+            label => '',
+            default_value => $change->message,
+        );
+
+        $create_rewording->button(
+            label => 'Reword',
+            onclick => {
+                submit => $create_rewording,
+                refresh_self => 1,
+            },
+        );
+    }
+};
 
 sub show_vote_comments {
     my $change = shift;

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



More information about the Bps-public-commit mailing list