codecombat/app/views/game-menu/ItemView.coffee

26 lines
586 B
CoffeeScript
Raw Normal View History

CocoView = require 'views/kinds/CocoView'
template = require 'templates/game-menu/item-view'
module.exports = class ItemView extends CocoView
className: 'item-view'
template: template
initialize: (options) ->
super(arguments...)
@item = options.item
@includes = options.includes or {}
getRenderData: ->
c = super()
c.item = @item
c.includes = @includes
if @includes.props or @includes.stats
{props, stats} = @item.getFrontFacingStats()
c.props = props
c.stats = stats
c
afterRender: ->
@$el.data('item-id', @item.id)