2014-08-13 20:21:37 -04:00
|
|
|
CocoView = require 'views/kinds/CocoView'
|
|
|
|
template = require 'templates/game-menu/item-view'
|
|
|
|
|
|
|
|
module.exports = class ItemView extends CocoView
|
|
|
|
className: 'item-view'
|
2014-08-31 15:21:25 -04:00
|
|
|
|
2014-08-13 20:21:37 -04:00
|
|
|
template: template
|
2014-08-31 15:21:25 -04:00
|
|
|
|
2014-08-13 20:21:37 -04:00
|
|
|
initialize: (options) ->
|
|
|
|
super(arguments...)
|
|
|
|
@item = options.item
|
|
|
|
@includes = options.includes or {}
|
|
|
|
|
|
|
|
getRenderData: ->
|
|
|
|
c = super()
|
|
|
|
c.item = @item
|
|
|
|
c.includes = @includes
|
2014-08-31 15:21:25 -04:00
|
|
|
if @includes.props or @includes.stats
|
|
|
|
{props, stats} = @item.getFrontFacingStats()
|
|
|
|
c.props = props
|
|
|
|
c.stats = stats
|
2014-08-13 20:21:37 -04:00
|
|
|
c
|
2014-08-31 15:21:25 -04:00
|
|
|
|
2014-08-13 20:21:37 -04:00
|
|
|
afterRender: ->
|
|
|
|
@$el.data('item-id', @item.id)
|