OSDN Git Service

element
[pettanr/pettanr.git] / app / views / speech_balloons / _element.html.erb
index c2c52cf..41d6091 100644 (file)
@@ -1,8 +1,8 @@
-<div <%= raw elm.any_tag_attr() -%> balloon_id="<%= elm.balloon.tag_element_part_id -%>" speech_id="<%= elm.speech.tag_element_part_id -%>" class="pettanr-comic-balloon" style="width:<%= elm.balloon.width -%>px; height:<%= elm.balloon.height -%>px; top:<%= elm.balloon.y -%>px; left:<%= elm.balloon.x -%>px; z-index:<%= elm.z -%>; ">
-  <img <%= raw elm.balloon.tag_attr -%> class="pettanr-balloon" src="<%= elm.balloon.system_picture.url -%>" alt="<%= elm.caption -%>">
-  <div class="pettanr-comic-speech" style="top:<%= elm.speech.y -%>%; left:<%= elm.speech.x -%>%;width:<%= elm.speech.width -%>%; height:<%= elm.speech.height -%>%;">
-    <div class="pettanr-comic-speech-inner" <%= raw elm.speech.tag_attr -%> style="font-size:<%= elm.speech.font_size -%>em; text-align:<%= elm.speech.text_align_text -%>; color:#<%= format("%06x", elm.speech.fore_color) -%>;">
-      <%= raw elm.speech.writing_format.engine_model.render(elm.speech.content) -%>
-    </div>
-  </div>
-</div>
+<%= content_tag :div, element.tag_attributes(:div, {'class' => "pettanr-comic-balloon", 'style' => raw(element.balloon.style.merge({'z-index' => element.z}).to_style)}) do %>
+  <%= tag :img, element.balloon.tag_attributes(nil, {'class' => "pettanr-balloon", 'src' => element.balloon.system_picture.url, 'alt' => element.caption}) %>
+  <%= content_tag :div, {'class' => "pettanr-comic-speech", 'style' => raw(element.speech.outer_style.to_style)} do %>
+    <%= content_tag :div, element.speech.tag_attributes(nil, {'class' => "pettanr-comic-speech-inner", 'style' => raw(element.speech.inner_style.to_style)}) do %>
+      <%= raw element.speech.writing_format.engine_model.render(element.speech.content) -%>
+    <% end %>
+  <% end %>
+<% end %>