[Rt-commit] rt branch, lcore, updated. 0202a0e8a1e9f781ba8ffbb7fb5e802203ad240b
jesse
jesse at bestpractical.com
Wed Oct 7 19:50:50 EDT 2009
The branch, lcore has been updated
via 0202a0e8a1e9f781ba8ffbb7fb5e802203ad240b (commit)
from eff84089cea534b09310615d082015cb4784ae4a (commit)
Summary of changes:
lib/RT/Model/Rule.pm | 6 +++---
lib/RT/View/Admin/Rules.pm | 3 ++-
lib/RT/View/Form/Field/RuleTextarea.pm | 31 +++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+), 4 deletions(-)
create mode 100644 lib/RT/View/Form/Field/RuleTextarea.pm
- Log -----------------------------------------------------------------
commit 0202a0e8a1e9f781ba8ffbb7fb5e802203ad240b
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Oct 7 19:50:34 2009 -0400
First step toward generalizing the rules editor to work for each of the three rule textboxes
diff --git a/lib/RT/Model/Rule.pm b/lib/RT/Model/Rule.pm
index f0fab9b..2671f19 100644
--- a/lib/RT/Model/Rule.pm
+++ b/lib/RT/Model/Rule.pm
@@ -65,9 +65,9 @@ use base qw'RT::Record';
sub table {'Rules'}
use Jifty::DBI::Schema;
use Jifty::DBI::Record schema {
- column action_code => type is 'text', render as 'textarea';
- column condition_code => type is 'text', render as 'textarea';
- column prepare_code => type is 'text', render as 'textarea';
+ column action_code => type is 'text', render as 'RT::View::Form::Field::RuleTextarea';
+ column condition_code => type is 'text', render as 'RT::View::Form::Field::RuleTextarea';
+ column prepare_code => type is 'text', render as 'RT::View::Form::Field::RuleTextarea';
column description => type is 'text';
};
use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata map => {
diff --git a/lib/RT/View/Admin/Rules.pm b/lib/RT/View/Admin/Rules.pm
index ccb9815..aff89f8 100644
--- a/lib/RT/View/Admin/Rules.pm
+++ b/lib/RT/View/Admin/Rules.pm
@@ -90,7 +90,7 @@ template 'edit' => page {
show('./update');
div { { id is 'expressionbuilder' } };
-outs_raw(q{<script type="text/javascript">
+if (0) {outs_raw(q{<script type="text/javascript">
jQuery(function() {
jQuery._span_({'class': 'edit-with-rulebuilder'}).text("...")
.insertAfter("textarea.argument-condition_code")
@@ -106,6 +106,7 @@ jQuery(function() {
});
</script>
});
+}
};
1;
diff --git a/lib/RT/View/Form/Field/RuleTextarea.pm b/lib/RT/View/Form/Field/RuleTextarea.pm
new file mode 100644
index 0000000..c003375
--- /dev/null
+++ b/lib/RT/View/Form/Field/RuleTextarea.pm
@@ -0,0 +1,31 @@
+package RT::View::Form::Field::RuleTextarea;
+use warnings;
+use strict;
+use Jifty::View::Declare;
+use base 'Jifty::Web::Form::Field::Textarea';
+
+sub render_widget {
+ my $self = shift;
+ $self->SUPER::render_widget(@_);
+ $self->render_rulebuilder_launcher();
+ '';
+}
+
+sub render_rulebuilder_launcher {
+ Jifty->web->out('
+<input type="submit" value="Edit!" onclick="RuleBuilder.load_and_edit_lambda([
+ { expression: \'ticket\',
+ type: \'RT::Model::Ticket\'
+ },
+ { expression: \'transaction\',
+ type: \'RT::Model::Transaction\'
+ }
+], \'Bool\', this) ;"/>
+
+
+ ');
+
+
+}
+1;
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list