OSDN Git Service

fix changing WithElements
[pettanr/pettanr.git] / app / assets / javascripts / controllers / panels.js.coffee
index 7c8b9ac..c48a0e2 100644 (file)
@@ -1,63 +1,63 @@
 class Pettanr.PanelsController extends Pettanr.AppController\r
   \r
   index: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @filer_list()\r
   \r
   by_author: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @filer_list()\r
   \r
   by_scroll: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @filer_list()\r
   \r
   by_sheet: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @filer_list()\r
   \r
   by_speech_balloon_template: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @filer_list()\r
   \r
-  show_html: (el) ->\r
-    @item = new Pettanr.Panel({id: @item.get('id')}, {with_elements: true}) # retake panel for 'with_elements' mode\r
+  show_html: () ->\r
+    @item = new Pettanr.Panel.WithElements({id: @item.get('id')}) # retake panel for 'with_elements' mode\r
     @item.fetch({cache: false}).done =>\r
-      @redraw_title(@params, @item.get('caption'))\r
-      view = new Pettanr.Views.Panel.Show({\r
-        el: "#pettanr",\r
+      @trigger('retitle', @params, @item.get('caption'))\r
+      show = new Pettanr.Views.Panel.Show({\r
         panel: @item,\r
         operators: @operators,\r
         spot: null\r
       })\r
-      view.render()\r
+      show.render()\r
+      @trigger('ready', show)\r
       false\r
   \r
-  show: (el) ->\r
+  show: () ->\r
     @set_show()\r
     switch @params['format']\r
       when 'prof'\r
-        @show_prof(el)\r
+        @show_prof()\r
       else\r
-        @show_html(el)\r
+        @show_html()\r
   \r
   count: () ->\r
   \r
   new: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @set_new()\r
     @editor()\r
   \r
   edit: () ->\r
-    @redraw_title(@params)\r
+    @trigger('retitle', @params)\r
     @set_model()\r
     @item = new Pettanr.Panel({id: @params['id']}, {with_elements: true})\r
     @item.fetch({cache: false}).done =>\r
-      @editor()\r
+      editor = new Editor.PanelEditor({root_item: @item, operators: @operators})\r
+      editor.render()\r
+      @trigger('ready', editor)\r
   \r
   editor: () ->\r
-    editor = new Editor.PanelEditor({root_item: @item, operators: @operators})\r
-    $("#pettanr").html(editor.render().el)\r
   \r
   create: () ->\r
   \r