OSDN Git Service

fix sb engine
authoryasushiito <yas@pen-chan.jp>
Sat, 29 Jun 2013 07:10:49 +0000 (16:10 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 29 Jun 2013 07:10:49 +0000 (16:10 +0900)
app/models/speech.rb
app/views/panels/_form.html.erb
config/application.rb
config/routes.rb
config/speech_balloon.yml

index dbcbad8..e51ef90 100644 (file)
@@ -47,7 +47,7 @@ class Speech < ActiveRecord::Base
   end
   
   def tag_element_id
-    self.speech_balloon.new_record? ? '0' : self.id.to_s
+    self.speech_balloon.new_record? ? '0' : self.speech_balloon.id.to_s
   end
   
   def tag_element_type
index 085f144..5ce4330 100644 (file)
             <% when 'PanelPicture' %>
               <%= render 'panel_pictures/form', :panel_picture => elm %>
             <% when 'SpeechBalloon' %>
-              <%= render 'speech_balloons/form', :speech_balloon => elm %>
+              <% 
+                speech_balloon = elm
+                speech_balloon_template = speech_balloon.speech_balloon_template
+                balloon = speech_balloon.balloon 
+                speech = speech_balloon.speech 
+                speech_balloon.extend speech_balloon_template.engine_speech_balloon_module
+                balloon.extend speech_balloon_template.engine_balloon_module
+                speech.extend speech_balloon_template.engine_speech_module
+                
+                speech_balloon_extend = speech_balloon.extend_speech_balloon
+                balloon_extend = balloon.extend_balloon
+                speech_extend = speech.extend_speech
+              %>
+              <%= render elm.speech_balloon_template.engine_name + '/speech_balloons/form', :speech_balloon => speech_balloon, :balloon => balloon, :speech => speech, :speech_balloon_extend => speech_balloon_extend, :balloon_extend => balloon_extend, :speech_extend => speech_extend %>
             <% when 'GroundPicture' %>
               <%= render 'ground_pictures/form', :ground_picture => elm %>
             <% when 'GroundColor' %>
index 3217e06..d037e7e 100644 (file)
@@ -61,7 +61,7 @@ config.assets.initialize_on_precompile = false
     end
     
     def self.licenses
-      @@licenses
+      @@licenses || {}
     end
      
     def self.speech_balloons=(ary)
@@ -69,7 +69,7 @@ config.assets.initialize_on_precompile = false
     end
     
     def self.speech_balloons
-      @@speech_balloons
+      @@speech_balloons || {}
     end
  end
 end
index ad68065..398a9c0 100644 (file)
@@ -7,6 +7,9 @@ Pettanr::Application.routes.draw do
   Pettanr::Application.licenses.each do |name, klass|
     mount Module.const_get(klass)::Engine => "/#{name}"
   end
+  Pettanr::Application.speech_balloons.each do |klass , name|
+    mount Module.const_get(klass)::Engine => "/#{name}"
+  end
   
   resources :authors do
     new do
index 55fa394..5c37e06 100644 (file)
@@ -1,2 +1,2 @@
-  Square: pettanr_square_v01_sbt
-  TestSpeechBalloon: test_speech_balloon
+#  Square: pettanr_square_v01_sbt
+#  TestSpeechBalloon: test_speech_balloon