Added btn-default class to backend notification button.

This commit is contained in:
Alex Tselegidis 2015-10-11 22:13:36 +02:00
parent 2c46042f0e
commit 07f4e45461
1 changed files with 26 additions and 26 deletions

View File

@ -1,14 +1,14 @@
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler * Easy!Appointments - Open Source Web Scheduler
* *
* @package EasyAppointments * @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com> * @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) 2013 - 2015, Alex Tselegidis * @copyright Copyright (c) 2013 - 2015, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3 * @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org * @link http://easyappointments.org
* @since v1.0.0 * @since v1.0.0
* ---------------------------------------------------------------------------- */ * ---------------------------------------------------------------------------- */
/** /**
* Main javascript code for the backend of Easy!Appointments. * Main javascript code for the backend of Easy!Appointments.
*/ */
@ -16,15 +16,15 @@ $(document).ready(function() {
$(window).resize(function() { $(window).resize(function() {
Backend.placeFooterToBottom(); Backend.placeFooterToBottom();
}).trigger('resize'); }).trigger('resize');
$(document).ajaxStart(function() { $(document).ajaxStart(function() {
$('#loading').show(); $('#loading').show();
}); });
$(document).ajaxStop(function() { $(document).ajaxStop(function() {
$('#loading').hide(); $('#loading').hide();
}); });
$('.menu-item').qtip({ $('.menu-item').qtip({
position: { position: {
my: 'top center', my: 'top center',
@ -34,14 +34,14 @@ $(document).ready(function() {
classes: 'qtip-green qtip-shadow custom-qtip' classes: 'qtip-green qtip-shadow custom-qtip'
} }
}); });
GeneralFunctions.enableLanguageSelection($('#select-language')); GeneralFunctions.enableLanguageSelection($('#select-language'));
}); });
/** /**
* This namespace contains functions that are used in the backend section of * This namespace contains functions that are used in the backend section of
* the applications. * the applications.
* *
* @namespace Backend * @namespace Backend
*/ */
var Backend = { var Backend = {
@ -52,19 +52,19 @@ var Backend = {
DB_SLUG_PROVIDER: 'provider', DB_SLUG_PROVIDER: 'provider',
DB_SLUG_SECRETARY: 'secretary', DB_SLUG_SECRETARY: 'secretary',
DB_SLUG_CUSTOMER: 'customer', DB_SLUG_CUSTOMER: 'customer',
PRIV_VIEW: 1, PRIV_VIEW: 1,
PRIV_ADD: 2, PRIV_ADD: 2,
PRIV_EDIT: 4, PRIV_EDIT: 4,
PRIV_DELETE: 8, PRIV_DELETE: 8,
PRIV_APPOINTMENTS: 'appointments', PRIV_APPOINTMENTS: 'appointments',
PRIV_CUSTOMERS: 'customers', PRIV_CUSTOMERS: 'customers',
PRIV_SERVICES: 'services', PRIV_SERVICES: 'services',
PRIV_USERS: 'users', PRIV_USERS: 'users',
PRIV_SYSTEM_SETTINGS: 'system_settings', PRIV_SYSTEM_SETTINGS: 'system_settings',
PRIV_USER_SETTINGS: 'user_settings', PRIV_USER_SETTINGS: 'user_settings',
/** /**
* Place the backend footer always on the bottom of the page. * Place the backend footer always on the bottom of the page.
*/ */
@ -85,45 +85,45 @@ var Backend = {
}, },
/** /**
* Display backend notifications to user. * Display backend notifications to user.
* *
* Using this method you can display notifications to the use with custom * Using this method you can display notifications to the use with custom
* messages. If the 'actions' array is provided then an action link will * messages. If the 'actions' array is provided then an action link will
* be displayed too. * be displayed too.
* *
* @param {string} message Notification message * @param {string} message Notification message
* @param {array} actions An array with custom actions that will be available * @param {array} actions An array with custom actions that will be available
* to the user. Every array item is an object that contains the 'label' and * to the user. Every array item is an object that contains the 'label' and
* 'function' key values. * 'function' key values.
*/ */
displayNotification: function(message, actions) { displayNotification: function(message, actions) {
if (message == undefined) { if (message == undefined) {
message = 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION'; message = 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION';
} }
if (actions == undefined) { if (actions == undefined) {
actions = []; actions = [];
setTimeout(function() { setTimeout(function() {
$('#notification').slideUp('slow'); $('#notification').slideUp('slow');
}, 7000); }, 7000);
} }
var notificationHtml = var notificationHtml =
'<div class="notification alert">' + '<div class="notification alert">' +
'<strong>' + message + '</strong>'; '<strong>' + message + '</strong>';
$.each(actions, function(index, action) { $.each(actions, function(index, action) {
var actionId = action['label'].toLowerCase().replace(' ', '-'); var actionId = action['label'].toLowerCase().replace(' ', '-');
notificationHtml += '<button id="' + actionId + '" class="btn btn-xs">' notificationHtml += '<button id="' + actionId + '" class="btn btn-default btn-xs">'
+ action['label'] + '</button>'; + action['label'] + '</button>';
$(document).off('click', '#' + actionId); $(document).off('click', '#' + actionId);
$(document).on('click', '#' + actionId, action['function']); $(document).on('click', '#' + actionId, action['function']);
}); });
notificationHtml += '<a class="close" data-dismiss="alert" href="#">&times;</a></div>'; notificationHtml += '<a class="close" data-dismiss="alert" href="#">&times;</a></div>';
$('#notification').html(notificationHtml); $('#notification').html(notificationHtml);
$('#notification').show('blind'); $('#notification').show('blind');
} }
}; };