|
|
@@ -742,99 +742,98 @@ var TableAjax = function() {
|
|
|
priv.popoverCellMoreFunctions = function(e) {
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
+ if (!e.data || !e.data.rowPK) {
|
|
|
+ if (priv.options.debug) console.log('NO data');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (priv.options.debug) console.log('TableAjax::popoverCellMoreFunctions: rowPK', e.data.rowPK, 'moreFunctions', e.data.more, 'rowFunctions', e.data.rowFunctions);
|
|
|
- if ('rowPK' in e.data && e.data.rowPK > 0) {
|
|
|
- var lastId = _popoverCell.data('rowid'),
|
|
|
- lastCol = _popoverCell.data('col'),
|
|
|
- rowPK = e.data.rowPK,
|
|
|
- moreFunctions = e.data.more,
|
|
|
- rowFunctions = e.data.rowFunctions,
|
|
|
- funcListNode
|
|
|
- ;
|
|
|
-
|
|
|
- if (lastId == e.data.rowPK && lastCol == 'moreFunctions') {
|
|
|
- //_popoverCellCurrent.popover('toggle');
|
|
|
- }
|
|
|
- else {
|
|
|
- if (_popoverCellCurrent) {
|
|
|
- _popoverCellCurrent.popover('destroy');
|
|
|
- }
|
|
|
+ var lastId = _popoverCell.data('rowid');
|
|
|
+ var lastCol = _popoverCell.data('col');
|
|
|
+ var rowPK = e.data.rowPK;
|
|
|
+ var moreFunctions = e.data.more;
|
|
|
+ var rowFunctions = e.data.rowFunctions;
|
|
|
+ var funcListNode;
|
|
|
+
|
|
|
+ if (lastId == e.data.rowPK && lastCol == 'moreFunctions') {
|
|
|
+ //_popoverCellCurrent.popover('toggle');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- _popoverCell.data('rowid', rowPK);
|
|
|
- _popoverCell.data('col', 'rowFunctions');
|
|
|
- _popoverCell.empty();
|
|
|
- funcListNode = $('<ul class="list-unstyled popoverRowFunctions"></ul>').appendTo(_popoverCell);
|
|
|
-
|
|
|
- moreFunctions.forEach(function(funcName) {
|
|
|
- var funcItemNode = $('<li></li>').appendTo(funcListNode),
|
|
|
- funObj = rowFunctions[funcName],
|
|
|
- funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true})
|
|
|
- ;
|
|
|
- funcNode.addClass('func_name-' + funcName);
|
|
|
- funcItemNode.append(funcNode);
|
|
|
- });
|
|
|
- { // TODO: id namesapce is AntAcl [ and has ref fields or back ref ]
|
|
|
- var funcItemNode = $('<li></li>').appendTo(funcListNode)
|
|
|
- var funObj = {
|
|
|
- ico: 'glyphicon glyphicon-random',
|
|
|
- label: 'Przeglądaj powiązania',
|
|
|
- href: 'index.php?_route=RefGraph&namespace=' + priv.options.namespace + '&primaryKey=' + rowPK,
|
|
|
- // onclick: function (e) { // TODO: open in
|
|
|
- // console.log('TODO: przeglądaj powiązania')
|
|
|
- // }
|
|
|
- }
|
|
|
- var funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, { ico: true, label: true })
|
|
|
- funcItemNode.append(funcNode);
|
|
|
- }
|
|
|
+ if (_popoverCellCurrent) {
|
|
|
+ _popoverCellCurrent.popover('destroy');
|
|
|
+ }
|
|
|
|
|
|
- _popoverCell.append('<div class="popoverCellContent" style="white-space:normal"></div>');
|
|
|
+ _popoverCell.data('rowid', rowPK);
|
|
|
+ _popoverCell.data('col', 'rowFunctions');
|
|
|
+ _popoverCell.empty();
|
|
|
+ funcListNode = $('<ul class="list-unstyled popoverRowFunctions"></ul>').appendTo(_popoverCell);
|
|
|
|
|
|
- _popoverCellCurrent = jQuery(e.currentTarget);
|
|
|
- // title : '<span class="text-info"><strong>title</strong></span> <button type="button" id="close" class="close">×</button>'
|
|
|
- var opts = {
|
|
|
- container: 'body',
|
|
|
- placement: 'right',
|
|
|
- trigger: 'click',
|
|
|
- template: '',
|
|
|
- html: true,
|
|
|
- content: _popoverCell.html()
|
|
|
- }
|
|
|
- opts.template += '<div class="popover" role="tooltip" style="max-width:600px;width:440px;">';
|
|
|
- {
|
|
|
- opts.template += '<div class="arrow"></div>';
|
|
|
- //opts.template += '<h3 class="popover-title"></h3>';
|
|
|
- opts.template += '<div style="display:block;position:relative;">';
|
|
|
- {
|
|
|
- opts.template += '<div class="popover-title">';
|
|
|
- opts.template += '</div>';
|
|
|
- opts.template += '<button type="button" class="close" onclick="return hidePopover();" style="position:absolute;right:8px;top:6px;">×</button>';
|
|
|
- }
|
|
|
- opts.template += '</div>';
|
|
|
- opts.template += '<div class="popover-content"></div>';
|
|
|
- }
|
|
|
+ moreFunctions.forEach(function(funcName) {
|
|
|
+ var funcItemNode = $('<li></li>').appendTo(funcListNode),
|
|
|
+ funObj = rowFunctions[funcName],
|
|
|
+ funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, {ico: true, label: true})
|
|
|
+ ;
|
|
|
+ funcNode.addClass('func_name-' + funcName);
|
|
|
+ funcItemNode.append(funcNode);
|
|
|
+ });
|
|
|
+ if (3 === priv.options.namespace.split('/').length) { // if namesapce is AntAcl [ and has ref fields or back ref ]
|
|
|
+ var funcItemNode = $('<li></li>').appendTo(funcListNode)
|
|
|
+ var funObj = {
|
|
|
+ ico: 'glyphicon glyphicon-random',
|
|
|
+ label: 'Przeglądaj powiązania',
|
|
|
+ href: 'index.php?_route=RefGraph&namespace=' + priv.options.namespace + '&primaryKey=' + rowPK,
|
|
|
+ // onclick: function (e) { // TODO: open in
|
|
|
+ // console.log('TODO: przeglądaj powiązania')
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ var funcNode = p5UI_TableAjax_generateFunctionNode(funObj, rowPK, { ico: true, label: true })
|
|
|
+ funcItemNode.append(funcNode);
|
|
|
+ }
|
|
|
+
|
|
|
+ _popoverCell.append('<div class="popoverCellContent" style="white-space:normal"></div>');
|
|
|
+
|
|
|
+ _popoverCellCurrent = jQuery(e.currentTarget);
|
|
|
+ // title : '<span class="text-info"><strong>title</strong></span> <button type="button" id="close" class="close">×</button>'
|
|
|
+ var opts = {
|
|
|
+ container: 'body',
|
|
|
+ placement: 'right',
|
|
|
+ trigger: 'click',
|
|
|
+ template: '',
|
|
|
+ html: true,
|
|
|
+ content: _popoverCell.html()
|
|
|
+ }
|
|
|
+ opts.template += '<div class="popover" role="tooltip" style="max-width:600px;width:440px;">';
|
|
|
+ {
|
|
|
+ opts.template += '<div class="arrow"></div>';
|
|
|
+ //opts.template += '<h3 class="popover-title"></h3>';
|
|
|
+ opts.template += '<div style="display:block;position:relative;">';
|
|
|
+ {
|
|
|
+ opts.template += '<div class="popover-title">';
|
|
|
opts.template += '</div>';
|
|
|
+ opts.template += '<button type="button" class="close" onclick="return hidePopover();" style="position:absolute;right:8px;top:6px;">×</button>';
|
|
|
+ }
|
|
|
+ opts.template += '</div>';
|
|
|
+ opts.template += '<div class="popover-content"></div>';
|
|
|
+ }
|
|
|
+ opts.template += '</div>';
|
|
|
+
|
|
|
+ _popoverCellCurrent.popover(opts);
|
|
|
+ _popoverCellCurrent.on('shown.bs.popover', function(e) {
|
|
|
+ if (!_popoverCellCurrent) return;
|
|
|
+ var popoverNodeId = _popoverCellCurrent.attr('aria-describedby');
|
|
|
+ if (!popoverNodeId) return;
|
|
|
+ var popover$Node = jQuery('#' + popoverNodeId);
|
|
|
+ if (!popover$Node.length) return;
|
|
|
+ var arrow$Node = popover$Node.children('.arrow');
|
|
|
+ if (arrow$Node.length) {
|
|
|
+ var posTop = parseFloat(arrow$Node.css('top'));
|
|
|
+ arrow$Node.css('top', '' + posTop + 'px')
|
|
|
+ }
|
|
|
+ popover$Node.find('.popoverCellContent').html('<p class="text-muted">Pobieranie funkcji...<p>');
|
|
|
+ priv.ajaxLoadMoreFunctionsCell(rowPK);
|
|
|
+ });
|
|
|
+ _popoverCellCurrent.popover('show');
|
|
|
|
|
|
- _popoverCellCurrent.popover(opts);
|
|
|
- _popoverCellCurrent.on('shown.bs.popover', function(e) {
|
|
|
- if (!_popoverCellCurrent) return;
|
|
|
- var popoverNodeId = _popoverCellCurrent.attr('aria-describedby');
|
|
|
- if (!popoverNodeId) return;
|
|
|
- var popover$Node = jQuery('#' + popoverNodeId);
|
|
|
- if (!popover$Node.length) return;
|
|
|
- var arrow$Node = popover$Node.children('.arrow');
|
|
|
- if (arrow$Node.length) {
|
|
|
- var posTop = parseFloat(arrow$Node.css('top'));
|
|
|
- arrow$Node.css('top', '' + posTop + 'px')
|
|
|
- }
|
|
|
- popover$Node.find('.popoverCellContent').html('<p class="text-muted">Pobieranie funkcji...<p>');
|
|
|
- priv.ajaxLoadMoreFunctionsCell(rowPK);
|
|
|
- });
|
|
|
- _popoverCellCurrent.popover('show');
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (priv.options.debug) console.log('NO data');
|
|
|
- return false;
|
|
|
- }
|
|
|
return;
|
|
|
};
|
|
|
|