2014-07-07 11:49:21 +09:00
|
|
|
var filteredModules = function (positions) {
|
|
|
|
return _.filter(postModules, function(module){return _.contains(positions, module.position)});
|
|
|
|
}
|
|
|
|
|
2014-07-04 14:07:50 +09:00
|
|
|
var post = {};
|
|
|
|
|
2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('post_item')].created = function () {
|
2014-07-04 14:07:50 +09:00
|
|
|
post = this.data;
|
2013-10-28 13:35:20 +09:00
|
|
|
};
|
2012-09-04 18:57:07 +09:00
|
|
|
|
2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('post_item')].helpers({
|
2014-07-07 09:06:32 +09:00
|
|
|
leftPostModules: function () {
|
2014-07-07 11:49:21 +09:00
|
|
|
return filteredModules(['leftOfLeft', 'left', 'rightOfLeft']);
|
2014-07-07 09:06:32 +09:00
|
|
|
},
|
|
|
|
centerPostModules: function () {
|
2014-07-07 11:49:21 +09:00
|
|
|
return filteredModules(['leftOfCenter', 'center', 'rightOfCenter']);
|
2014-07-07 09:06:32 +09:00
|
|
|
},
|
|
|
|
rightPostModules: function () {
|
2014-07-07 11:49:21 +09:00
|
|
|
return filteredModules(['leftOfRight', 'right', 'rightOfRight']);
|
2013-10-25 11:23:16 +09:00
|
|
|
},
|
2014-07-07 11:49:21 +09:00
|
|
|
moduleContext: function () {
|
|
|
|
var moduleContext = _.extend(this, post);
|
|
|
|
moduleContext.templateClass = camelToDash(moduleContext.template);
|
|
|
|
moduleContext._id = null;
|
|
|
|
return moduleContext;
|
2013-04-25 22:11:26 -07:00
|
|
|
}
|
2012-10-01 14:52:32 +09:00
|
|
|
});
|