OSDN Git Service

play panel_elements
[pettanr/pettanr.git] / app / views / panels / _standard.html.erb
index 0cf3c24..aada79d 100644 (file)
@@ -2,20 +2,22 @@
 t:<%= @panel.t %>
 </span>
 <div class="panel" style="width:<%= @panel.width %>px;height:<%= @panel.height %>px;overflow:hidden; border:solid black <%= @panel.border %>px; background:white;">
-  <% @panel.panel_pictures.each do |panel_picture| %>
-    <div id="vPicture<%= panel_picture.id -%>" class="panel_picture" style="position:relative;  top:<%= panel_picture.y -%>px; left:<%= panel_picture.x -%>px; z-index:<%= panel_picture.z -%>; ">
-      <img style=" position:absolute; width:<%= panel_picture.width -%>px; height:<%= panel_picture.height -%>px; " src="<%= panel_picture.url -%>">
-    </div>
-  <% end %>
-  <% @panel.balloons.each do |balloon| %>
-    <div id="vballoon<%= balloon.id -%>" class="balloon" style="position:relative;  top:<%= balloon.y -%>px; left:<%= balloon.x -%>px; z-index:<%= balloon.z -%>; ">
-      <img style=" position:absolute; width:<%= balloon.width -%>px; height:<%= balloon.height -%>px; " src="<%= balloon.system_picture.url -%>">
-      <% balloon.speaches.each do |speach| %>
-        <div style="position:relative; top:<%= speach.y -%>px; left:<%= speach.x -%>px;width:<%= speach.width -%>px; height:<%= speach.height -%>px; top:1px; left:1px; z-index:1; ">
-          <%= h speach.content -%>
-        </div>
-      <% end %>
-    </div>
+  <% @panel.each_element do |elm| %>
+    <% if elm.kind_of?(PanelPicture) %>
+      <div id="vPicture<%= elm.id -%>" class="panel_picture" style="position:relative;  top:<%= elm.y -%>px; left:<%= elm.x -%>px; z-index:<%= elm.z -%>; ">
+        <img style=" position:absolute; width:<%= elm.width -%>px; height:<%= elm.height -%>px; " src="<%= elm.url -%>">
+      </div>
+    <% end %>
+    <% if elm.kind_of?(Balloon) %>
+      <div id="vballoon<%= elm.id -%>" class="balloon" style="position:relative;  top:<%= elm.y -%>px; left:<%= elm.x -%>px; z-index:<%= elm.z -%>; ">
+        <img style=" position:absolute; width:<%= elm.width -%>px; height:<%= elm.height -%>px; " src="<%= elm.system_picture.url -%>">
+        <% elm.speaches.each do |speach| %>
+          <div style="position:relative; top:<%= speach.y -%>px; left:<%= speach.x -%>px;width:<%= speach.width -%>px; height:<%= speach.height -%>px; top:1px; left:1px; z-index:1; ">
+            <%= h speach.content -%>
+          </div>
+        <% end %>
+      </div>
+    <% end %>
   <% end %>
 </div>
 <span>