Skip to content

Instantly share code, notes, and snippets.

@patrickjholloway
Created December 5, 2012 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickjholloway/4215344 to your computer and use it in GitHub Desktop.
Save patrickjholloway/4215344 to your computer and use it in GitHub Desktop.
Backbone view
class Workshop.Views.FontsIndex extends Backbone.View
el: '#content_wrapper'
initialize: ->
this.current_user = new Workshop.Models.Currentuser
this.current_user.fetch()
this.fonts = new Workshop.Collections.Fonts
this.fonts.fetch()
events:
'mouseenter span': 'whiteIcon'
'mouseleave span': 'blackIcon'
'click span': 'addHideFont'
whiteIcon: (e) =>
$(e.target).children('.icon-plus').addClass('icon-white')
blackIcon: (e) =>
$(e.target).children('.icon-plus').removeClass('icon-white')
addHideFont: (e) =>
fontName = $(e.target).text()
fontName = "string"
#this.current_user.fonts.push(this.fonts.where({name: fontName}))
console.log(this.fonts.where({name: fontName}))
console.log(fontName.charAt(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment