Files
pathfinder/js/app/ui/dialog/notification.js
Exodus4D f943f31d9a - removed IGB support #206
- removed location tracking by IGB
2016-07-06 19:04:40 +02:00

88 lines
2.3 KiB
JavaScript

/**
* notification dialog
*/
define([
'jquery',
'app/init',
'app/util',
'app/render',
'bootbox'
], function($, Init, Util, Render, bootbox) {
'use strict';
var config = {
// shutdown dialog
notificationDialogId: 'pf-notification-dialog', // id for "notification" dialog
notificationDialogClass: 'pf-notification-dialog' // class for "notification" dialog
};
/**
* show/animate dialog page content
* @param dialog
*/
var showPageContent = function(dialog){
var headlineElement = dialog.find('h1');
headlineElement.delay(300).velocity('transition.shrinkIn', {
duration: 500
}).delay(800);
headlineElement.velocity({
scale: 1.05
}, {
duration: 600,
loop: 5
});
};
/**
* show "notification" dialog
* @param dialogData
*/
$.fn.showNotificationDialog = function(dialogData){
// check if there is already a notification dialog open
var notificationDialogClassDialoges = $('.' + config.notificationDialogClass);
if(notificationDialogClassDialoges.length === 0){
// close all modals
$('.modal').modal('hide');
requirejs(['text!templates/dialog/notification.html', 'mustache'], function(template, Mustache) {
var data = {
id: config.notificationDialogId,
content: dialogData.content
};
var content = Mustache.render(template, data);
// show dialog
var shutdownDialog = bootbox.dialog({
title: dialogData.content.title,
message: content,
className: config.notificationDialogClass,
buttons: dialogData.buttons
});
shutdownDialog.on('shown.bs.modal', function(e) {
// remove close button
var dialog = $(this);
dialog.find('.bootbox-close-button').remove();
dialog.find('button').blur();
// show error message
showPageContent(dialog);
});
});
}
};
});