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