Skip to content

Commit

Permalink
Add help block elements for labels.
Browse files Browse the repository at this point in the history
So top level elements can have descriptions displayed.

Issue: garden20#58
  • Loading branch information
garethbowen committed Jan 27, 2014
1 parent 17808ab commit 75315c2
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'<div class="help-block">' + text + '</div>'
);
$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(
'<div class="help-block">' + text + '</div>'
);
$input.removeAttr('title');
});
});
}


Expand Down

0 comments on commit 75315c2

Please sign in to comment.