initialize : function(parentContext) { //create a new context which is associated with the parent Context var context = new Boiler.Context(parentContext); context.addSettings(settings); var controller = new Boiler.UrlController($(".appcontent")); controller.addRoutes({ 'employee/all' : new EmployeeListRouteHandler(context), 'employee/{id}' : new EmployeeDetailRouteHandler(context), 'sales' : new SalesDashboardRouteHandler(context), 'todo/:action:' : new TodoRouteHandler(context) }); controller.start(); }
initialize : function(parentContext) { var context = new Boiler.Context(parentContext); context.addSettings(settings); var controller = new Boiler.UrlController($("#content")); var settings = new CalendarSettings(context); controller.addRoutes({ 'import' : new ImportComponent(context), 'calendar' : new CalendarComponent(context), 'calendarsettings/{calendarId}' : settings, 'addcalendar' : settings }); controller.start(); }
.done(function(data){ if(data.isHeartbeat) { toastr.info("Comet Heartbeat..."); } else if (data.isError) { toastr.error("Comet Error " + data.errorMessage); } else { for(i=0; i<data.cometMessages.length; i++) { if(data.cometMessages[i].messageType == "AccountSyncProgress") { context.notify("ACCOUNT_SYNC_PROGRESS", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "AccountSynced") { context.notify("ACCOUNT_SYNCED", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "NewMessage") { context.notify("NEW_MESSAGE", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "NewChatMessage") { context.notify("NEW_CHAT_MESSAGE", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "UserOnlineStateMessage") { if(data.cometMessages[i].online) context.notify("USER_ONLINE", data.cometMessages[i]); else context.notify("USER_OFFLINE", data.cometMessages[i]); } } } self.cometSetup(); })
initialize: function (parentContext) { //create module context by assiciating with the parent context var self = this, context = new Boiler.Context(parentContext); _.bindAll(this, 'startMigration', 'onRenderSettingView', 'onRateApp'); context.addSettings(settings); templates.load(settings); context.listen(window.app.Events.RateApp, this.onRateApp); window.app.baseModule = { context: context, renderSettingView: this.onRenderSettingView, settingModel: settingModel, }; localStorage.on('change:migrated', this.onMigrationComplete, this); settingModel.fetch(); setTimeout(function () { localStorage.fetch({ success: self.startMigration, //First time if localstorage it not there it will fail error: self.startMigration }); }); },
initialize: function () { var globalContext = new Boiler.Context(); globalContext.addSettings(settings); window.app = { context: globalContext, modules: '01', MODULES: { TRANSACTION: '0', FRIEND: '1' }, Events: { Migration: { TransactionsData: "Events.Migration.TransactionData", FriendsData: "Events.Migration.FriendsData", Migrated: "Events.Migration.Migrated", Clear: "Events.Migration.Clear", Completed: "Events.Migration.Completed" }, RateApp: "Events.RateApp" }, ID: { LocalstorageModel: "Localstorage", TransactionModel: "Transaction", TransactionCollection: "Transactions", FriendModel: "Friend", FriendCollection: "Friends" }, rateApp: function () { var url; switch (cordova.platformId) { case 'windowsphone': url = encodeURI('zune://navigate?appid=' + this.context.getSettings() .appID.wp); break; } if (url) { window.open(url, '_self', null); } }, scrollDown: function (scrollToValue, scrollwindow) { if ($.fn.animate) { // Or you can animate the scrolling:Performance might get affected $(scrollwindow || "body") .animate({ scrollTop: scrollToValue }); } else { $(scrollwindow || "body") .scrollTop(scrollToValue); } }, scrollStop: function (scrollwindow) { $(scrollwindow || "body") .stop(); }, getAnimationListner: function (functionName) { return { webkitAnimationEnd: functionName, mozAnimationEnd: functionName, MSAnimationEnd: functionName, oanimationend: functionName, animationend: functionName }; } }; _.bindAll(this, 'startLoadingModules'); document.addEventListener('deviceready', this.startLoadingModules, false); },
initialize : function(parentContext) { //create module context by assiciating with the parent context var context = new Boiler.Context(parentContext); var self = this; // $('#page-content').layout({ // north__initClosed: true, // north__togglerLength_closed: '100%', // north__size: 25, // west__onresize_end: function(){ alert("resize event"); $.layout.callbacks.resizePaneAccordions; } // }); $('#page-content').layout({north:{ initClosed: true, togglerLength_closed: '100%', size: 25 }, west:{ onresize_end:$.layout.callbacks.resizePaneAccordions } }); //scoped DomController that will be effective only on $('#page-content') var controller = new Boiler.DomController($('#page-content')); //add routes with DOM node selector queries and relevant components controller.addRoutes({ "#navpanel" : new NavPanelComponent(context), "#header" : new HeaderComponent(context) }); controller.start(); // initialize comet system (server "push") self.cometSetup = function() { $.ajax("command/getCometMessages") .done(function(data){ if(data.isHeartbeat) { toastr.info("Comet Heartbeat..."); } else if (data.isError) { toastr.error("Comet Error " + data.errorMessage); } else { for(i=0; i<data.cometMessages.length; i++) { if(data.cometMessages[i].messageType == "AccountSyncProgress") { context.notify("ACCOUNT_SYNC_PROGRESS", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "AccountSynced") { context.notify("ACCOUNT_SYNCED", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "NewMessage") { context.notify("NEW_MESSAGE", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "NewChatMessage") { context.notify("NEW_CHAT_MESSAGE", data.cometMessages[i]); } else if(data.cometMessages[i].messageType == "UserOnlineStateMessage") { if(data.cometMessages[i].online) context.notify("USER_ONLINE", data.cometMessages[i]); else context.notify("USER_OFFLINE", data.cometMessages[i]); } } } self.cometSetup(); }) .fail(function(error, textStatus, errorThrown) { console.log("cometSetup(): fail."); if(error.status == 403) { // access denied = not logged in --> redirect to login window.location.href = contextPath + "/login"; } else { toastr.error("An error occured during comet connection setup: " + errorThrown); console.log(JSON.stringify(error) + "\n" + JSON.stringify(textStatus) + "\n" + JSON.stringify(errorThrown)); setTimeout("self.cometSetup()", 1000); } }); }; self.cometSetup(); //the landing page should respond to the root URL, so let's use an URLController too // var controller = new Boiler.UrlController($("#content")); // controller.addRoutes({ // "/" : new LandingPageComponent(context) // }); // controller.start(); }