[Rt-commit] rt branch, admin_ui, updated. 55f8311d745315ac1da0bef3dad1662e3a427103
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Wed Dec 2 02:34:45 EST 2009
The branch, admin_ui has been updated
via 55f8311d745315ac1da0bef3dad1662e3a427103 (commit)
from f23275bfbd7943a48ba9d5502f8ca23953de03a3 (commit)
Summary of changes:
lib/RT/View/Admin/Queues.pm | 52 +++++++++++++++++++------------------------
1 files changed, 23 insertions(+), 29 deletions(-)
- Log -----------------------------------------------------------------
commit 55f8311d745315ac1da0bef3dad1662e3a427103
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Dec 2 15:34:25 2009 +0800
refactor View/Admin/Queues.pm: abstract the way we get queue object
diff --git a/lib/RT/View/Admin/Queues.pm b/lib/RT/View/Admin/Queues.pm
index af7d071..0f27d76 100644
--- a/lib/RT/View/Admin/Queues.pm
+++ b/lib/RT/View/Admin/Queues.pm
@@ -111,20 +111,7 @@ private template 'rights' => sub {
my $self = shift;
my $type = shift || 'user';
- my $id = get('id');
- unless ( $id ) {
- Jifty->log->fatal( "need queue id parameter" );
- return;
- }
-
- my $queue = RT::Model::Queue->new( current_user =>
- Jifty->web->current_user );
- my ( $ret, $msg ) = $queue->load( $id );
- unless ( $ret ) {
- Jifty->log->fatal( "failed to load queue $id: $msg" );
- return;
- }
-
+ my $queue = $self->queue;
my $class = 'Edit' . ucfirst($type) . 'Rights';
my $moniker = 'modify_' . $type . '_rights';
@@ -136,7 +123,7 @@ private template 'rights' => sub {
$rights->object($queue);
with ( name => $moniker ), form {
- input { type is 'hidden'; name is 'id'; value is $id };
+ input { type is 'hidden'; name is 'id'; value is $queue->id };
render_action($rights);
form_submit( label => _('Save') );
};
@@ -152,19 +139,8 @@ template 'group_rights.html' => page { title => _('Modify group rights') } conte
template 'people.html' => page { title => _('Modify people') } content {
my $self = shift;
- my $id = get('id');
- unless ( $id ) {
- Jifty->log->fatal( "need queue id parameter" );
- return;
- }
-
- my $queue = RT::Model::Queue->new( current_user =>
- Jifty->web->current_user );
- my ( $ret, $msg ) = $queue->load( $id );
- unless ( $ret ) {
- Jifty->log->fatal( "failed to load queue $id: $msg" );
- return;
- }
+ my $queue = $self->queue;
+ return unless $queue;
my $action = new_action(
class => 'EditWatchers',
@@ -174,7 +150,7 @@ template 'people.html' => page { title => _('Modify people') } content {
$action->object($queue);
with ( name => 'modify_people' ), form {
- input { type is 'hidden'; name is 'id'; value is $id };
+ input { type is 'hidden'; name is 'id'; value is $queue->id };
render_action($action);
form_submit( label => _('Save') );
};
@@ -187,5 +163,23 @@ sub _current_collection {
return $collection;
}
+sub queue {
+ my $self = shift;
+ my $id = get('id');
+ unless ( $id ) {
+ Jifty->log->fatal( "need queue id parameter" );
+ return;
+ }
+
+ my $queue = RT::Model::Queue->new( current_user =>
+ Jifty->web->current_user );
+ my ( $ret, $msg ) = $queue->load( $id );
+ unless ( $ret ) {
+ Jifty->log->fatal( "failed to load queue $id: $msg" );
+ return;
+ }
+ return $queue;
+}
+
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list