OSDN Git Service

fix escape html
[pettanr/pettanr.git] / app / assets / javascripts / models / speech_balloon.js.coffee
index 4a28202..341fc01 100644 (file)
@@ -1,70 +1,47 @@
-class SpeechBalloon extends Element\r
-  @single: () ->\r
+class Pettanr.SpeechBalloon extends Peta.Element\r
+  url: '/speech_balloons/'\r
+  \r
+  @singular: () ->\r
     'SpeechBalloon'\r
   \r
   @plural: () ->\r
     'SpeechBalloons'\r
   \r
-  @colum_structures: ->\r
-    {}\r
-  \r
   defaults: {\r
-    x: 11\r
+    id: null,\r
+    z: null,\r
+    t: null\r
   } \r
   \r
-  initialize: () ->\r
-    confirm("Welcome to this world")\r
+  panel: () ->\r
+    new Pettanr.Panel({id: @get('panel_id')})\r
   \r
-  @test: () ->\r
-    confirm( @single())\r
-    confirm( @plural() )\r
-    confirm( @class_name() )\r
-    confirm( @element_name() )\r
-    confirm( @table_name() )\r
-    confirm( @path_name() )\r
-    confirm( @colum_structures() )\r
-    \r
-  has_picture: () ->\r
-    true\r
+  speech_balloon_template: () ->\r
+    new Pettanr.SpeechBalloonTemplate({id: @get('speech_balloon_template_id')})\r
   \r
-  has_part: () ->\r
+  @has_picture: () ->\r
     false\r
   \r
-  extend_column: () ->\r
-    null\r
+  symbol_option: () ->\r
+    sbt = @speech_balloon_template()\r
+    sbt.fetch({cache: true}).done =>\r
+      sp = sbt.system_picture()\r
+      sp.fetch({cache: true}).done =>\r
+        @symbol_picture = sp.tmb_opt_img_tag()\r
+        @trigger('ready:symbol')\r
+  \r
+  filer_caption: () ->\r
+    @fetch({cache: true}).done =>\r
+      @caption_text = @escape('caption')\r
+      @trigger('ready:caption')\r
+  \r
+  plain_scenario: () ->\r
+    @get('caption')\r
+  \r
+  element_face: () ->\r
+    new Pettanr.Views.SpeechBalloon.ElementFace({element: this})\r
+  \r
+  initialize: () ->\r
+    if @id\r
+      @url = @url + @id\r
   \r
-  test: () ->\r
-    confirm( @has_picture() )\r
-    confirm( @has_part() )\r
-    confirm( @parts() )\r
-    confirm( @has_helper('column_name') )\r
-    confirm( @element_name() )\r
-    confirm( @extend_column() )\r
-    confirm( @extend_element_name() )\r
-    confirm( @find_configurations(window.configurations,'v') )\r
-    confirm( @new_index() )\r
-    confirm( @set_new_index(3) )\r
-    confirm( @set_new_panel('v') )\r
-    confirm( @get_new_panel() )\r
-    confirm( '@get_panel()' )\r
-    confirm( @get_panel() )\r
-    confirm( @tag_id('c') )\r
-    confirm( @field_tag_id('f') )\r
-    confirm( @tag_panel_id() )\r
-    confirm( @tag_element_id() )\r
-    confirm( @tag_element_type() )\r
-    confirm( @tag_new_index() )\r
-    confirm( @path_name() )\r
-    confirm( @form_template() )\r
-    confirm( @scenario_template() )\r
-    confirm( @element_face_template() )\r
-    confirm( @form_helper_template('colum_name') )\r
-    confirm( @tag_attributes('column') )\r
-    confirm( @field_tag_attributes('column', 0, {}) )\r
-    confirm( @any_tag_attributes('name', {}) )\r
-    confirm( @select_tag_attributes(true, 'column', 0) )\r
-    confirm( @tag_attr('column', {}) )\r
-    confirm( @field_tag_attr('column', 1, {}) )\r
-    confirm( @any_tag_attr('name', {}) )\r
-\r
-@PanelPicture = PanelPicture\r