[Rt-commit] rt branch, development, updated. a1b3cd358ebbb3e221251f10e2ca9184b3326ce6

Thomas Sibley trs at bestpractical.com
Mon Jul 19 17:07:18 EDT 2010


The branch, development has been updated
       via  a1b3cd358ebbb3e221251f10e2ca9184b3326ce6 (commit)
      from  44e7fa9caaca81939eded8f04ea728a6c1848500 (commit)

Summary of changes:
 lib/RT/View/SetupWizard.pm |   47 +++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

- Log -----------------------------------------------------------------
commit a1b3cd358ebbb3e221251f10e2ca9184b3326ce6
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Jul 19 17:08:50 2010 -0400

    Refactor the config field doc javascript

diff --git a/lib/RT/View/SetupWizard.pm b/lib/RT/View/SetupWizard.pm
index 70c3a7a..86530f6 100644
--- a/lib/RT/View/SetupWizard.pm
+++ b/lib/RT/View/SetupWizard.pm
@@ -60,6 +60,7 @@ sub setup_page (&) {
         form {
             $code->($self);
         };
+        show '_config_javascript';
     };
 }
 
@@ -119,12 +120,6 @@ template 'root' => setup_page {
     show 'buttons', for => 'root';
 };
 
-# root password
-# rtname, timezone
-# web (base url, port, + rt stuff?)
-# email
-# turn off SetupMode in finish
-
 template 'organization' => setup_page {
     h2 { _("Organization basics") };
 
@@ -133,33 +128,21 @@ template 'organization' => setup_page {
     my $config = new_action( class => 'RT::Action::ConfigSystem' );
     my $meta = $config->metadata;
 
-    my $this = 'jQuery(this).parent().parent().find(".doc")';
-
     for my $field (qw( rtname organization time_zone )) {
         div {{ class is 'config-field' };
-            render_param(
-                $config => $field,
-                # Slide up everything else and slide down this doc
-                onfocus => "jQuery('.config-field .doc').not($this).slideUp(); $this.slideDown();",
-            );
+            render_param( $config => $field );
             div {{ class is 'doc' };
                 outs_raw( $meta->{$field}{'doc'} )
             } if $meta->{$field} and defined $meta->{$field}{'doc'};
         };
     }
 
-    script {
-        outs_raw(<<'JSEND');
-jQuery(function() {
-    jQuery('.config-field .doc').hide();
-    jQuery('.config-field .widget')[0].focus();
-});
-JSEND
-    };
-    
     show 'buttons', for => 'organization';
 };
 
+# web (base url, port, + rt stuff?)
+# email
+
 template 'basics' => sub {
 
     p { _("You may change basic information about your RT install.") };
@@ -208,5 +191,25 @@ EOT
     form_submit( label => 'Turn off Setup Mode and go to RT' );
 };
 
+private template '_config_javascript' => sub {
+    script {
+        outs_raw(<<'JSEND');
+jQuery(function() {
+    jQuery('.config-field .widget').focus(
+        function(){
+            var thisdoc = jQuery(this).parent().parent().find(".doc");
+
+            // Slide up everything else and slide down this doc
+            jQuery('.config-field .doc').not(thisdoc).slideUp();
+            thisdoc.slideDown();
+        }
+    );
+    jQuery('.config-field .doc').hide();
+    jQuery('.config-field .widget')[0].focus();
+});
+JSEND
+    };
+};
+
 1;
 

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


More information about the Rt-commit mailing list