mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 14:42:23 +03:00
Refactored the backend.js module.
This commit is contained in:
parent
fb5e4aa20e
commit
d1a0aa02fd
1 changed files with 58 additions and 52 deletions
|
@ -9,70 +9,75 @@
|
|||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Main javascript code for the backend of Easy!Appointments.
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
if (window.console === undefined) {
|
||||
window.console = function() {} // IE compatibility
|
||||
}
|
||||
window.Backend = window.Backend || {};
|
||||
|
||||
$(window).resize(function() {
|
||||
Backend.placeFooterToBottom();
|
||||
}).trigger('resize');
|
||||
/**
|
||||
* This module contains functions that are used in the backend section of
|
||||
* the application.
|
||||
*
|
||||
* @module Backend
|
||||
*/
|
||||
(function(exports) {
|
||||
|
||||
$(document).ajaxStart(function() {
|
||||
$('#loading').show();
|
||||
});
|
||||
'use strict';
|
||||
|
||||
$(document).ajaxStop(function() {
|
||||
$('#loading').hide();
|
||||
});
|
||||
|
||||
$('.menu-item').qtip({
|
||||
position: {
|
||||
my: 'top center',
|
||||
at: 'bottom center'
|
||||
},
|
||||
style: {
|
||||
classes: 'qtip-green qtip-shadow custom-qtip'
|
||||
/**
|
||||
* Main javascript code for the backend of Easy!Appointments.
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
if (window.console === undefined) {
|
||||
window.console = function() {} // IE compatibility
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
Backend.placeFooterToBottom();
|
||||
}).trigger('resize');
|
||||
|
||||
$(document).ajaxStart(function() {
|
||||
$('#loading').show();
|
||||
});
|
||||
|
||||
$(document).ajaxStop(function() {
|
||||
$('#loading').hide();
|
||||
});
|
||||
|
||||
$('.menu-item').qtip({
|
||||
position: {
|
||||
my: 'top center',
|
||||
at: 'bottom center'
|
||||
},
|
||||
style: {
|
||||
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
|
||||
* the applications.
|
||||
*
|
||||
* @namespace Backend
|
||||
*/
|
||||
var Backend = {
|
||||
/**
|
||||
* Backend Constants
|
||||
*/
|
||||
DB_SLUG_ADMIN: 'admin',
|
||||
DB_SLUG_PROVIDER: 'provider',
|
||||
DB_SLUG_SECRETARY: 'secretary',
|
||||
DB_SLUG_CUSTOMER: 'customer',
|
||||
exports.DB_SLUG_ADMIN = 'admin';
|
||||
exports.DB_SLUG_PROVIDER = 'provider';
|
||||
exports.DB_SLUG_SECRETARY = 'secretary';
|
||||
exports.DB_SLUG_CUSTOMER = 'customer';
|
||||
|
||||
PRIV_VIEW: 1,
|
||||
PRIV_ADD: 2,
|
||||
PRIV_EDIT: 4,
|
||||
PRIV_DELETE: 8,
|
||||
exports.PRIV_VIEW = 1;
|
||||
exports.PRIV_ADD = 2;
|
||||
exports.PRIV_EDIT = 4;
|
||||
exports.PRIV_DELETE = 8;
|
||||
|
||||
PRIV_APPOINTMENTS: 'appointments',
|
||||
PRIV_CUSTOMERS: 'customers',
|
||||
PRIV_SERVICES: 'services',
|
||||
PRIV_USERS: 'users',
|
||||
PRIV_SYSTEM_SETTINGS: 'system_settings',
|
||||
PRIV_USER_SETTINGS: 'user_settings',
|
||||
exports.PRIV_APPOINTMENTS = 'appointments';
|
||||
exports.PRIV_CUSTOMERS = 'customers';
|
||||
exports.PRIV_SERVICES = 'services';
|
||||
exports.PRIV_USERS = 'users';
|
||||
exports.PRIV_SYSTEM_SETTINGS = 'system_settings';
|
||||
exports.PRIV_USER_SETTINGS = 'user_settings';
|
||||
|
||||
/**
|
||||
* Place the backend footer always on the bottom of the page.
|
||||
*/
|
||||
placeFooterToBottom: function() {
|
||||
exports.placeFooterToBottom = function() {
|
||||
var $footer = $('#footer');
|
||||
|
||||
if (window.innerHeight > $('body').height()) {
|
||||
|
@ -86,7 +91,7 @@ var Backend = {
|
|||
'position': 'static'
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Display backend notifications to user.
|
||||
|
@ -100,7 +105,7 @@ var Backend = {
|
|||
* to the user. Every array item is an object that contains the 'label' and
|
||||
* 'function' key values.
|
||||
*/
|
||||
displayNotification: function(message, actions) {
|
||||
exports.displayNotification = function(message, actions) {
|
||||
if (message == undefined) {
|
||||
message = 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION';
|
||||
}
|
||||
|
@ -130,4 +135,5 @@ var Backend = {
|
|||
$('#notification').html(notificationHtml);
|
||||
$('#notification').show('blind');
|
||||
}
|
||||
};
|
||||
|
||||
})(window.Backend);
|
||||
|
|
Loading…
Reference in a new issue