X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fspeech.js.coffee;h=20945522c692841bddcbd059e41c2418ad55a1d8;hp=5f8a8a40de326d2f63ca51410f08e91e5175922c;hb=d7c8065be895b67dc453b0e11ad0f259f1ca6706;hpb=28197aecf803b9332afeebb4db14fb7042606f5e diff --git a/app/assets/javascripts/models/speech.js.coffee b/app/assets/javascripts/models/speech.js.coffee index 5f8a8a40..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,56 +14,36 @@ 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'), - speech_balloon_template_settings: speech_balloon_template.get('settings') writing_format_id: writing_format.get('id'), writing_format_module_name: writing_format.get('module_name'), - writing_format_template_settings: writing_format.get('settings') } - 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