index.vash
@html.extend('layout', function(model){
@html.block('body', function(model){
<h1>@model.title </h1>
@if (model.error){
<p class="text-error">Error occurred: @model.error</p>
}
@model.categories.forEach(function (category){
<div>
<span>@(category.notes ? category.notes.length:0) -</span>
<a href="#">@category.name</a>
</div>
})
})
})
index.js
(function (data) {
var seedData = require("./seedData");
data.getNoteCategories = function (next) {
next(null, seedData.initialNotes);
};
})(module.exports);
seedData.js
(function (seedData) {
seedData.initialNotes = [{
name: "History",
notes: [{
note: "Testing history",
author: "Shawn Wildermuth",
color: "yellow"
}, {
note: "I like history",
author: "Shawn Wildermuth",
color: "blue"
}, {
note: "I hate war.",
author: "Shawn Wildermuth",
color: "green"
}, {
note: "History is an interesting subject with many different topics. I am always concerned about topics that are too long.",
author: "Shawn Wildermuth",
color: "green"
}, {
note: "Presidents are cool.",
author: "Shawn Wildermuth",
color: "orange"
}]
}, {
name: "People",
notes: [{
note: "Jefferson was a President",
author: "Shawn Wildermuth",
color: "yellow"
}, {
note: "John Wayne was an actor",
author: "Shawn Wildermuth",
color: "blue"
}, {
note: "Reagan was a President and an actor.",
author: "Shawn Wildermuth",
color: "green"
}]
}];
})(module.exports);
No comments:
Post a Comment