Last active
June 14, 2016 23:22
-
-
Save jakwuh/133c8554b0e33d007b9095bba66d387f to your computer and use it in GitHub Desktop.
region-extras add block helper support
This file contains 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
// ... | |
if (options.fn) { | |
var View = LayoutView.extend({ | |
template: () => options.fn(hash.defaults) | |
}); | |
region.show(new View()); | |
region.render = function (data) { | |
var View = LayoutView.extend({ | |
template: () => options.fn(extend(hash.defaults, data)) | |
}); | |
this.show(new View()); | |
} | |
} |
This file contains 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 extend LayoutView { | |
template: require('./View.hbs'), | |
collectionEvents: { | |
'request': 'enableButton', | |
'sync error': 'disableButton' | |
} | |
enableButton() { | |
/** | |
* region.render(data) will call Handlebars' options.fn(data)) | |
*/ | |
this.getRegion('buttonState').render({disabled: false}); | |
} | |
disableButton() { | |
this.getRegion('buttonState').render({disabled: true}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment