OSDN Git Service

add: social button
[pettanr/pettanr.git] / app / assets / javascripts / models / speech.js.coffee
1 class Pettanr.Speech extends Peta.Element\r
2   \r
3   @singular: () ->\r
4     'Speech'\r
5   \r
6   @plural: () ->\r
7     'Speeches'\r
8   \r
9   defaults: {\r
10     id: null,\r
11     x: 0,\r
12     y: 0,\r
13     width: 100,\r
14     height: 100\r
15   } \r
16   \r
17   @pick_item_name: () ->\r
18     'speech_balloon_template'\r
19   \r
20   @trace_routes: () ->\r
21     {\r
22       speech_balloon: 'speech_balloon',\r
23       speech_balloon_template: ['speech_balloon', 'speech_balloon_template'],\r
24       symbol: ['speech_balloon', 'speech_balloon_template', 'system_picture']\r
25     }\r
26   \r
27   pick: () ->\r
28     # \r
29     speech_balloon_template = @templates.speech_balloon_template\r
30     writing_format = @templates.writing_format\r
31     {\r
32       speech_balloon_template_id: speech_balloon_template.get('id'),\r
33       speech_balloon_template_module_name: speech_balloon_template.get('module_name'),\r
34       writing_format_id: writing_format.get('id'),\r
35       writing_format_module_name: writing_format.get('module_name'),\r
36     }\r
37   \r
38   @text_align_texts: () -> \r
39     ['left', 'left', 'right', 'center']\r
40   \r
41   text_align_text: () ->\r
42     Pettanr.Speech.text_align_texts()[@get('text_align')]\r
43   \r
44   scenario: () ->\r
45     @boosts('read')\r
46     @render(Pettanr.to_s(@get('content')))\r
47   \r
48   plain_scenario: () ->\r
49     @escape('content')\r
50   \r
51   initialize: (attr, options) ->\r
52     super(attr, options)\r
53   \r