OSDN Git Service

clean
[pettanr/pettanr.git] / app / assets / javascripts / views / speech_balloons / element_face.js.coffee
1 class Pettanr.Views.SpeechBalloon.ElementSymbol extends Backbone.View\r
2   tagName: 'div'\r
3   className: 'elements-tab-face-icon'\r
4   \r
5   initialize: (options) ->\r
6     @element = options.element\r
7   \r
8   render: () ->\r
9     speech_balloon_template = @element.speech_balloon_template()\r
10     speech_balloon_template.fetch({cache: true}).done =>\r
11       system_picture = speech_balloon_template.system_picture()\r
12       system_picture.fetch({cache: true}).done =>\r
13         img = system_picture.tmb_opt_img_tag()\r
14         this.$el.html(img.render().el)\r
15     this\r
16   \r
17 class Pettanr.Views.SpeechBalloon.ElementFace extends Backbone.View\r
18   tagName: 'div'\r
19   className: 'elements-tab'\r
20   \r
21   initialize: (options) ->\r
22     @element = options.element\r
23   \r
24   render: () ->\r
25     this.$el.html('')\r
26     symbol = new Pettanr.Views.SpeechBalloon.ElementSymbol({element: @element})\r
27     this.$el.append(symbol.render().el)\r
28     speech = @element.get('speech')\r
29     name = Pettanr.truncate(speech.get('content'), 15)\r
30     caption = new Tag.Span({class_name: 'elements-tab-face-caption', content: name})\r
31     this.$el.append(caption.render().el)\r
32     rb = new Tag.RowBreak()\r
33     this.$el.append(rb.render().el)\r
34     this\r
35   \r