OSDN Git Service

fix model
[pettanr/pettanr.git] / app / views / panels / _body.html.erb
index bc598d6..f7bc737 100644 (file)
@@ -1,30 +1,9 @@
-<div class="pettanr-comic-panel" style="width:<%= panel.width %>px;height:<%= panel.height %>px;border-style: solid;border-width: <%= panel.border %>px;border-color:black; background-color:white;">
-  <% panel.panel_elements.each do |elm| %>
-    <% case elm.class.to_s %>
-    <% when 'PanelPicture' %>
-      <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag), elm.link) %>
-    <% when 'SpeechBalloon' %>
-      <% balloon = elm.balloons.first %>
-      <div id="vballoon<%= elm.id -%>" class="pettanr-comic-balloon" style="width:<%= balloon.width -%>px; height:<%= balloon.height -%>px; top:<%= balloon.y -%>px; left:<%= balloon.x -%>px; z-index:<%= elm.z -%>; ">
-        <img src="<%= balloon.system_picture.url -%>" alt="<%= balloon.caption -%>">
-        <% elm.speeches.each do |speech| %>
-          <p style="top:<%= speech.y -%>px; left:<%= speech.x -%>px;width:<%= speech.width -%>px; height:<%= speech.height -%>px;">
-            <span><%= h speech.content -%></span>
-          </p>
-        <% end %>
-      </div>
-    <% when 'GroundColor' %>
-      <div id="ground-color<%= elm.id -%>" class="pettanr-comic-ground-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:<%= elm.color.name -%>;">
-      
-      </div>
-    <% when 'PanelColor' %>
-      <div id="panel-color<%= elm.id -%>" class="pettanr-comic-panel-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:#<%= format("%06x", elm.code) -%>;">
-      
-      </div>
-    <% when 'GroundPicture' %>
-      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= MagicNumber['ground_picture_repeat_items'][elm.repeat] -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
-        
-      </div>
+<%= content_tag :div, panel.tag_attributes(nil, {:panel_id => panel.id, :class => "pettanr-comic-panel", :style => raw(panel.style.to_style)}) do %>
+  <% if panel.visible? operators -%>
+    <% panel.panel_elements.each do |element| %>
+      <%= render element.path_name + '/element', :element => element, :root => panel, :spot => spot %>
     <% end %>
+  <% else %>
+    <h2><%= t('panels.hidden') %></h2>
   <% end %>
-</div>
+<% end %>