1 class Pettanr.Views.Show
\r
2 class Pettanr.Views.Show.Header extends Backbone.View
\r
4 className: 'show-header'
\r
6 initialize: (options) ->
\r
8 @operators = options.operators
\r
9 @title = options.caption
\r
10 @icon_url = options.icon_url
\r
11 @caption_url = options.caption_url
\r
12 @prof_url = options.prof_url
\r
14 @icon = new Pettanr.Image.Icon({item: @item, half: true})
\r
15 @icon_button = new Tag.A({
\r
16 attr: {href: '/' + @icon_url},
\r
17 handler_name: @icon_url,
\r
19 content: @icon.render().el
\r
21 @caption = new Tag.A({
\r
22 attr: {href: '/' + @caption_url},
\r
23 handler_name: @caption_url,
\r
24 class_name: 'caption',
\r
27 @prof = new Pettanr.Image.SymbolImg({attr: {src: '/images/prof.gif'}, half: true})
\r
28 @prof_button = new Tag.A({
\r
29 attr: {href: '/' + @prof_url},
\r
30 handler_name: @prof_url,
\r
32 content: @prof.render().el
\r
37 this.$el.append(@icon_button.render().el)
\r
38 this.$el.append(@caption.render().el)
\r
39 this.$el.append(@prof_button.render().el)
\r
42 class Pettanr.Views.Show.HeaderAuthor extends Backbone.View
\r
45 initialize: (options) ->
\r
46 @item = options.item
\r
48 @author = @item.author()
\r
49 @author.fetch().done ->
\r
50 name = _this.author.get('name')
\r
51 author_url = Pettanr.url(_this.author.table_name(), 'show', {id: _this.author.get('id')})
\r
52 _this.linked_author = new Tag.A({
\r
53 attr: {href: '/' + author_url},
\r
54 handler_name: author_url,
\r
61 this.$el.append(Pettanr.AppHelper.t_a(@item.item_name(), 'author_id'))
\r
62 this.$el.append(@linked_author.render().el) if @linked_author
\r
65 class Pettanr.Views.Show.OwnerFooter extends Backbone.View
\r
67 className: 'show-owner-footer'
\r
69 initialize: (options) ->
\r
71 @item = options.item
\r
72 @operators = options.operators
\r
73 @edit_url = Pettanr.url(@item.table_name(), 'edit', {id: @item.get('id')})
\r
75 attr: {href: '/' + @edit_url},
\r
76 handler_name: @edit_url,
\r
77 content: I18n.t('link.edit')
\r
79 @destroy_url = Pettanr.url(@item.table_name(), 'destroy', {id: @item.get('id')})
\r
80 @destroy = new Tag.A({
\r
81 attr: {href: '/' + @destroy_url},
\r
82 handler_name: @destroy_url,
\r
83 content: I18n.t('link.destroy')
\r
88 this.$el.append(@edit.render().el)
\r
89 this.$el.append(@destroy.render().el)
\r
92 class Pettanr.Views.Show.Owner extends Backbone.View
\r
95 initialize: (options) ->
\r
97 @item = options.item
\r
98 @operators = options.operators
\r
99 @header = new Tag.H3({
\r
100 class_name: 'owner-header',
\r
101 content: I18n.t('editor')
\r
103 @footer = new Pettanr.Views.Show.OwnerFooter({item: @item, operators: @operators})
\r
107 this.$el.append(@header.render().el)
\r
108 this.$el.append(@footer.render().el)
\r