$ ->\r
+ repeat_texts = ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
element_tag_id = (element) ->\r
'#panel' + element.attr('panel_id') + element.attr('element_type') + element.attr('element_id')\r
\r
if $(@).attr('element_type') and $(@).attr('element_type') == 'panel_picture'\r
$(@).focusout ->\r
switch $(@).attr('column')\r
+ when 'x'\r
+ trace = element_tag_id($(@)) + 'img'\r
+ v = parseInt($(@).val()).toString() + 'px'\r
+ $(trace).parent().css('left', v)\r
+ $(trace).css('left', v)\r
+ when 'y'\r
+ trace = element_tag_id($(@)) + 'img'\r
+ v = parseInt($(@).val()).toString() + 'px'\r
+ $(trace).parent().css('top', v)\r
+ $(trace).css('top', v)\r
when 'width'\r
trace = element_tag_id($(@)) + 'img'\r
v = parseInt($(@).val())\r
}\r
\r
# sync view \r
+ $('input').map ->\r
+ if $(@).attr('element_type') and $(@).attr('element_type') == 'speech_balloon'\r
+ $(@).focusout ->\r
+ switch $(@).attr('column')\r
+ when 'x'\r
+ trace = element_tag_id($(@))\r
+ v = parseInt($(@).val()).toString() + 'px'\r
+ $(trace).css('left', v)\r
+ when 'y'\r
+ trace = element_tag_id($(@))\r
+ v = parseInt($(@).val()).toString() + 'px'\r
+ $(trace).css('top', v)\r
+ when 'width'\r
+ trace = element_tag_id($(@))\r
+ v = parseInt($(@).val())\r
+ $(trace).width(Math.abs(v))\r
+ trace = '#panel' + $(trace).attr('panel_id') + 'speech_balloon' + $(trace).attr('element_id') + 'balloon' + $(trace).attr('balloon_id')\r
+ $(trace).parent().width(v)\r
+ $(trace).width(v)\r
+ when 'height'\r
+ trace = element_tag_id($(@))\r
+ v = parseInt($(@).val())\r
+ $(trace).height(Math.abs(v))\r
+ trace = '#panel' + $(trace).attr('panel_id') + 'speech_balloon' + $(trace).attr('element_id') + 'balloon' + $(trace).attr('balloon_id')\r
+ $(trace).parent().height(v)\r
+ $(trace).height(v)\r
+ else\r
+ else\r
+ \r
+ # ground-picture\r
+ # sync view \r
+ $('input').map ->\r
+ if $(@).attr('element_type') and $(@).attr('element_type') == 'ground_picture'\r
+ $(@).focusout ->\r
+ switch $(@).attr('column')\r
+ when 'x', 'y'\r
+ trace = element_tag_id($(@))\r
+ x = parseInt($(@).val()).toString() + 'px'\r
+ ytrace = '#panel' + $(@).attr('panel_id') + 'ground_picture' + $(@).attr('element_id') + 'y'\r
+ y = parseInt($(ytrace).val()).toString() + 'px'\r
+ $(trace).css('background-position', y + ' ' + x)\r
+ $('select').map ->\r
+ if $(@).attr('element_type') and $(@).attr('element_type') == 'ground_picture'\r
+ $(@).change ->\r
+ switch $(@).attr('column')\r
+ when 'repeat'\r
+ trace = element_tag_id($(@))\r
+ v = parseInt($(@).val())\r
+ $(trace).css('background-repeat', repeat_texts[v])\r
+ else\r
+ \r
+ \r
+ # ground_color\r
+ # sync view \r
+ $('input').map ->\r
+ if $(@).attr('element_type') and $(@).attr('element_type') == 'ground_color'\r
+ $(@).focusout ->\r
+ switch $(@).attr('column')\r
+ when 'code'\r
+ trace = element_tag_id($(@))\r
+ v = '#' + parseInt($(@).val()).toString()\r
+ $(trace).css('background-color', v)\r
+ \r
$('#t-sortable tbody').sortable {\r
update: ( event, ui ) ->\r
t = 0;\r
<%= render 'system/error_explanation', :obj => speech_balloon %>
<div class="field">
- <%= f.label :caption, :id => speech_balloon.field_tag_id(:caption), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :caption, :tree => speech_balloon.field_tree(:caption) %><br />
- <%= f.number_field :caption %>
+ <%= f.label :caption %><br />
+ <%= f.number_field :caption, :id => speech_balloon.field_tag_id(:caption), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :caption, :tree => speech_balloon.field_tree(:caption) %>
</div>
<div class="field">
<%= f.label :z %><br />
<%= render 'speeches/form', :f => sf, :speech => speech_balloon.speech %>
<% end %>
- <%= f.hidden_field :panel_id %>
- <%= f.hidden_field :classname %>
- <%= f.hidden_field :speech_balloon_template_id %>
+ <%= f.hidden_field :panel_id, :id => speech_balloon.field_tag_id(:panel_id), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :panel_id, :tree => speech_balloon.field_tree(:panel_id) %>
+ <%= f.hidden_field :classname, :id => speech_balloon.field_tag_id(:classname), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :classname, :tree => speech_balloon.field_tree(:classname) %>
+ <%= f.hidden_field :speech_balloon_template_id, :id => speech_balloon.field_tag_id(:speech_balloon_template_id), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :speech_balloon_template_id, :tree => speech_balloon.field_tree(:speech_balloon_template_id) %>
<% unless speech_balloon.new_record? %>
<%= f.hidden_field :id, :id => speech_balloon.field_tag_id(:id), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :id, :tree => speech_balloon.field_tree(:id) %>
<% end %>