# options: { # label: { label_options ... } # button: { button_options ... } # } class Pettanr.View.Show.AuthoredBy extends Pettanr.View tagName: 'div' constructor: (@content, options) -> super(options) initialize: (options = {}) -> @label_options = options.label || {shorten: false} render: () -> this.$el.html('') this.$el.append(Pettanr.AppHelper.t_a(@content.item_name(), @content.my_class().owner_column())) author_item_name = @content.my_class().owner_type() @content.get_parent(author_item_name, this, { success: (author) => # author or artist label_button = author.label_button(@label_options, { context: this, click: () => @trigger('click', author) }) this.$el.append(label_button.render().el) fail: (response, opt) => this.$el.append(I18n.t('yasapp.unresolved')) }) this