mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Fixed pop-help directive so clicking on a help icon or button closes all other help windows. Prior to this help windows would remain open. Clicking on multiple help icons/buttons left help windows allover the screen, especially on Job Template page.
This commit is contained in:
parent
2bb77dd2ad
commit
6295efd330
@ -90,7 +90,7 @@ angular.module('JobTemplateFormDefinition', [])
|
||||
type: 'number',
|
||||
integer: true,
|
||||
min: 0,
|
||||
max: 100,
|
||||
max: 100000000,
|
||||
slider: true,
|
||||
"class": 'input-mini',
|
||||
"default": '0',
|
||||
|
||||
@ -46,7 +46,9 @@ angular.module('GroupListDefinition', [])
|
||||
mode: 'all',
|
||||
'class': 'btn-small btn-info',
|
||||
awToolTip: 'Click for help',
|
||||
dataTitle: 'Adding Groups'
|
||||
dataTitle: 'Adding Groups',
|
||||
id: 'group-help-button',
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -38,7 +38,8 @@ angular.module('HostListDefinition', [])
|
||||
'class': 'btn-small btn-info',
|
||||
awToolTip: 'Click for help',
|
||||
dataTitle: 'Selecting Hosts',
|
||||
iconSize: 'large'
|
||||
iconSize: 'large',
|
||||
id: 'host-help-button'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -94,7 +94,8 @@ angular.module('JobHostDefinition', [])
|
||||
'class': 'btn-info btn-mini btn-help',
|
||||
awToolTip: 'Click for help',
|
||||
dataTitle: 'Job Host Summary',
|
||||
iconSize: 'large'
|
||||
iconSize: 'large',
|
||||
id: 'jobhost-help-button'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -206,7 +206,18 @@ angular.module('AWDirectives', ['RestServices'])
|
||||
var title = (attrs.title != undefined && attrs.title != null) ? attrs.title : 'Help';
|
||||
var container = (attrs.container !== undefined) ? attrs.container : false;
|
||||
$(element).popover({ placement: placement, delay: 0, title: title,
|
||||
content: attrs.awPopOver, delay: 0, trigger: 'click', html: true, container: container });
|
||||
content: attrs.awPopOver, trigger: 'manual', html: true, container: container });
|
||||
$(element).click(function() {
|
||||
var me = $(this).attr('id');
|
||||
$('.help-link, .help-link-white').each( function(index) {
|
||||
if (me != $(this).attr('id')) {
|
||||
$(this).popover('hide');
|
||||
}
|
||||
else {
|
||||
$(this).popover('toggle');
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).bind('keydown', function(e) {
|
||||
if (e.keyCode === 27) {
|
||||
$(element).popover('hide');
|
||||
|
||||
@ -236,7 +236,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += "<label class=\"control-label";
|
||||
html += (field.labelClass) ? " " + field.labelClass : "";
|
||||
html += "\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += (field.icon) ? this.icon(field.icon) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
@ -308,7 +308,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
|
||||
if (field.label !== false) {
|
||||
html += "<label class=\"control-label\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
}
|
||||
@ -356,7 +356,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.ngShow) ? this.attr(field,'ngShow') : "";
|
||||
html += ">\n";
|
||||
html += "<label class=\"control-label\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
html += "<select ";
|
||||
@ -390,7 +390,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.ngShow) ? this.attr(field,'ngShow') : "";
|
||||
html += ">\n";
|
||||
html += "<label class=\"control-label\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
// Use 'text' rather than 'number' so that our integer directive works correctly
|
||||
@ -448,7 +448,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.checked) ? "checked " : "";
|
||||
html += (field.readonly) ? "disabled " : "";
|
||||
html += " /> " + field.label + "\n";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += "</label>\n";
|
||||
html += "<span class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></span>\n";
|
||||
html += "</div>\n";
|
||||
@ -463,7 +463,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.ngShow) ? this.attr(field,'ngShow') : "";
|
||||
html += ">\n";
|
||||
html += "<label class=\"control-label\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
for (var i=0; i < field.options.length; i++) {
|
||||
@ -504,7 +504,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.ngShow) ? this.attr(field,'ngShow') : "";
|
||||
html += ">\n";
|
||||
html += "<label class=\"control-label\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<div class=\"controls\">\n";
|
||||
html += "<div class=\"input-prepend\">\n";
|
||||
@ -547,7 +547,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += "<label class=\"control-label";
|
||||
html += (field.labelClass) ? " " + field.labelClass : "";
|
||||
html += "\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver') : "";
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += (field.icon) ? this.icon(field.icon) : "";
|
||||
html += (field.label) ? field.label : '';
|
||||
html += '</label>' + "\n";
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
||||
|
||||
.factory('Attr', function() {
|
||||
return function(obj, key) {
|
||||
return function(obj, key, fld) {
|
||||
var result;
|
||||
var value = (typeof obj[key] === "string") ? obj[key].replace(/[\'\"]/g, '"') : obj[key];
|
||||
switch(key) {
|
||||
@ -49,7 +49,7 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
||||
break;
|
||||
case 'awPopOver':
|
||||
// construct the entire help link
|
||||
result = "<a href=\"\" aw-pop-over=\"" + value + "\" ";
|
||||
result = "<a id=\"awp-" + fld + "\" href=\"\" aw-pop-over=\"" + value + "\" ";
|
||||
result += (obj.dataTitle) ? "data-title=\"" + obj['dataTitle'].replace(/[\'\"]/g, '"') + "\" " : "";
|
||||
result += (obj.dataPlacement) ? "data-placement=\"" + obj['dataPlacement'].replace(/[\'\"]/g, '"') + "\" " : "";
|
||||
result += (obj.dataContainer) ? "data-container=\"" + obj['dataContainer'].replace(/[\'\"]/g, '"') + "\" " : "";
|
||||
|
||||
@ -34,7 +34,9 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
||||
var html = '';
|
||||
html += "<button " + this.attr(btn, 'ngClick') + "class=\"btn";
|
||||
html += (btn['class']) ? " " + btn['class'] : " btn-small";
|
||||
html += (btn['awPopOver']) ? " help-link-white" : "";
|
||||
html += "\" ";
|
||||
html += (btn.id) ? "id=\"" + btn.id + "\" " : "";
|
||||
html += (btn.ngHide) ? this.attr(btn,'ngHide') : "";
|
||||
html += (btn.awToolTip) ? this.attr(btn,'awToolTip') : "";
|
||||
html += (btn.awToolTip && btn.dataPlacement == undefined) ? "data-placement=\"top\" " : "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user