OSDN Git Service

change: cache system
[pettanr/pettanr.git] / app / assets / javascripts / views / balloons / show.js.coffee
index 10a520c..c5d91de 100644 (file)
@@ -23,26 +23,32 @@ class Pettanr.Views.Balloon.Show extends Backbone.View
       prof_url: prof_url\r
     })\r
     @listenTo(this, 'ready', @ready)\r
-    @speech_balloon = @item.speech_balloon()\r
-    @speech_balloon.fetch({cache: true}).done =>\r
-      @panel = @speech_balloon.panel().with_elements()\r
-      @panel.fetch({cache: false}).done =>  # with elements\r
-        @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
-        @body = new Pettanr.Views.Panel.Body({\r
-          panel: @panel,\r
-          operators: @operators,\r
-          spot: @item\r
-        })\r
-        @credits = new Pettanr.Views.Panel.ShowModule.Credits({\r
-          pictures: @panel.licensed_pictures()\r
-        })\r
-        @listenTo(@header, 'click:pick', @click_pick)\r
-        @listenTo(@header, 'click:icon', @click_show)\r
-        @listenTo(@header, 'click:caption', @click_show)\r
-        @listenTo(@header, 'click:prof', @click_prof)\r
-        @listenTo(@author, 'click:author', @click_author)\r
-        @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-        @trigger('ready')\r
+    retriever = @item.speech_balloon()\r
+    @listenTo(retriever, 'retrieve', @retrieve_speech_balloon)\r
+    retriever.retrieve()\r
+  \r
+  retrieve_speech_balloon: (@speech_balloon) ->\r
+    retriever = @speech_balloon.panel().with_elements()\r
+    @listenTo(retriever, 'retrieve', @retrieve_panel)\r
+    retriever.retrieve()\r
+  \r
+  retrieve_panel: (@panel) ->\r
+    @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+    @body = new Pettanr.Views.Panel.Body({\r
+      panel: @panel,\r
+      operators: @operators,\r
+      spot: @item\r
+    })\r
+    @credits = new Pettanr.Views.Panel.ShowModule.Credits({\r
+      pictures: @panel.licensed_pictures()\r
+    })\r
+    @listenTo(@header, 'click:pick', @click_pick)\r
+    @listenTo(@header, 'click:icon', @click_show)\r
+    @listenTo(@header, 'click:caption', @click_show)\r
+    @listenTo(@header, 'click:prof', @click_prof)\r
+    @listenTo(@author, 'click:author', @click_author)\r
+    @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
+    @trigger('ready')\r
   \r
   render: () ->\r
     this.$el.html('')\r