class Pettanr.View.Credit extends Pettanr.View tagName: 'div' className: 'credit' constructor: (@item, options) -> super(options) initialize: (options = {icon: true}) -> @icon_options = options.icon @data_options = options.data render: () -> this.$el.html('') if @icon_options icon = new Pettanr.View.Credit.Icon(@item) @listenTo(icon, 'click', @click_icon) this.$el.append(icon.render().el) data = new Pettanr.View.Credit.Data(@item, @data_options) this.$el.append(data.render().el) this click_icon: () -> @trigger('click:icon', @item) class Pettanr.View.Credit.Data extends Pettanr.View tagName: 'div' className: 'credit-data' constructor: (@item, options) -> super(options) initialize: (options) -> @credit_api_url = @item.url + '/credit' render: () -> super() if @item.credit_data @append_credit_data() else f = (data, status) => @item.credit_data = data @append_credit_data() $.get(@credit_api_url, null, f, 'html') this append_credit_data: () -> this.$el.html('') this.$el.append(@item.credit_data) this.$el.map -> $(@).click -> confirm('leave?') @append_rb() class Pettanr.View.Credit.Icon extends Pettanr.View tagName: 'div' className: 'credit-icon' constructor: (@item, options) -> super(options) render: () -> this.$el.html('') symbol_button = @item.symbol_button({ context: this, click: () => @trigger('click') }) this.$el.append(symbol_button.render().el) this