Commit c694a3c4 authored by MrMan's avatar MrMan

Support the other pages

parent 44a71dd5
......@@ -6,6 +6,9 @@ System.register([
"./components/main-layout.js",
"./components/with-route-triggered-loader.js",
"./components/inbox-mail.js",
"./components/starred-mail.js",
"./components/draft-mail.js",
"./components/important-mail.js",
], function(exportModule, moduleCtx) {
return {
execute: function() {
......@@ -14,15 +17,18 @@ System.register([
moduleCtx.import("./components/main-layout.js"),
moduleCtx.import("./components/with-route-triggered-loader.js"),
moduleCtx.import("./components/inbox-mail.js"),
moduleCtx.import("./components/starred-mail.js"),
moduleCtx.import("./components/draft-mail.js"),
moduleCtx.import("./components/important-mail.js"),
])
.then(function(deps) {
var EmailSvc = deps.shift().service;
var MainLayout = deps.shift().component;
var WithRouteTriggeredLoader = deps.shift().component;
var InboxMail = deps.shift().component;
// var StarredMail = deps.shift();
// var DraftMail = deps.shift();
// var ImportantMail = deps.shift();
var StarredMail = deps.shift().component;
var DraftMail = deps.shift().component;
var ImportantMail = deps.shift().component;
// Set up the app
m.route(document.body, "/inbox", {
......@@ -38,41 +44,41 @@ System.register([
}
},
// "/starred": {
// render: function() {
// return m(MainLayout, m(WithRouteTriggeredLoader, {
// title: "Loading starred emails...",
// // This function provides the data
// loadFn: function() { return EmailSvc.getEmails(); },
// // This function provides the component to WithRouteTriggeredLoader
// childFn: function(data) { return m(StarredMail, {emails: data}); }
// }));
// }
// },
"/starred": {
render: function() {
return m(MainLayout, m(WithRouteTriggeredLoader, {
title: "Loading starred emails...",
// This function provides the data
loadFn: function() { return EmailSvc.getEmails(); },
// This function provides the component to WithRouteTriggeredLoader
childFn: function(data) { return m(StarredMail, {emails: data}); }
}));
}
},
// "/draft": {
// render: function() {
// return m(MainLayout, m(WithRouteTriggeredLoader, {
// title: "Loading draft emails...",
// // This function provides the data
// loadFn: function() { return EmailSvc.getEmails(); },
// // This function provides the component to WithRouteTriggeredLoader
// childFn: function(data) { return m(DraftMail, {emails: data}); }
// }));
// }
// },
"/draft": {
render: function() {
return m(MainLayout, m(WithRouteTriggeredLoader, {
title: "Loading draft emails...",
// This function provides the data
loadFn: function() { return EmailSvc.getEmails(); },
// This function provides the component to WithRouteTriggeredLoader
childFn: function(data) { return m(DraftMail, {emails: data}); }
}));
}
},
// "/important": {
// render: function() {
// return m(MainLayout, m(WithRouteTriggeredLoader, {
// title: "Loading important emails...",
// // This function provides the data
// loadFn: function() { return EmailSvc.getEmails(); },
// // This function provides the component to WithRouteTriggeredLoader
// childFn: function(data) { return m(ImportantMail, {emails: data}); }
// }));
// }
// },
"/important": {
render: function() {
return m(MainLayout, m(WithRouteTriggeredLoader, {
title: "Loading important emails...",
// This function provides the data
loadFn: function() { return EmailSvc.getEmails(); },
// This function provides the component to WithRouteTriggeredLoader
childFn: function(data) { return m(ImportantMail, {emails: data}); }
}));
}
},
});
......
var DraftMail = {
view: function(vnode) {
var newCount = vnode.attrs.newCount;
/* global System */
System.register([
"./rhs-header.js",
"./mail-page-subnav.js",
"./email-list.js",
], function(exportModule, moduleCtx) {
return {
execute: function() {
return m(".component.draft-rhs", [
// Colored header
m(RHSHeader, {class: "draft-gray-bg white-fg", title: "Draft", newCount: newCount}),
Promise.all([
moduleCtx.import("./rhs-header.js"),
moduleCtx.import("./mail-page-subnav.js"),
moduleCtx.import("./email-list.js"),
])
.then(function(deps) {
var RHSHeader = deps.shift().component;
var MailPageSubNav = deps.shift().component;
var EmailList = deps.shift().component;
// Container with buttons
m(MailPageSubNav),
var DraftMail = {
view: function(vnode) {
var newCount = vnode.attrs.newCount;
// EmailList
m(EmailList, {emails: vnode.attrs.emails}),
]);
}
};
return m(".component.draft-rhs", [
// Colored header
m(RHSHeader, {class: "draft-gray-bg white-fg", title: "Draft", newCount: newCount}),
// Container with buttons
m(MailPageSubNav),
// EmailList
m(EmailList, {emails: vnode.attrs.emails}),
]);
}
};
exportModule({component: DraftMail});
});
},
};
});
var ImportantMail = {
view: function(vnode) {
var newCount = vnode.attrs.newCount;
/* global System */
System.register([
"./rhs-header.js",
"./mail-page-subnav.js",
"./email-list.js",
], function(exportModule, moduleCtx) {
return {
execute: function() {
return m(".component.important-rhs", [
// Colored header
m(RHSHeader, {class: "important-red-bg white-fg", title: "Important", newCount: newCount}),
Promise.all([
moduleCtx.import("./rhs-header.js"),
moduleCtx.import("./mail-page-subnav.js"),
moduleCtx.import("./email-list.js"),
])
.then(function(deps) {
var RHSHeader = deps.shift().component;
var MailPageSubNav = deps.shift().component;
var EmailList = deps.shift().component;
// Container with buttons
m(MailPageSubNav),
var ImportantMail = {
view: function(vnode) {
var newCount = vnode.attrs.newCount;
// EmailList
m(EmailList, {emails: vnode.attrs.emails}),
]);
}
};
return m(".component.important-rhs", [
// Colored header
m(RHSHeader, {class: "important-red-bg white-fg", title: "Important", newCount: newCount}),
// Container with buttons
m(MailPageSubNav),
// EmailList
m(EmailList, {emails: vnode.attrs.emails}),
]);
}
};
exportModule({component: ImportantMail});
});
},
};
});
var StarredMail = {
view: function(vnode) {
var newCount = vnode.attrs.newCount;
/* global System */
System.register([
"./rhs-header.js",
"./mail-page-subnav.js",
"./email-list.js",
], function(exportModule, moduleCtx) {
return {
execute: function() {
return m(".component.starred-rhs", [
// Colored header
m(RHSHeader, {class: "starred-orange-bg white-fg", title: "Starred", newCount: newCount}),
Promise.all([
moduleCtx.import("./rhs-header.js"),
moduleCtx.import("./mail-page-subnav.js"),
moduleCtx.import("./email-list.js"),
])
.then(function(deps) {
var RHSHeader = deps.shift().component;
var MailPageSubNav = deps.shift().component;
var EmailList = deps.shift().component;
// Container with buttons
m(MailPageSubNav),
var StarredMail = {
view: function(vnode) {
var newCount = vnode.attrs.newCount;
// EmailList
m(EmailList, {emails: vnode.attrs.emails}),
]);
}
};
return m(".component.starred-rhs", [
// Colored header
m(RHSHeader, {class: "starred-orange-bg white-fg", title: "Starred", newCount: newCount}),
// Container with buttons
m(MailPageSubNav),
// EmailList
m(EmailList, {emails: vnode.attrs.emails}),
]);
}
};
exportModule({component: StarredMail});
});
},
};
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment