“click button.offer”: function(e,tpl,timestamp){
e.preventDefault();
var description = tpl.$('input[name=offerInput]').val();
var result = UI._globalHelpers"timestampToTime";
//var result = Template._globalHelpers(“timestampToTime”)(timestamp);
// var result = Template._globalHelpers.timestampToTime(timestamp);
var offerData = {
ownerId: Meteor.userId(),
name: Meteor.user().profile.name,
description: tpl.$('input[name=offerInput]').val(),
createdAt: new Date(),
timestamp: Date.now(),
serviceType:"offer",
ownerImg: Meteor.user().profile.picture,
phone: Meteor.user().profile.contact.phone,
email: Meteor.user().profile.contact.email,
};
Session.set(‘display date’, true);
if(description){
Services.insert(offerData, function(error, _id){
if(error){
alert(error);
}
});
}
else{
window.alert("Please put in some sort of offer");
}
Session.set('submittedOffer', true);
},
'click .give-me-more': function(evt) {
incrementLimit();
},
‘click .offerAgain’:function(e,tpl){
e.preventDefault();
Session.set(‘submittedOffer’, null);
Session.set(‘landingPageOffer’, null);
}
});
Template.newOffer.helpers({
userInteraction: function(){
return ChatRooms.find({chatIds: Meteor.userId()});
},
contactable:function(){
return Meteor.user().profile.contact.email;
},
offer: function() {
return Services.find({serviceType: ‘offer’}, {sort: {createdAt: -1}, limit: Session.get(‘limitOffer’)});
},
isMoreOffers: function(){
return (Services.find({serviceType: ‘offer’}, {sort: {createdAt: -1}, limit: 1+Session.get(‘limitOffer’)}).count()>Session.get(‘limitOffer’));
},
submitted:function(){
return Session.get(‘submittedOffer’);
},
defaultText: function(){
return Session.get(‘landingPageOffer’);
},
isLoggedIn:function(){
return Meteor.user();
},
timestampToTime:function(){
return Session.get(‘display date’);
}
});
I have added
Session.set(‘display date’, true);
and
timestampToTime:function(){
return Session.get(‘display date’);
}
to helper… Is this correct ?
what am I supposed to add on html…?