Skip to content

Commit

Permalink
Fixes theforeman#5169 - Error in smart class param or value cause tab…
Browse files Browse the repository at this point in the history
… header to turn red in Puppet Class edit form
  • Loading branch information
orrabin authored and dLobatog committed Nov 17, 2014
1 parent 7a347c6 commit 3d42bbe
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/assets/javascripts/application.js
Expand Up @@ -55,14 +55,16 @@ function onContentLoad(){
}

// highlight tabs with errors
$(".tab-content").find(".form-group.has-error").each(function(index) {
var id = $(this).parentsUntil(".tab-content").last().attr("id");
$("a[href=#"+id+"]").addClass("tab-error");

// focus on first tab with error
if (index == 0) {
$("a[href=#"+id+"]").click();
}
$(".tab-content").find(".form-group.has-error").each(function(i){
$(this).parents(".tab-pane").each(function(index, item) {
var id = $(item).attr('id');
$("a[href=#"+id+"]").addClass("tab-error");

// focus on first field in first tab with error
if (index == 0 && i==0) {
$("a[href=#"+id+"]").click();
}
})
})

//set the tooltips
Expand Down

0 comments on commit 3d42bbe

Please sign in to comment.