[Rt-commit] rt branch, create-action, updated. e71b7168dc7c3e435ff5812374631f01bf09ba0d
sartak at bestpractical.com
sartak at bestpractical.com
Wed Sep 23 10:19:18 EDT 2009
The branch, create-action has been updated
via e71b7168dc7c3e435ff5812374631f01bf09ba0d (commit)
from 84f8579dff7ff4be51a0222672fdc29e388fab57 (commit)
Summary of changes:
lib/RT/Action/CreateTicket.pm | 38 ++++++++++++++++++++++++++++++--------
lib/RT/View/Ticket/Create.pm | 6 ++++--
2 files changed, 34 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit e71b7168dc7c3e435ff5812374631f01bf09ba0d
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Sep 23 10:19:03 2009 -0400
Make datetime parameters more customizable
diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index f13370b..6282ae9 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -60,14 +60,6 @@ use Jifty::Action schema {
render as 'text', # should be duration
display_length is 3,
label is _('Time Left');
-
- param starts =>
- render as 'DateTime',
- label is _('Starts');
-
- param due =>
- render as 'DateTime',
- label is _('Due');
};
sub after_set_queue {
@@ -96,6 +88,16 @@ sub after_set_queue {
hints => _('(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <strong>will</strong> receive future updates.)'),
);
+ $self->add_datetime_parameter(
+ name => 'starts',
+ label => _('Starts'),
+ );
+
+ $self->add_datetime_parameter(
+ name => 'due',
+ label => _('Due'),
+ );
+
$self->add_link_parameter(
name => 'depends_on',
label => _('Depends on'),
@@ -135,6 +137,11 @@ sub role_group_parameters {
return @{ $self->{_role_group_parameters} || [] };
}
+sub datetime_parameters {
+ my $self = shift;
+ return @{ $self->{_datetime_parameters} || [] };
+}
+
sub link_parameters {
my $self = shift;
return @{ $self->{_link_parameters} || [] };
@@ -200,6 +207,21 @@ sub add_role_group_parameter {
));
}
+sub add_datetime_parameter {
+ my $self = shift;
+ my %args = @_;
+
+ my $name = delete $args{name};
+
+ push @{ $self->{_datetime_parameters} }, $name;
+
+ $self->fill_parameter($name => (
+ render_as => 'DateTime',
+ display_length => 10,
+ %args,
+ ));
+}
+
sub add_link_parameter {
my $self = shift;
my %args = @_;
diff --git a/lib/RT/View/Ticket/Create.pm b/lib/RT/View/Ticket/Create.pm
index 7ef7e2d..e99f42c 100644
--- a/lib/RT/View/Ticket/Create.pm
+++ b/lib/RT/View/Ticket/Create.pm
@@ -138,8 +138,10 @@ sub show_details {
hr {};
- render_param($create, 'starts');
- render_param($create, 'due');
+ for my $datetime_type ($create->datetime_parameters) {
+ render_param($create, $datetime_type);
+ }
+
hr {};
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list