Last active
December 30, 2015 03:08
-
-
Save zerobase/7766983 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FooView extends View | |
constructor: (@jquery, @model) -> | |
super @jquery, @model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
border: 1px solid #999 | |
background: white |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DO NOT OVERWRITE THIS FILE. | |
# This file is automatically generated from FooView.scss. | |
class FooView extends View | |
defaultStyle: | |
border: "1px solid #999" | |
background: "white" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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