Fixed popup and inline help toggle issues.

This commit is contained in:
kunw 2016-12-08 13:23:02 +08:00
parent 68ab0e5efc
commit 3d9d106acb
5 changed files with 15 additions and 29 deletions

View File

@ -188,14 +188,13 @@
return directive;
function link(scope, element, attrs, ctrl) {
$(document).on('click', clickHandler);
function clickHandler(e) {
$('[data-toggle="popover"]').each(function () {
if (!$(this).is(e.target) &&
$(this).has(e.target).length === 0 &&
$('.popover').has(e.target).length === 0) {
$(this).parent().popover('hide');
$('[data-toggle="popover"],[data-original-title]').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
(($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false;
}
});
var targetId = $(e.target).attr('id');

View File

@ -1,17 +1,3 @@
<!--
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<a role="button" tab-index="0" data-trigger="focus" data-toggle="popover" data-placement="right" data-title="//vm.helpTitle//">
<a href="javascript:void(0);" role="button" tabindex="0" data-trigger="focus" data-toggle="popover" data-placement="right">
<span class="glyphicon glyphicon-info-sign"></span>
</a>

View File

@ -29,6 +29,7 @@
'helpTitle': '@',
'content': '@'
},
'replace': true,
'link': link,
'controller': InlineHelpController,
'controllerAs': 'vm',

View File

@ -1,4 +1,3 @@
<a href="javascript:void(0)">
<span class="glyphicon glyphicon-info-sign" role="button" data-trigger="click" data-toggle="popover" data-placement="right">
</span>
<a href="javascript:void(0);" role="button" tabindex="0" data-trigger="click" data-toggle="popover" data-placement="right">
<span class="glyphicon glyphicon-info-sign"></span>
</a>

View File

@ -27,7 +27,7 @@
}
popupDetails.$inject = ['ListManifestService', '$filter', 'dateLFilter'];
function popupDetails(ListManifestService, $filter, dateLFilter) {
var directive = {
'restrict': 'E',
@ -46,6 +46,7 @@
return directive;
function link(scope, element, attrs, ctrl) {
element
.popover({
'template': '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-title"></div><div class="popover-content"></div></div>',
@ -68,16 +69,16 @@
ctrl.manifest['created'] = $filter('dateL')(ctrl.manifest['created'], 'YYYY-MM-DD HH:mm:ss');
}
})
.on('inserted.bs.popover', function(e){
var self = jQuery(this);
.on('inserted.bs.popover', function(e){
var self = jQuery(this);
$('[type="text"]:input', self.parent())
.on('click', function() {
.on('click', function(e) {
$(this).select();
});
self.parent().find('.glyphicon.glyphicon-remove-circle').on('click', function() {
element.trigger('click');
self.trigger('click');
});
});
});
function generateContent() {
var content = '<form class="form-horizontal" width="100%">' +