Created
August 21, 2014 18:34
-
-
Save digilord/cd85e2b58f90c47c7770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server | |
Meteor.publish('pages', function () { | |
return Pages.find({}); | |
}); | |
Pages.allow({ | |
update: function () { | |
return true; | |
} | |
}); | |
// shared | |
Pages = new Meteor.Collection('pages'); | |
// Meteor.methods({ | |
// getPageTitle: function (pageIndex) { | |
// var title; | |
// title = Pages.find({ | |
// pageIndex: pageIndex | |
// }, { | |
// fields: { | |
// title: 1 | |
// } | |
// } | |
// ).fetch()[0]; | |
// return title.title; | |
// } | |
// }); | |
// client | |
Template.header.helpers({ | |
title: function () { | |
// Whenever the session variable pageIndex changes the title will be updated. | |
_pageIndex = Session.get('pageIndex') | |
_doc = Pages.findOne({pageIndex: _pageIndex}); | |
if(_doc){ | |
return _doc.title | |
} | |
} | |
}); | |
// template | |
<template name="header"> | |
<h1>{{title}}</h1> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment