Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###
- COLLECTIONS
- ###
- @Comparisons = new Meteor.Collection 'comparisons'
- @Items = new Meteor.Collection 'items'
- ###
- ROUTER:setup
- ###
- Router.configure
- layoutTemplate: 'layout'
- loadingTemplate: 'loading'
- notfoundTemplate: 'notFound'
- ###
- ROUTER:routing
- ###
- Router.route '/',
- name: 'home'
- template: 'comparisonsList'
- Router.route '/create/:_id',
- name: 'create'
- template: 'createComparison'
- data: ->
- currentItem = @params._id
- Items.findOne
- _id: currentItem
- if Meteor.isClient
- Template.addComparison.events
- "click .addComparison": (e) ->
- id = Items.insert
- title: "Enter a title for this description"
- fields: [
- { name: "Enter a name for this attribute", weight: 1 }
- ]
- createdAt: new Date
- createdBy: Meteor.userId()
- console.log id
- Router.go 'create', _id: id
- Template.createComparison.helpers
- attributes: ->
- console.log this.fields
- currentItem = @_id
- currentUser = Meteor.userId()
- Items.findOne
- _id: currentItem
- createdBy: currentUser
- debugThis: ->
- console.log this
- Template.createComparison.events
- "click .addAttribute": (e) ->
- e.preventDefault()
- currentItem = @_id
- currentUser = Meteor.userId()
- Items.update { _id: currentItem }, $push: fields: { name: "Enter a name for this attribute", weight: 1 }
- "click .saveComparison": (e) ->
- e.preventDefault()
- ###
- args = []
- title = $(e.currentTarget).find('#title')
- $(e.currentTarget).find('.comparisonAttribute').each ->
- val = $(this).val()
- args.push val
- ###
- "click .cancelComparison": (e) ->
- e.preventDefault()
- Router.go 'home'
- "click .removeAttribute": (e) ->
- e.preventDefault()
- ###
- current = Session.get 'attributesArray'
- current.pop()
- Session.set 'attributesArray', current
- ###
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement