this.$el.append(@linked_author.render().el) if @linked_author\r
this\r
\r
+class Pettanr.Views.Show.LinkedEditButton extends Tag.A\r
+ \r
+ initialize: (options) ->\r
+ item = options.item\r
+ edit_url = Pettanr.url(item.table_name(), 'edit', {id: item.get('id')})\r
+ super({\r
+ attr: {href: '/' + edit_url}, \r
+ handler_name: edit_url,\r
+ content: I18n.t('link.edit')\r
+ })\r
+ \r
+class Pettanr.Views.Show.LinkedDestroyButton extends Tag.A\r
+ \r
+ initialize: (options) ->\r
+ item = options.item\r
+ edit_url = Pettanr.url(item.table_name(), 'destroy', {id: item.get('id')})\r
+ super({\r
+ attr: {href: '/' + edit_url}, \r
+ handler_name: edit_url,\r
+ content: I18n.t('link.destroy')\r
+ })\r
+ \r
class Pettanr.Views.Show.OwnerFooter extends Backbone.View\r
tagName: 'div'\r
className: 'show-owner-footer'\r
super(options)\r
@item = options.item\r
@operators = options.operators\r
- @edit_url = Pettanr.url(@item.table_name(), 'edit', {id: @item.get('id')})\r
- @edit = new Tag.A({\r
- attr: {href: '/' + @edit_url}, \r
- handler_name: @edit_url,\r
- content: I18n.t('link.edit')\r
- })\r
- @destroy_url = Pettanr.url(@item.table_name(), 'destroy', {id: @item.get('id')})\r
- @destroy = new Tag.A({\r
- attr: {href: '/' + @destroy_url}, \r
- handler_name: @destroy_url,\r
- content: I18n.t('link.destroy')\r
- })\r
+ @edit = new Pettanr.Views.Show.LinkedEditButton({item: @item})\r
+ @destroy = new Pettanr.Views.Show.LinkedDestroyButton({item: @item})\r
\r
render: () ->\r
this.$el.html('')\r