[Rt-commit] r19274 - in rt/3.999/trunk/lib/RT/View: Admin
sartak at bestpractical.com
sartak at bestpractical.com
Fri Apr 17 20:09:26 EDT 2009
Author: sartak
Date: Fri Apr 17 20:09:26 2009
New Revision: 19274
Modified:
rt/3.999/trunk/lib/RT/View/Admin/Groups.pm
rt/3.999/trunk/lib/RT/View/CRUD.pm
Log:
Factor the ugly form field overriding out into the superclass
Modified: rt/3.999/trunk/lib/RT/View/Admin/Groups.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/View/Admin/Groups.pm (original)
+++ rt/3.999/trunk/lib/RT/View/Admin/Groups.pm Fri Apr 17 20:09:26 2009
@@ -76,28 +76,13 @@
my $self = shift;
my %args = @_;
- my $id = $args{action}->argument_value('id');
-
- my $field = $args{action}->form_field($args{field}, render_mode => 'read');
-
- # I don't see a clean way to do this :(
- $field->render_wrapper_start();
- $field->render_preamble();
-
- $field->render_label();
-
- # render the value with a hyperlink
- span {
- attr { class is "@{[ $field->classes ]} value" };
+ $self->view_via_callback(%args, callback => sub {
+ my %args = @_;
hyperlink(
- label => "@{[$field->current_value]}",
- url => "/Admin/Groups/Modify.html?id=$id",
+ label => $args{current_value},
+ url => "/Admin/Groups/Modify.html?id=$args{id}",
);
- };
-
- $field->render_wrapper_end();
-
- return;
+ });
}
1;
Modified: rt/3.999/trunk/lib/RT/View/CRUD.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/View/CRUD.pm (original)
+++ rt/3.999/trunk/lib/RT/View/CRUD.pm Fri Apr 17 20:09:26 2009
@@ -79,4 +79,30 @@
}
};
+sub view_via_callback {
+ my $self = shift;
+ my %args = @_;
+
+ my $field = $args{action}->form_field($args{field}, render_mode => 'read');
+
+ $args{id} = $args{action}->argument_value('id');
+ $args{current_value} = "@{[$field->current_value]}";
+
+ # I don't see a clean way to do this :(
+ $field->render_wrapper_start();
+ $field->render_preamble();
+
+ $field->render_label();
+
+ # render the value with a hyperlink
+ span {
+ attr { class is "@{[ $field->classes ]} value" };
+ $args{callback}->(%args);
+ };
+
+ $field->render_wrapper_end();
+
+ return;
+}
+
1;
More information about the Rt-commit
mailing list