2014-11-28 20:49:41 -05:00
|
|
|
CocoView = require 'views/core/CocoView'
|
2014-11-29 15:46:04 -05:00
|
|
|
template = require 'templates/play/menu/item-view'
|
2014-08-13 20:21:37 -04:00
|
|
|
|
|
|
|
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)
|