[Rt-commit] rt branch, admin_ui, updated. 2af3718c87d0f3abfb1351f746fd9b528f3d6cfe

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Dec 3 01:49:38 EST 2009


The branch, admin_ui has been updated
       via  2af3718c87d0f3abfb1351f746fd9b528f3d6cfe (commit)
      from  cab4c4c0e6e270d14e80e6798edb903022d798e8 (commit)

Summary of changes:
 lib/RT/View/Admin/Queues.pm                        |    3 +
 .../View/Admin/{Rules.pm => Queues/Templates.pm}   |  103 +++++++++++---------
 2 files changed, 60 insertions(+), 46 deletions(-)
 copy lib/RT/View/Admin/{Rules.pm => Queues/Templates.pm} (51%)

- Log -----------------------------------------------------------------
commit 2af3718c87d0f3abfb1351f746fd9b528f3d6cfe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 3 14:49:27 2009 +0800

    add /admin/queues/templates/ view

diff --git a/lib/RT/View/Admin/Queues.pm b/lib/RT/View/Admin/Queues.pm
index f95e2c1..036eea5 100644
--- a/lib/RT/View/Admin/Queues.pm
+++ b/lib/RT/View/Admin/Queues.pm
@@ -52,6 +52,9 @@ package RT::View::Admin::Queues;
 use Jifty::View::Declare -base;
 use base 'RT::View::CRUD';
 
+require RT::View::Admin::Queues::Templates;
+alias RT::View::Admin::Queues::Templates under 'templates/';
+
 use constant page_title      => 'Queue Management';
 use constant object_type     => 'Queue';
 
diff --git a/lib/RT/View/Admin/Queues/Templates.pm b/lib/RT/View/Admin/Queues/Templates.pm
new file mode 100644
index 0000000..c8a0215
--- /dev/null
+++ b/lib/RT/View/Admin/Queues/Templates.pm
@@ -0,0 +1,122 @@
+# BEGIN BPS TAGGED BLOCK {{{
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+#                                          <jesse at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/copyleft/gpl.html.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# END BPS TAGGED BLOCK }}}
+use warnings;
+use strict;
+
+package RT::View::Admin::Queues::Templates;
+use Jifty::View::Declare -base;
+use base 'RT::View::CRUD';
+
+use constant page_title      => 'Queue Templates Management';
+use constant object_type     => 'Template';
+
+use constant display_columns => qw(id name description type);
+use constant edit_columns => qw(name description type content);
+use constant create_columns => qw(name description type content);
+
+private template view_item_controls => sub {
+    my $self   = shift;
+    my $record = shift;
+
+    if ( $record->current_user_can('update') ) {
+        hyperlink(
+            label   => _("Edit"),
+            class   => "editlink",
+            onclick => {
+                popout => $self->fragment_for('update'),
+                args   => { id => $record->id },
+            },
+        );
+    }
+};
+
+sub _current_collection {
+    my $self = shift; 
+    my $collection = $self->SUPER::_current_collection( @_ );
+    $collection->limit_to_queue( get('queue') );
+    return $collection;    
+}
+
+# overwrote this because we need to set queue info
+private template 'new_item_controls' => sub {
+    my $self          = shift;
+    my $create        = shift;
+    my ($object_type) = ( $self->object_type );
+
+    outs(
+        Jifty->web->form->submit(
+            label   => _('Create'),
+            onclick => [
+                {
+                    submit => {
+                        action    => $create,
+                        arguments => { queue => get('queue') }
+                    }
+                },
+                { refresh_self => 1 },
+                {
+                    delete =>
+                      Jifty->web->qualified_parent_region('no_items_found')
+                },
+                {
+                    element => Jifty->web->current_region->parent->get_element(
+                        'div.crud-list'),
+                    append => $self->fragment_for('view'),
+                    args   => {
+                        object_type => $object_type,
+                        id          => { result_of => $create, name => 'id' },
+                    },
+                },
+            ]
+        )
+    );
+};
+
+
+1;
+

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


More information about the Rt-commit mailing list