[Rt-commit] rt branch, 3.999-trunk, updated. 9b52f01aa7da2a46c5b15b4928c7e6857710b671
sartak at bestpractical.com
sartak at bestpractical.com
Fri Nov 20 16:05:05 EST 2009
The branch, 3.999-trunk has been updated
via 9b52f01aa7da2a46c5b15b4928c7e6857710b671 (commit)
from 2da50d21210eacbd22f43bf95efdc37dca6ff301 (commit)
Summary of changes:
lib/RT/Dispatcher.pm | 12 ++++++++++++
lib/RT/Model/QueueCollection.pm | 1 -
lib/RT/View/Ticket/Create.pm | 28 +++++++++++++++++++++++-----
3 files changed, 35 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit 9b52f01aa7da2a46c5b15b4928c7e6857710b671
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Nov 20 16:04:46 2009 -0500
When you try to go to /ticket/create without a queue, show an intermediate page with clickable queues
diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index 4a8cf1a..b801e14 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -746,6 +746,18 @@ before qr{^/Search/Build.html} => run {
};
+on '/ticket/create' => run {
+ my $action = Jifty->web->request->action('create_ticket');
+ my $queue = $action ? $action->argument('queue') : get('queue');
+ if (!defined($queue)) {
+ show '/ticket/select-queue-for-create';
+ }
+ else {
+ set(queue => $queue);
+ show '/ticket/create';
+ }
+};
+
# Backward compatibility with old RT URLs
before '/NoAuth/Logout.html' => run { redirect '/logout' };
diff --git a/lib/RT/Model/QueueCollection.pm b/lib/RT/Model/QueueCollection.pm
index 7a32849..b24dcb0 100755
--- a/lib/RT/Model/QueueCollection.pm
+++ b/lib/RT/Model/QueueCollection.pm
@@ -131,6 +131,5 @@ sub add_record {
$self->SUPER::add_record($Queue);
}
-
1;
diff --git a/lib/RT/View/Ticket/Create.pm b/lib/RT/View/Ticket/Create.pm
index f56b4bb..708fe6b 100644
--- a/lib/RT/View/Ticket/Create.pm
+++ b/lib/RT/View/Ticket/Create.pm
@@ -54,11 +54,7 @@ use Jifty::View::Declare -base;
__PACKAGE__->use_mason_wrapper;
template 'create' => page { title => _('Create a new ticket') } content {
- # If we have a create_ticket action, pluck the queue out, otherwise,
- # check the regular queue query parameter
- my $action = Jifty->web->request->action('create_ticket');
- my $queue = $action ? $action->argument('queue') : get('queue');
- $queue or die "Queue not specified";
+ my $queue = get('queue');
my $create = new_action(
class => 'CreateTicket',
@@ -74,5 +70,27 @@ template 'create' => page { title => _('Create a new ticket') } content {
};
};
+template 'select-queue-for-create' =>
+page { title => _('Create a new ticket') }
+content {
+ my $queues = RT::Model::QueueCollection->new;
+ $queues->unlimit;
+
+ p { _("Please select a queue for your new ticket.") };
+ ul {
+ while (my $queue = $queues->next) {
+ li {
+ hyperlink(
+ label => $queue->name,
+ url => '/ticket/create',
+ parameters => {
+ queue => $queue->id,
+ },
+ );
+ }
+ }
+ }
+};
+
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list