OSDN Git Service

t#31097:pp with link
[pettanr/pettanr.git] / app / views / panels / _body.html.erb
index 0b622fa..bc598d6 100644 (file)
@@ -2,16 +2,29 @@
   <% panel.panel_elements.each do |elm| %>
     <% case elm.class.to_s %>
     <% when 'PanelPicture' %>
-      <%= tag(:img, elm.opt_img_tag) %>
-    <% when Balloon %>
-      <div id="vballoon<%= elm.id -%>" class="pettanr-comic-balloon" style="width:<%= elm.width -%>px; height:<%= elm.height -%>px; top:<%= elm.y -%>px; left:<%= elm.x -%>px; z-index:<%= elm.z -%>; ">
-        <img src="<%= elm.system_picture.url -%>">
+      <%= 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>
-    <% end ; p elm.class %>
+    <% 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>
+    <% end %>
   <% end %>
 </div>