From 58b6b9ff93e8dd2850feed2c92aadd17923e634d Mon Sep 17 00:00:00 2001 From: Yomi Colledge Date: Fri, 25 Jun 2010 15:38:24 +0100 Subject: [PATCH] General cleanup --- public/javascripts/form.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/public/javascripts/form.js b/public/javascripts/form.js index c686a4fc..50bb6407 100644 --- a/public/javascripts/form.js +++ b/public/javascripts/form.js @@ -28,21 +28,19 @@ $(document).ready(function() { }); $("a.display_form").live("click",function(event) { - var link = $(this); - var id_attribute_name = link.attr('id').split('_'); - var title_array = link.text().split(' '); + var link = $(this), + id_attribute_name = link.attr('id').split('_'), + title_array = link.text().split(' '), + prefix = ''; $('form').toggle(function() { - if('view' == link.text().substr(0,4)) { - link.text('hide ' + title_array[1]); - } else { - link.text('view ' + title_array[1]); - } + prefix = ('view' == link.text().substr(0,4))? 'hide ' : 'view '; + link.text(prefix + title_array[1]); }); }); // Disable autocomplete for our imput elements $('input').attr('autocomplete','off'); - + $('fieldset.views').hide(); $('fieldset.inputs > ol li').generateFormatasticTooltips(); }); \ No newline at end of file