X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fspeech.js.coffee;h=20945522c692841bddcbd059e41c2418ad55a1d8;hb=e05f18d1db38e531e7bca45d4ba8db71b082402f;hp=a91413d03d7a1ef0cd028a3f12f83e4e27ecbb72;hpb=d7efc0f68adc2d5aac765213b3358b982b0a0700;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/speech.js.coffee b/app/assets/javascripts/models/speech.js.coffee index a91413d0..20945522 100644 --- a/app/assets/javascripts/models/speech.js.coffee +++ b/app/assets/javascripts/models/speech.js.coffee @@ -1,5 +1,4 @@ class Pettanr.Speech extends Peta.Element - url: '/speeches/' @singular: () -> 'Speech' @@ -15,10 +14,16 @@ class Pettanr.Speech extends Peta.Element height: 100 } - pick: (templates) -> + @trace_routes: () -> + { + speech_balloon: 'speech_balloon', + symbol: ['speech_balloon', 'speech_balloon_template', 'system_picture'] + } + + pick: () -> # - speech_balloon_template = templates.speech_balloon_template - writing_format = templates.writing_format + speech_balloon_template = @templates.speech_balloon_template + writing_format = @templates.writing_format { speech_balloon_template_id: speech_balloon_template.get('id'), speech_balloon_template_module_name: speech_balloon_template.get('module_name'), @@ -26,43 +31,19 @@ class Pettanr.Speech extends Peta.Element writing_format_module_name: writing_format.get('module_name'), } - speech_balloon: () -> - new Pettanr.Cache.Retriever(Pettanr.SpeechBalloon, @get('speech_balloon_id')) - - writing_format: () -> - new Pettanr.Cache.Retriever(Pettanr.WritingFormat, @get('writing_format_id')) - @text_align_texts: () -> ['left', 'left', 'right', 'center'] - symbol_option: () -> - retriever = @speech_balloon() - @listenTo(retriever, 'retrieve', @retrieve_speech_balloon) - retriever.retrieve() - - retrieve_speech_balloon: (speech_balloon) -> - retriever = speech_balloon.speech_balloon_template() - @listenTo(retriever, 'retrieve', @retrieve_speech_balloon_template) - retriever.retrieve() - - retrieve_speech_balloon_template: (speech_balloon_template) -> - retriever = speech_balloon_template.system_picture() - @listenTo(retriever, 'retrieve', @retrieve_system_picture) - retriever.retrieve() - - retrieve_system_picture: (system_picture) -> - @trigger('ready:symbol', system_picture.tmb_opt_img_tag()) - text_align_text: () -> Pettanr.Speech.text_align_texts()[@get('text_align')] scenario: () -> @boosts('read') @render(@escape('content')) - + + plain_scenario: () -> + @escape('content') initialize: (attr, options) -> super(attr, options) - if @id - @url = @url + @id