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