Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Images = new Mongo.Collection("images1")
- if Meteor.isClient
- Session.setDefault('counter', 0)
- Template.body.helpers(
- images: () ->
- return Images.find({}, {sort: {createdAt: -1}})
- )
- Meteor.setInterval(() ->
- navigator.geolocation.getCurrentPosition(
- (pos) ->
- Session.set('lat', pos.coords.latitude)
- Session.set('lon', pos.coords.longitude)
- Session.set('pos', pos.coords)
- , 1000)
- )
- Template.body.events(
- "submit .new-image": (event) ->
- debugger
- imgurl = event.target.imgurl.value
- imgtitle = event.target.imgtitle.value
- console.log(imgurl)
- console.log(imgtitle)
- Images.insert({
- imgtitle: imgtitle,
- imgurl: imgurl,
- createdAt: new Date(),
- location: Session.get('pos')
- })
- event.target.imgurl.value = ""
- event.target.imgtitle.value = ""
- return false
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement