preparing to push to heroku

This commit is contained in:
Jackk Goh
2018-03-23 09:55:42 +08:00
parent 6d879e9016
commit d1a0997c19
5856 changed files with 1 additions and 0 deletions
+178
View File
@@ -0,0 +1,178 @@
var AppCalendar = function() {
return {
//main function to initiate the module
init: function() {
this.initCalendar();
},
initCalendar: function() {
if (!jQuery().fullCalendar) {
return;
}
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var h = {};
if (App.isRTL()) {
if ($('#calendar').parents(".portlet").width() <= 720) {
$('#calendar').addClass("mobile");
h = {
right: 'title, prev, next',
center: '',
left: 'agendaDay, agendaWeek, month, today'
};
} else {
$('#calendar').removeClass("mobile");
h = {
right: 'title',
center: '',
left: 'agendaDay, agendaWeek, month, today, prev,next'
};
}
} else {
if ($('#calendar').parents(".portlet").width() <= 720) {
$('#calendar').addClass("mobile");
h = {
left: 'title, prev, next',
center: '',
right: 'today,month,agendaWeek,agendaDay'
};
} else {
$('#calendar').removeClass("mobile");
h = {
left: 'title',
center: '',
right: 'prev,next,today,month,agendaWeek,agendaDay'
};
}
}
var initDrag = function(el) {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
title: $.trim(el.text()) // use the element's text as the event title
};
// store the Event Object in the DOM element so we can get to it later
el.data('eventObject', eventObject);
// make the event draggable using jQuery UI
el.draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
};
var addEvent = function(title) {
title = title.length === 0 ? "Untitled Event" : title;
var html = $('<div class="external-event label label-default">' + title + '</div>');
jQuery('#event_box').append(html);
initDrag(html);
};
$('#external-events div.external-event').each(function() {
initDrag($(this));
});
$('#event_add').unbind('click').click(function() {
var title = $('#event_title').val();
addEvent(title);
});
//predefined events
$('#event_box').html("");
addEvent("My Event 1");
addEvent("My Event 2");
addEvent("My Event 3");
addEvent("My Event 4");
addEvent("My Event 5");
addEvent("My Event 6");
$('#calendar').fullCalendar('destroy'); // destroy the calendar
$('#calendar').fullCalendar({ //re-initialize the calendar
header: h,
defaultView: 'month', // change default view with available options from http://arshaw.com/fullcalendar/docs/views/Available_Views/
slotMinutes: 15,
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay) { // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
copiedEventObject.className = $(this).attr("data-class");
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
// is the "remove after drop" checkbox checked?
if ($('#drop-remove').is(':checked')) {
// if so, remove the element from the "Draggable Events" list
$(this).remove();
}
},
events: [{
title: 'All Day Event',
start: new Date(y, m, 1),
backgroundColor: App.getBrandColor('yellow')
}, {
title: 'Long Event',
start: new Date(y, m, d - 5),
end: new Date(y, m, d - 2),
backgroundColor: App.getBrandColor('green')
}, {
title: 'Repeating Event',
start: new Date(y, m, d - 3, 16, 0),
allDay: false,
backgroundColor: App.getBrandColor('red')
}, {
title: 'Repeating Event',
start: new Date(y, m, d + 4, 16, 0),
allDay: false,
backgroundColor: App.getBrandColor('green')
}, {
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false,
}, {
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
backgroundColor: App.getBrandColor('grey'),
allDay: false,
}, {
title: 'Birthday Party',
start: new Date(y, m, d + 1, 19, 0),
end: new Date(y, m, d + 1, 22, 30),
backgroundColor: App.getBrandColor('purple'),
allDay: false,
}, {
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
backgroundColor: App.getBrandColor('yellow'),
url: 'http://google.com/',
}]
});
}
};
}();
jQuery(document).ready(function() {
AppCalendar.init();
});
+1
View File
@@ -0,0 +1 @@
var AppCalendar=function(){return{init:function(){this.initCalendar()},initCalendar:function(){if(jQuery().fullCalendar){var e=new Date,t=e.getDate(),a=e.getMonth(),n=e.getFullYear(),r={};App.isRTL()?$("#calendar").parents(".portlet").width()<=720?($("#calendar").addClass("mobile"),r={right:"title, prev, next",center:"",left:"agendaDay, agendaWeek, month, today"}):($("#calendar").removeClass("mobile"),r={right:"title",center:"",left:"agendaDay, agendaWeek, month, today, prev,next"}):$("#calendar").parents(".portlet").width()<=720?($("#calendar").addClass("mobile"),r={left:"title, prev, next",center:"",right:"today,month,agendaWeek,agendaDay"}):($("#calendar").removeClass("mobile"),r={left:"title",center:"",right:"prev,next,today,month,agendaWeek,agendaDay"});var l=function(e){var t={title:$.trim(e.text())};e.data("eventObject",t),e.draggable({zIndex:999,revert:!0,revertDuration:0})},o=function(e){e=0===e.length?"Untitled Event":e;var t=$('<div class="external-event label label-default">'+e+"</div>");jQuery("#event_box").append(t),l(t)};$("#external-events div.external-event").each(function(){l($(this))}),$("#event_add").unbind("click").click(function(){var e=$("#event_title").val();o(e)}),$("#event_box").html(""),o("My Event 1"),o("My Event 2"),o("My Event 3"),o("My Event 4"),o("My Event 5"),o("My Event 6"),$("#calendar").fullCalendar("destroy"),$("#calendar").fullCalendar({header:r,defaultView:"month",slotMinutes:15,editable:!0,droppable:!0,drop:function(e,t){var a=$(this).data("eventObject"),n=$.extend({},a);n.start=e,n.allDay=t,n.className=$(this).attr("data-class"),$("#calendar").fullCalendar("renderEvent",n,!0),$("#drop-remove").is(":checked")&&$(this).remove()},events:[{title:"All Day Event",start:new Date(n,a,1),backgroundColor:App.getBrandColor("yellow")},{title:"Long Event",start:new Date(n,a,t-5),end:new Date(n,a,t-2),backgroundColor:App.getBrandColor("green")},{title:"Repeating Event",start:new Date(n,a,t-3,16,0),allDay:!1,backgroundColor:App.getBrandColor("red")},{title:"Repeating Event",start:new Date(n,a,t+4,16,0),allDay:!1,backgroundColor:App.getBrandColor("green")},{title:"Meeting",start:new Date(n,a,t,10,30),allDay:!1},{title:"Lunch",start:new Date(n,a,t,12,0),end:new Date(n,a,t,14,0),backgroundColor:App.getBrandColor("grey"),allDay:!1},{title:"Birthday Party",start:new Date(n,a,t+1,19,0),end:new Date(n,a,t+1,22,30),backgroundColor:App.getBrandColor("purple"),allDay:!1},{title:"Click for Google",start:new Date(n,a,28),end:new Date(n,a,29),backgroundColor:App.getBrandColor("yellow"),url:"http://google.com/"}]})}}}}();jQuery(document).ready(function(){AppCalendar.init()});
+302
View File
@@ -0,0 +1,302 @@
var AppInbox = function () {
var content = $('.inbox-content');
var listListing = '';
var loadInbox = function (el, name) {
var url = 'app_inbox_inbox.html';
var title = el.attr('data-title');
listListing = name;
App.blockUI({
target: content,
overlayColor: 'none',
animate: true
});
toggleButton(el);
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function(res)
{
toggleButton(el);
App.unblockUI('.inbox-content');
$('.inbox-nav > li.active').removeClass('active');
el.closest('li').addClass('active');
$('.inbox-header > h1').text(title);
content.html(res);
if (Layout.fixContentHeight) {
Layout.fixContentHeight();
}
},
error: function(xhr, ajaxOptions, thrownError)
{
toggleButton(el);
},
async: false
});
// handle group checkbox:
jQuery('body').on('change', '.mail-group-checkbox', function () {
var set = jQuery('.mail-checkbox');
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
$(this).prop('checked', checked);
});
});
}
var loadMessage = function (el, name, resetMenu) {
var url = 'app_inbox_view.html';
App.blockUI({
target: content,
overlayColor: 'none',
animate: true
});
toggleButton(el);
var message_id = el.parent('tr').attr("data-messageid");
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
data: {'message_id': message_id},
success: function(res)
{
App.unblockUI(content);
toggleButton(el);
if (resetMenu) {
$('.inbox-nav > li.active').removeClass('active');
}
$('.inbox-header > h1').text('View Message');
content.html(res);
Layout.fixContentHeight();
},
error: function(xhr, ajaxOptions, thrownError)
{
toggleButton(el);
},
async: false
});
}
var initWysihtml5 = function () {
$('.inbox-wysihtml5').wysihtml5({
"stylesheets": ["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]
});
}
var initFileupload = function () {
$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: '../assets/global/plugins/jquery-file-upload/server/php/',
autoUpload: true
});
// Upload server status check for browsers with CORS support:
if ($.support.cors) {
$.ajax({
url: '../assets/global/plugins/jquery-file-upload/server/php/',
type: 'HEAD'
}).fail(function () {
$('<span class="alert alert-error"/>')
.text('Upload server currently unavailable - ' +
new Date())
.appendTo('#fileupload');
});
}
}
var loadCompose = function (el) {
var url = 'app_inbox_compose.html';
App.blockUI({
target: content,
overlayColor: 'none',
animate: true
});
toggleButton(el);
// load the form via ajax
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function(res)
{
App.unblockUI(content);
toggleButton(el);
$('.inbox-nav > li.active').removeClass('active');
$('.inbox-header > h1').text('Compose');
content.html(res);
initFileupload();
initWysihtml5();
$('.inbox-wysihtml5').focus();
Layout.fixContentHeight();
},
error: function(xhr, ajaxOptions, thrownError)
{
toggleButton(el);
},
async: false
});
}
var loadReply = function (el) {
var messageid = $(el).attr("data-messageid");
var url = 'app_inbox_reply.html';
App.blockUI({
target: content,
overlayColor: 'none',
animate: true
});
toggleButton(el);
// load the form via ajax
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function(res)
{
App.unblockUI(content);
toggleButton(el);
$('.inbox-nav > li.active').removeClass('active');
$('.inbox-header > h1').text('Reply');
content.html(res);
$('[name="message"]').val($('#reply_email_content_body').html());
handleCCInput(); // init "CC" input field
initFileupload();
initWysihtml5();
Layout.fixContentHeight();
},
error: function(xhr, ajaxOptions, thrownError)
{
toggleButton(el);
},
async: false
});
}
var handleCCInput = function () {
var the = $('.inbox-compose .mail-to .inbox-cc');
var input = $('.inbox-compose .input-cc');
the.hide();
input.show();
$('.close', input).click(function () {
input.hide();
the.show();
});
}
var handleBCCInput = function () {
var the = $('.inbox-compose .mail-to .inbox-bcc');
var input = $('.inbox-compose .input-bcc');
the.hide();
input.show();
$('.close', input).click(function () {
input.hide();
the.show();
});
}
var toggleButton = function(el) {
if (typeof el == 'undefined') {
return;
}
if (el.attr("disabled")) {
el.attr("disabled", false);
} else {
el.attr("disabled", true);
}
}
return {
//main function to initiate the module
init: function () {
// handle compose btn click
$('.inbox').on('click', '.compose-btn', function () {
loadCompose($(this));
});
// handle discard btn
$('.inbox').on('click', '.inbox-discard-btn', function(e) {
e.preventDefault();
loadInbox($(this), listListing);
});
// handle reply and forward button click
$('.inbox').on('click', '.reply-btn', function () {
loadReply($(this));
});
// handle view message
$('.inbox').on('click', '.view-message', function () {
loadMessage($(this));
});
// handle inbox listing
$('.inbox-nav > li > a').click(function () {
loadInbox($(this), 'inbox');
});
//handle compose/reply cc input toggle
$('.inbox-content').on('click', '.mail-to .inbox-cc', function () {
handleCCInput();
});
//handle compose/reply bcc input toggle
$('.inbox-content').on('click', '.mail-to .inbox-bcc', function () {
handleBCCInput();
});
//handle loading content based on URL parameter
if (App.getURLParameter("a") === "view") {
loadMessage();
} else if (App.getURLParameter("a") === "compose") {
loadCompose();
} else {
$('.inbox-nav > li:first > a').click();
}
}
};
}();
jQuery(document).ready(function() {
AppInbox.init();
});
+1
View File
@@ -0,0 +1 @@
var AppInbox=function(){var t=$(".inbox-content"),e="",o=function(o,n){var i="app_inbox_inbox.html",a=o.attr("data-title");e=n,App.blockUI({target:t,overlayColor:"none",animate:!0}),p(o),$.ajax({type:"GET",cache:!1,url:i,dataType:"html",success:function(e){p(o),App.unblockUI(".inbox-content"),$(".inbox-nav > li.active").removeClass("active"),o.closest("li").addClass("active"),$(".inbox-header > h1").text(a),t.html(e),Layout.fixContentHeight&&Layout.fixContentHeight()},error:function(t,e,n){p(o)},async:!1}),jQuery("body").on("change",".mail-group-checkbox",function(){var t=jQuery(".mail-checkbox"),e=jQuery(this).is(":checked");jQuery(t).each(function(){$(this).prop("checked",e)})})},n=function(e,o,n){var i="app_inbox_view.html";App.blockUI({target:t,overlayColor:"none",animate:!0}),p(e);var a=e.parent("tr").attr("data-messageid");$.ajax({type:"GET",cache:!1,url:i,dataType:"html",data:{message_id:a},success:function(o){App.unblockUI(t),p(e),n&&$(".inbox-nav > li.active").removeClass("active"),$(".inbox-header > h1").text("View Message"),t.html(o),Layout.fixContentHeight()},error:function(t,o,n){p(e)},async:!1})},i=function(){$(".inbox-wysihtml5").wysihtml5({stylesheets:["../assets/global/plugins/bootstrap-wysihtml5/wysiwyg-color.css"]})},a=function(){$("#fileupload").fileupload({url:"../assets/global/plugins/jquery-file-upload/server/php/",autoUpload:!0}),$.support.cors&&$.ajax({url:"../assets/global/plugins/jquery-file-upload/server/php/",type:"HEAD"}).fail(function(){$('<span class="alert alert-error"/>').text("Upload server currently unavailable - "+new Date).appendTo("#fileupload")})},c=function(e){var o="app_inbox_compose.html";App.blockUI({target:t,overlayColor:"none",animate:!0}),p(e),$.ajax({type:"GET",cache:!1,url:o,dataType:"html",success:function(o){App.unblockUI(t),p(e),$(".inbox-nav > li.active").removeClass("active"),$(".inbox-header > h1").text("Compose"),t.html(o),a(),i(),$(".inbox-wysihtml5").focus(),Layout.fixContentHeight()},error:function(t,o,n){p(e)},async:!1})},l=function(e){var o=($(e).attr("data-messageid"),"app_inbox_reply.html");App.blockUI({target:t,overlayColor:"none",animate:!0}),p(e),$.ajax({type:"GET",cache:!1,url:o,dataType:"html",success:function(o){App.unblockUI(t),p(e),$(".inbox-nav > li.active").removeClass("active"),$(".inbox-header > h1").text("Reply"),t.html(o),$('[name="message"]').val($("#reply_email_content_body").html()),s(),a(),i(),Layout.fixContentHeight()},error:function(t,o,n){p(e)},async:!1})},s=function(){var t=$(".inbox-compose .mail-to .inbox-cc"),e=$(".inbox-compose .input-cc");t.hide(),e.show(),$(".close",e).click(function(){e.hide(),t.show()})},r=function(){var t=$(".inbox-compose .mail-to .inbox-bcc"),e=$(".inbox-compose .input-bcc");t.hide(),e.show(),$(".close",e).click(function(){e.hide(),t.show()})},p=function(t){"undefined"!=typeof t&&(t.attr("disabled")?t.attr("disabled",!1):t.attr("disabled",!0))};return{init:function(){$(".inbox").on("click",".compose-btn",function(){c($(this))}),$(".inbox").on("click",".inbox-discard-btn",function(t){t.preventDefault(),o($(this),e)}),$(".inbox").on("click",".reply-btn",function(){l($(this))}),$(".inbox").on("click",".view-message",function(){n($(this))}),$(".inbox-nav > li > a").click(function(){o($(this),"inbox")}),$(".inbox-content").on("click",".mail-to .inbox-cc",function(){s()}),$(".inbox-content").on("click",".mail-to .inbox-bcc",function(){r()}),"view"===App.getURLParameter("a")?n():"compose"===App.getURLParameter("a")?c():$(".inbox-nav > li:first > a").click()}}}();jQuery(document).ready(function(){AppInbox.init()});
+52
View File
@@ -0,0 +1,52 @@
/**
Todo 2 Module
**/
var AppTodo2 = function () {
// private functions & variables
var _initComponents = function() {
// init datepicker
$('.todo-taskbody-due').datepicker({
rtl: App.isRTL(),
orientation: "left",
autoclose: true
});
// init tags
$(".todo-taskbody-tags").select2({
placeholder: 'Status'
});
}
var _handleProjectListMenu = function() {
if (App.getViewPort().width <= 992) {
$('.todo-project-list-content').addClass("collapse");
} else {
$('.todo-project-list-content').removeClass("collapse").css("height", "auto");
}
}
// public functions
return {
//main function
init: function () {
_initComponents();
_handleProjectListMenu();
App.addResizeHandler(function(){
_handleProjectListMenu();
});
}
};
}();
if (App.isAngularJsApp() === false) {
jQuery(document).ready(function() {
AppTodo2.init();
});
}
+1
View File
@@ -0,0 +1 @@
var AppTodo2=function(){var t=function(){$(".todo-taskbody-due").datepicker({rtl:App.isRTL(),orientation:"left",autoclose:!0}),$(".todo-taskbody-tags").select2({placeholder:"Status"})},o=function(){App.getViewPort().width<=992?$(".todo-project-list-content").addClass("collapse"):$(".todo-project-list-content").removeClass("collapse").css("height","auto")};return{init:function(){t(),o(),App.addResizeHandler(function(){o()})}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){AppTodo2.init()});
+50
View File
@@ -0,0 +1,50 @@
/**
Todo Module
**/
var AppTodo = function () {
// private functions & variables
var _initComponents = function() {
// init datepicker
$('.todo-taskbody-due').datepicker({
rtl: App.isRTL(),
orientation: "left",
autoclose: true
});
// init tags
$(".todo-taskbody-tags").select2({
tags: ["Testing", "Important", "Info", "Pending", "Completed", "Requested", "Approved"]
});
}
var _handleProjectListMenu = function() {
if (App.getViewPort().width <= 992) {
$('.todo-project-list-content').addClass("collapse");
} else {
$('.todo-project-list-content').removeClass("collapse").css("height", "auto");
}
}
// public functions
return {
//main function
init: function () {
_initComponents();
_handleProjectListMenu();
App.addResizeHandler(function(){
_handleProjectListMenu();
});
}
};
}();
jQuery(document).ready(function() {
AppTodo.init();
});
+1
View File
@@ -0,0 +1 @@
var AppTodo=function(){var t=function(){$(".todo-taskbody-due").datepicker({rtl:App.isRTL(),orientation:"left",autoclose:!0}),$(".todo-taskbody-tags").select2({tags:["Testing","Important","Info","Pending","Completed","Requested","Approved"]})},o=function(){App.getViewPort().width<=992?$(".todo-project-list-content").addClass("collapse"):$(".todo-project-list-content").removeClass("collapse").css("height","auto")};return{init:function(){t(),o(),App.addResizeHandler(function(){o()})}}}();jQuery(document).ready(function(){AppTodo.init()});