Added tooltips to host/group/extra variables using TB popover. Fixed bugs on Inventory detail page causing js errors. Added JSON validation to extra_vars on Job Templates add/edit page. Always grey-out/disable fields on Jobs detail page because upading a Pending job throws a 405 error -will investigate with CC later.

This commit is contained in:
chouseknecht
2013-05-27 13:18:15 -04:00
parent 2a0f528954
commit e61a966464
11 changed files with 133 additions and 77 deletions

View File

@@ -130,5 +130,43 @@ angular.module('AWDirectives', ['RestServices'])
})
}
}
}]);
}])
/*
* Enable TB tooltips. To add a tooltip to an element, include the following directive in
* the element's attributes:
*
* aw-tool-tip="<< tooltip text here >>"
*
* Include the standard TB data-XXX attributes to controll a tooltip's appearance. We will
* default placement to the left and delay to 2 seconds.
*/
.directive('awToolTip', function() {
return function(scope, element, attrs) {
var delay = (attrs.delay != undefined && attrs.delay != null) ? attrs.delay : $AnsibleConfig.tooltip_delay;
var placement = (attrs.placement != undefined && attrs.placement != null) ? attrs.placement : 'left';
$(element).tooltip({ placement: placement, delay: delay, title: attrs.awToolTip });
}
})
/*
* Enable TB pop-overs. To add a pop-over to an element, include the following directive in
* the element's attributes:
*
* aw-pop-over="<< pop-over html here >>"
*
* Include the standard TB data-XXX attributes to controll the pop-over's appearance. We will
* default placement to the left, delay to 0 seconds, content type to HTML, and title to 'Help'.
*/
.directive('awPopOver', function() {
return function(scope, element, attrs) {
var placement = (attrs.placement != undefined && attrs.placement != null) ? attrs.placement : 'left';
var title = (attrs.title != undefined && attrs.title != null) ? attrs.title : 'Help';
$(element).popover({ placement: placement, delay: 0, title: title,
content: attrs.awPopOver, delay: 0, trigger: 'click', html: true });
}
});

View File

@@ -40,6 +40,15 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
case 'awToolTip':
result = "aw-tool-tip=\"" + obj[key] + "\" ";
break;
case 'awPopOver':
result = "aw-pop-over='" + obj[key] + "' ";
break;
case 'dataTitle':
result = "data-title=\"" + obj[key] + "\" ";
break;
case 'dataPlacement':
result = "data-placement=\"" + obj[key] + "\" ";
break;
default:
result = key + "=\"" + obj[key] + "\" ";
}
@@ -226,7 +235,14 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
html += "<div class=\"control-group\""
html += (field.ngShow) ? this.attr(field,'ngShow') : "";
html += ">\n";
html += "<label class=\"control-label\" for=\"" + fld + '">' + field.label + '</label>' + "\n";
html += "<label class=\"control-label\" for=\"" + fld + '">';
if (field.awPopOver) {
html += "<a href=\"\" " + this.attr(field,'awPopOver');
html += (field.dataTitle) ? this.attr(field, 'dataTitle') : "";
html += (field.dataPlacement) ? this.attr(field, 'dataPlacement') : "";
html += "><i class=\"icon-info-sign\"></i></a> ";
}
html += field.label + '</label>' + "\n";
html += "<div class=\"controls\">\n";
html += "<textarea ";
html += (field.rows) ? this.attr(field, 'rows') : "";

View File

@@ -1,23 +0,0 @@
/************************************
* Copyright (c) 2013 AnsibleWorks, Inc.
*
*
* tooltip.js
*
* Custom directive to enable TB tooltips. To add a tooltip to an element, include the following directive in
* the element's attributes:
*
* aw-tool-tip="<< tooltip text here >>"
*
* Include the standard TB data-XXX attributes to controll a tooltip's appearance. We will default placement
* to the left and delay to 2 seconds.
*
*/
angular.module('AWToolTip', [])
.directive('awToolTip', function() {
return function(scope, element, attrs) {
var delay = (attrs.delay != undefined && attrs.delay != null) ? attrs.delay : $AnsibleConfig.tooltip_delay;
var placement = (attrs.placement != undefined && attrs.placement != null) ? attrs.placement : 'left';
$(element).tooltip({ placement: placement, delay: delay, title: attrs.awToolTip });
}
});