OSDN Git Service

t#31652:Speech br
authoryasushiito <yas@pen-chan.jp>
Sun, 7 Jul 2013 01:10:57 +0000 (10:10 +0900)
committeryasushiito <yas@pen-chan.jp>
Sun, 7 Jul 2013 01:10:57 +0000 (10:10 +0900)
Gemfile
app/assets/javascripts/panels.js.coffee
app/views/panels/_body.html.erb

diff --git a/Gemfile b/Gemfile
index 6288973..f654fe9 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -33,7 +33,7 @@ gem 'jquery-rails'
 gem 'jquery-ui-rails'
 
 # To use ActiveModel has_secure_password
-gem 'bcrypt-ruby', '~> 3.0.0'
+gem 'bcrypt-ruby', '~> 3.0.0'
 
 # Use unicorn as the web server
 # gem 'unicorn'
index 1c483a6..10e38fd 100644 (file)
@@ -19,6 +19,10 @@ $ ->
       if $(@).attr('tree') \r
         keys = $(@).attr('tree').split('-')\r
         set_tree_value(keys, attr, $(this).val())\r
+    $('textarea').map  ->\r
+      if $(@).attr('tree') \r
+        keys = $(@).attr('tree').split('-')\r
+        set_tree_value(keys, attr, $(this).val())\r
     $('select').map ->\r
       if $(@).attr('tree') \r
         keys = $(@).attr('tree').split('-')\r
@@ -181,6 +185,15 @@ $ ->
             $(trace).height(v)\r
           else\r
     else\r
+  $('textarea').map  ->\r
+    if $(@).attr('element_type') and $(@).attr('element_type') == 'speech_balloon'\r
+      $(@).focusout ->\r
+        switch $(@).attr('column')\r
+          when 'content'\r
+            trace = element_tag_id($(@))\r
+            speech_trace = '#panel' + $(@).attr('panel_id') + 'speech_balloon' + $(@).attr('element_id') + 'speech' + $(@).attr('element_part_id')\r
+            v = $(@).val()\r
+            $(speech_trace).html(v)\r
   \r
   # ground-picture\r
   # sync view \r
index 05b9a6e..3af6fc1 100644 (file)
@@ -9,7 +9,7 @@
       <div id="<%= elm.tag_id -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>" balloon_id="<%= elm.balloon.tag_element_id -%>" speech_id="<%= elm.speech.tag_element_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 id="<%= elm.balloon.tag_id -%>" panel_id="<%= elm.balloon.tag_panel_id -%>" element_id="<%= elm.balloon.tag_element_id -%>" element_type="<%= elm.balloon.tag_element_type -%>" element_part_id="<%= elm.balloon.tag_element_part_id -%>" element_part_type="<%= elm.balloon.tag_element_part_type -%>" class="pettanr-balloon" src="<%= elm.balloon.system_picture.url -%>" alt="<%= elm.caption -%>">
         <p style="top:<%= elm.speech.y -%>%; left:<%= elm.speech.x -%>%;width:<%= elm.speech.width -%>%; height:<%= elm.speech.height -%>%;">
-          <span id="<%= elm.speech.tag_id -%>" panel_id="<%= elm.speech.tag_panel_id -%>" element_id="<%= elm.speech.tag_element_id -%>" element_type="<%= elm.speech.tag_element_type -%>" element_part_id="<%= elm.speech.tag_element_part_id -%>" element_part_type="<%= elm.speech.tag_element_part_type -%>"><%= h elm.speech.content -%></span>
+          <span id="<%= elm.speech.tag_id -%>" panel_id="<%= elm.speech.tag_panel_id -%>" element_id="<%= elm.speech.tag_element_id -%>" element_type="<%= elm.speech.tag_element_type -%>" element_part_id="<%= elm.speech.tag_element_part_id -%>" element_part_type="<%= elm.speech.tag_element_part_type -%>"><%= sanitize(h(elm.speech.content).gsub(/\n/, '<br>'), :tags => %w(a p br)) -%></span>
         </p>
       </div>
     <% when 'GroundPicture' %>