OSDN Git Service

fix js
[pettanr/pettanr.git] / app / assets / javascripts / locmare / filer / header.js.coffee
1 class Locmare.FilerModule.Header extends Backbone.View\r
2   tagName: 'div'\r
3   \r
4   initialize: (options) ->\r
5     @filer = options.filer\r
6   \r
7   render: () ->\r
8     this.$el.html('')\r
9     icon = new Pettanr.Image.Icon({item: @model(), half: true})\r
10     caption = Pettanr.AppHelper.t_m(@model().singular())\r
11     url = Pettanr.url(@model().table_name(), 'index', {})\r
12     linked_icon = new Pettanr.Tag.A({\r
13       attr: {href: url}, handler_name: url, content: icon.render().el\r
14     })\r
15     linked_caption = new Pettanr.Tag.A({\r
16       attr: {href: '/' + url}, handler_name: url, content: caption\r
17     })\r
18     this.$el.append(linked_icon.render().el)\r
19     this.$el.append(linked_caption.render().el)\r
20     this\r
21   \r
22   model: () ->\r
23     @filer.model()\r
24   \r
25   human_name: () ->\r
26     @model.model_name.human\r
27   \r