Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Minor stylistic tweaks #1

Merged
merged 1 commit into from

2 participants

@ryanflorence

No description provided.

@ryanflorence ryanflorence commented on the diff
coffeescript/controllers/PlacesController.coffee
@@ -14,9 +14,9 @@ define [
'click .vote' : 'vote'
initialize: ->
- @model.on 'change:'+@model.votesKey, @render, this
+ @model.on "change:#{@model.votesKey}", @render

String interpolation, and can use => on @render and remove the need to pass in a context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ryanflorence ryanflorence commented on the diff
coffeescript/controllers/PlacesController.coffee
((12 lines not shown))
@append '<h2>What are my options?</h2>'
- @collection.each (place) ->
- @append new PlaceItemController(
- model: place
- ).render()
- , this
+ @collection.each (place) =>
+ @append new PlaceItemController(model: place).render()
this

fat arrow to keep context so you don't need the ugly hanging comma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ryanflorence ryanflorence commented on the diff
coffeescript/controllers/PlacesController.coffee
((20 lines not shown))
this
- findLocation: () ->
- throw "No collection!" if ! @collection
+ findLocation: ->
+ throw "No collection!" unless @collection

unless love

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@iammerrick iammerrick merged commit 7de9580 into iammerrick:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 12, 2012
  1. @ryanflorence

    Minor stylistic tweaks

    ryanflorence authored
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 11 deletions.
  1. +8 −11 coffeescript/controllers/PlacesController.coffee
View
19 coffeescript/controllers/PlacesController.coffee
@@ -14,9 +14,9 @@ define [
'click .vote' : 'vote'
initialize: ->
- @model.on 'change:'+@model.votesKey, @render, this
+ @model.on "change:#{@model.votesKey}", @render

String interpolation, and can use => on @render and remove the need to pass in a context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- render: () ->
+ render: =>
@html PlaceItemView @model.toJSON()
this
@@ -29,21 +29,18 @@ define [
tagName: 'ul'
- initialize: () ->
+ initialize: ->
@collection = new PlacesCollection
@collection.on 'reset', @render, this
@collection.fetch()
- render: () ->
+ render: ->
@append '<h2>What are my options?</h2>'
- @collection.each (place) ->
- @append new PlaceItemController(
- model: place
- ).render()
- , this
+ @collection.each (place) =>
+ @append new PlaceItemController(model: place).render()
this

fat arrow to keep context so you don't need the ugly hanging comma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- findLocation: () ->
- throw "No collection!" if ! @collection
+ findLocation: ->
+ throw "No collection!" unless @collection

unless love

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@collection.select()
Something went wrong with that request. Please try again.