Skip to content

Instantly share code, notes, and snippets.

@zerobase
Last active December 30, 2015 03:08
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 zerobase/7766983 to your computer and use it in GitHub Desktop.
Save zerobase/7766983 to your computer and use it in GitHub Desktop.
class View
jquery: null
defaultStyle: {}
constructor: (@jquery, @model) ->
# nothing
css: (opt = {}) ->
("#{attr}: #{opt[attr] or val}" for attr, val of @defaultStyle).join(";")
applyStyle: (styleOption) ->
@jquery.css css(styleOption)
class FooView extends View
constructor: (@jquery, @model) ->
super @jquery, @model
class FooView extends View
defaultStyle:
border: "1px solid #999"
background: "white"
fooView = new FooView
console.log fooView.css
background: "grey"
# => background: grey;border: 1px solid #999
class FooView extends View
constructor: (@jquery, @model) ->
super @jquery, @model
border: 1px solid #999
background: white
# DO NOT OVERWRITE THIS FILE.
# This file is automatically generated from FooView.scss.
class FooView extends View
defaultStyle:
border: "1px solid #999"
background: "white"
class View
jquery: null
model: null
defaultStyle: {}
constructor: (@jquery, @model) ->
# nothing
css: (opt = {}) ->
("#{attr}: #{opt[attr] or val}" for attr, val of @defaultStyle).join(";")
applyStyle: (styleOption) ->
@jquery.css css(styleOption)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment