diff --git a/platypush/backend/http/static/js/application.js b/platypush/backend/http/static/js/application.js index 83768316c4..8534fe3a44 100644 --- a/platypush/backend/http/static/js/application.js +++ b/platypush/backend/http/static/js/application.js @@ -145,7 +145,7 @@ $(document).ready(function() { }; var initModalOpenBindings = function() { - $('body').on('click touch', '[data-modal]', function(event) { + $('body').on('mouseup touchend', '[data-modal]', function(event) { var $source = $(event.target); var $modal = $($source.data('modal')); $modal.fadeIn(); @@ -153,11 +153,20 @@ $(document).ready(function() { }; var initModalCloseBindings = function() { - $('body').on('click touch', '[data-dismiss-modal]', function(event) { + $('body').on('mouseup touchend', '[data-dismiss-modal]', function(event) { var $source = $(event.target); var $modal = $($source.data('dismiss-modal')); $modal.fadeOut(); }); + + $('body').on('mouseup touchend', function(event) { + var $source = $(event.target); + if (!$source.parents('.modal').length + && !$source.data('modal') + && !$source.data('dismiss-modal')) { + $('.modal').filter(':visible').fadeOut(); + } + }); }; var initModals = function() { diff --git a/platypush/backend/http/static/js/dashboard.js b/platypush/backend/http/static/js/dashboard.js index 2270a4c5bc..274cfa8398 100644 --- a/platypush/backend/http/static/js/dashboard.js +++ b/platypush/backend/http/static/js/dashboard.js @@ -7,6 +7,21 @@ $(document).ready(function() { for (var key of Object.keys(event.args)) { $widget.find('[data-bind=' + key + ']').text(event.args[key]); } + } else if (event.args.type == 'platypush.message.event.web.DashboardIframeUpdateEvent') { + var url = event.args.url; + var $modal = $('#iframe-modal'); + var $iframe = $modal.find('iframe'); + $iframe.attr('src', url); + $iframe.prop('width', event.args.width || '100%'); + $iframe.prop('height', event.args.height || '600'); + + if ('timeout' in event.args) { + setTimeout(function() { + $modal.fadeOut(); + }, parseFloat(event.args.timeout) * 1000); + } + + $modal.fadeIn(); } }; diff --git a/platypush/backend/http/templates/dashboard.html b/platypush/backend/http/templates/dashboard.html index ff77e030a0..5a5d77596b 100644 --- a/platypush/backend/http/templates/dashboard.html +++ b/platypush/backend/http/templates/dashboard.html @@ -33,6 +33,14 @@