Created
September 30, 2016 12:19
-
-
Save vernondegoede/08595b0753b5e75a84b5e0e12072bb09 to your computer and use it in GitHub Desktop.
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
import { View } from 'backbone.marionette'; | |
import ScoreCounterView from './../../score_counter/view'; | |
import ScoreBehaviour from './../../../../../behaviors/score_helper'; | |
import Template from './template.hbs'; | |
import $ from 'jquery'; | |
export default View.extend({ | |
template: Template, | |
className: 'score__1vs1', | |
regions: { | |
leftCounter: "#left-counter", | |
rightCounter: "#right-counter" | |
}, | |
ui: { | |
'winner_count': '#left-counter .js-count', | |
'loser_count': '#right-counter .js-count', | |
'winner_input': '#left-counter .js-count-input', | |
'loser_input': '#right-counter .js-count-input', | |
'decreaseButton': '#left-counter .js-decrement-counter', | |
'increaseButton': '#right-counter .js-increment-counter', | |
}, | |
behaviors: { | |
ScoreBehaviour | |
}, | |
onRender () { | |
console.log('this.ui.increaseButton.length', $('#left-counter .js-decrement-counter').length); | |
}, | |
onAttach () { | |
this.showChildView('leftCounter', new ScoreCounterView({ | |
inputName: 'results[0][points]' | |
})); | |
this.showChildView('rightCounter', new ScoreCounterView({ | |
inputName: 'results[1][points]' | |
})); | |
}, | |
templateContext () { | |
const user = window.app.state.user; | |
return { | |
currentUserName: user.get('nickname'), | |
currentUserAvatar: user.get('avatar'), | |
currentUserId: user.get('id'), | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment