From 75315c2dad1760f37ef7ca891d45679aeef19ff9 Mon Sep 17 00:00:00 2001 From: garethbowen Date: Mon, 27 Jan 2014 15:46:46 +1300 Subject: [PATCH] Add help block elements for labels. So top level elements can have descriptions displayed. Issue: #58 --- static/js/settings.js | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/static/js/settings.js b/static/js/settings.js index c262e1f..2c229ea 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -237,30 +237,27 @@ $(function(){ function cleanUpJsonEdit() { - // hide spinner - $('#app_settings_schema .spinner').hide(); - - // make html more boostrap compatible - $('#app_settings_schema .je-field').addClass('control-group'); - - // move title/field description to div for better UX - $('#app_settings_schema .je-field').each(function(idx, el) { - var $input = $(el).children('input'), - text; - // top level .je-field element has no input child - if ($input.length === 0) { - return; - } - text = $input.attr('title'); - // no description property on json schema, skip - if (!text) { - return; - } - $input.parent().append( - '
' + text + '
' - ); - $input.removeAttr('title'); + // hide spinner + $('#app_settings_schema .spinner').hide(); + + // make html more boostrap compatible + $('#app_settings_schema .je-field').addClass('control-group'); + + // move title/field description to div for better UX + $('#app_settings_schema .je-field').each(function(idx, el) { + $(el).children('input, select, textarea, label').each(function(i, input) { + var $input = $(input), + text = $input.attr('title'); + // no description property on json schema, skip + if (!text) { + return; + } + $input.after( + '
' + text + '
' + ); + $input.removeAttr('title'); }); + }); }