class Pettanr.Speech extends Peta.Element\r
+ url: '/speeches/'\r
+ \r
@singular: () ->\r
'Speech'\r
\r
height: 100\r
} \r
\r
+ pick: (templates) ->\r
+ # \r
+ speech_balloon_template = templates.speech_balloon_template\r
+ writing_format = templates.writing_format\r
+ {\r
+ speech_balloon_template_id: speech_balloon_template.get('id'),\r
+ speech_balloon_template_module_name: speech_balloon_template.get('module_name'),\r
+ writing_format_id: writing_format.get('id'),\r
+ writing_format_module_name: writing_format.get('module_name'),\r
+ }\r
+ \r
+ speech_balloon: () ->\r
+ new Pettanr.Cache.Retriever(Pettanr.SpeechBalloon, @get('speech_balloon_id'))\r
+ \r
+ writing_format: () ->\r
+ new Pettanr.Cache.Retriever(Pettanr.WritingFormat, @get('writing_format_id'))\r
+ \r
@text_align_texts: () -> \r
['left', 'left', 'right', 'center']\r
\r
symbol_option: () ->\r
- @speech_balloon().speech_balloon_template().symbol_option()\r
+ retriever = @speech_balloon()\r
+ @listenTo(retriever, 'retrieve', @retrieve_speech_balloon)\r
+ retriever.retrieve()\r
\r
- outer_style: () ->\r
- {\r
- top: @get('y'), left: @get('x'), \r
- width: @get('width'), height: @get('height')\r
- }\r
+ retrieve_speech_balloon: (speech_balloon) -> \r
+ retriever = speech_balloon.speech_balloon_template()\r
+ @listenTo(retriever, 'retrieve', @retrieve_speech_balloon_template)\r
+ retriever.retrieve()\r
\r
- inner_style: () ->\r
- {\r
- 'font-size': Pettanr.to_s(@get('font_size')) + 'em',\r
- 'text-align': @text_align_text(), \r
- color: '#' + ('000000' + Pettanr.to_s(@get('fore_color'))).slice(-6)\r
- }\r
+ retrieve_speech_balloon_template: (speech_balloon_template) -> \r
+ retriever = speech_balloon_template.system_picture()\r
+ @listenTo(retriever, 'retrieve', @retrieve_system_picture)\r
+ retriever.retrieve()\r
+ \r
+ retrieve_system_picture: (system_picture) -> \r
+ @trigger('ready:symbol', system_picture.tmb_opt_img_tag())\r
\r
text_align_text: () ->\r
Pettanr.Speech.text_align_texts()[@get('text_align')]\r
\r
- initialize: () ->\r
+ scenario: () ->\r
+ @boosts('read')\r
+ @render(@escape('content'))\r
+ \r
+ \r
+ initialize: (attr, options) ->\r
+ super(attr, options)\r
if @id\r
@url = @url + @id\r
\r
-class Pettanr.Speech.Collection extends Backbone.Collection\r
- model: Pettanr.Speech\r
- url: '/Speeches'\r