+$ ->\r
+ element_tag_id = (element) ->\r
+ '#panel' + element.attr('panel_id') + element.attr('element_type') + element.attr('element_id')\r
+ \r
+ refresh_attribute = () ->\r
+ attr = {}\r
+ $('input').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
+ set_tree_value(keys, attr, $(this).val())\r
+ $('#pettanr-panel-json').val(JSON.stringify(attr['panels'][pettanr_current_panel_id.toString() ]))\r
+ \r
+ $('#tabs').tabs()\r
+ $('#elements-tabs').tabs()\r
+ \r
+ $('#pettanr-panel-submit').focusin ->\r
+ refresh_attribute()\r
+ \r
+ # panel\r
+ $('.pettanr-comic-panel').map ->\r
+ $(@).resizable {\r
+ stop: ( event, ui ) ->\r
+ trace = '#panel' + $(@).attr('panel_id')\r
+ $(trace + 'width').val($(@).width())\r
+ $(trace + 'height').val($(@).height())\r
+ }\r
+ # sync view \r
+ $('#panel' + pettanr_current_panel_id.toString() + 'width').focusout ->\r
+ trace = '#panel' + $(@).attr('panel_id')\r
+ $(trace).width(parseInt( $(@).val()))\r
+ \r
+ $('#panel' + pettanr_current_panel_id.toString() + 'height').focusout ->\r
+ trace = '#panel' + $(@).attr('panel_id')\r
+ $(trace).height(parseInt( $(@).val()))\r
+ \r
+ $('#panel' + pettanr_current_panel_id.toString() + 'border').focusout ->\r
+ trace = '#panel' + $(@).attr('panel_id')\r
+ $(trace).css('border-width', parseInt($(@).val()).toString() + 'px')\r
+ \r
+ \r
+ # panel picture\r
+ $('.pettanr-panel-picture-wrapper').map ->\r
+ $(@).draggable {\r
+ stop: ( event, ui ) ->\r
+ trace = '#panel' + $(@).attr('panel_id') + 'panel_picture' + $(@).attr('element_id')\r
+ img = '#panel' + $(@).attr('panel_id') + 'panel_picture' + $(@).attr('element_id') + 'img'\r
+ left = $(img).parent().position().left + $(@).position().left\r
+ top = $(img ).parent().position().top + $(@).position().top\r
+ $(trace + 'x').val(left)\r
+ $(trace + 'y').val(top)\r
+ }\r
+ \r
+ $('.panel-picture').map ->\r
+ $(@).resizable {\r
+ stop: ( event, ui ) ->\r
+ trace = '#panel' + $(@).parent().attr('panel_id') + 'panel_picture' + $(@).parent().attr('element_id')\r
+ $(trace + 'width').val($(@).width())\r
+ $(trace + 'height').val($(@).height())\r
+ handles: 'all'\r
+ }\r
+ \r
+ $('input').map ->\r
+ if $(@).attr('element_type') and $(@).attr('element_type') == 'panel_picture'\r
+ $(@).focusout ->\r
+ switch $(@).attr('column')\r
+ when 'width'\r
+ trace = element_tag_id($(@)) + 'img'\r
+ v = parseInt($(@).val())\r
+ $(trace).width(Math.abs(v))\r
+ sd = if v < 0\r
+ 'v/'\r
+ else\r
+ ''\r
+ pid = parseInt($(trace).attr('picture_id')).toString()\r
+ ext = $(trace).attr('ext')\r
+ src = '/pictures/' + sd + pid + '.' + ext\r
+ $(trace).attr('src', src)\r
+ when 'height'\r
+ trace = element_tag_id($(@)) + 'img'\r
+ v = parseInt($(@).val())\r
+ $(trace).height(Math.abs(v))\r
+ sd = if v < 0\r
+ 'h/'\r
+ else\r
+ ''\r
+ pid = parseInt($(trace).attr('picture_id')).toString()\r
+ ext = $(trace).attr('ext')\r
+ src = '/pictures/' + sd + pid + '.' + ext\r
+ $(trace).attr('src', src)\r
+ else\r
+ else\r
+ \r
+ # balloon\r
+ $('.pettanr-comic-balloon' ).map ->\r
+ $(@).draggable()\r
+ \r
+ $('.pettanr-balloon' ).map ->\r
+ $(@).resizable({handles: 'all'})\r
+ \r
+ # all\r
+ # disable form actions\r
+ # hide submit buttons\r
+ $('.edit_panel_picture' ).map ->\r
+ $(@).submit ->\r
+ false\r
+ \r
+ $('.edit_panel' ).map ->\r
+ $(@).submit ->\r
+ false\r
+ \r
+ $('.submit' ).map ->\r
+ $(@).hide()\r
+ \r
+ \r
self.panel.visible? roles
end
+ def tag_id c = nil
+ 'panel' + tag_panel_id + 'ground_color' + tag_element_id + c.to_s
+ end
+
+ def field_tag_id f
+ self.tag_id + f.to_s
+ end
+
+ def tag_panel_id
+ self.panel.new_record? ? '0' : self.panel.id.to_s
+ end
+
+ def tag_element_id
+ self.new_record? ? '0' : self.id.to_s
+ end
+
+ def tag_element_type
+ 'ground_color'
+ end
+
+ def field_tree f
+ 'panels-' + self.tag_panel_id + '-ground_colors_attributes_-' + self.tag_element_id + '-' + f.to_s
+ end
+
def self.default_page_size
25
end
{:src => self.picture.url, :width => tw, :height => th, :alt => self.caption}
end
+ def tag_id c = nil
+ 'panel' + tag_panel_id + 'ground_picture' + tag_element_id + c.to_s
+ end
+
+ def field_tag_id f
+ self.tag_id + f.to_s
+ end
+
+ def tag_panel_id
+ self.panel.new_record? ? '0' : self.panel.id.to_s
+ end
+
+ def tag_element_id
+ self.new_record? ? '0' : self.id.to_s
+ end
+
+ def tag_element_type
+ 'ground_picture'
+ end
+
+ def field_tree f
+ 'panels-' + self.tag_panel_id + '-ground_pictures_attributes_-' + self.tag_element_id + '-' + f.to_s
+ end
+
def repeat_text
@@repeat_texts[self.repeat]
end
self.publish > 0
end
+ def tag_id
+ 'panel' + self.tag_panel_id
+ end
+
+ def tag_panel_id
+ self.new_record? ? '0' : self.id.to_s
+ end
+
+ def field_tag_id f
+ self.tag_id + f.to_s
+ end
+
+ def field_tree f
+ 'panels-' + tag_panel_id + '-' + f.to_s
+ end
+
def self.default_page_size
25
end
def opt_img_tag spot = nil, opacity = 20
o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
- {:src => self.url, :id => "panel-picture#{self.id}", :vPicture => self.id, :width => self.width.abs, :height => self.height.abs, :alt => self.caption, :style => "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; #{o}"}
+ {:id => self.tag_id(:img), :panel_id => self.tag_panel_id, :element_id => self.tag_element_id, :element_type => self.tag_element_type,
+ :class => "panel-picture", :vPicture => self.id,
+ :src => self.url, :width => self.width.abs, :height => self.height.abs, :picture_id => self.picture_id, :ext => self.picture.ext, :alt => self.caption,
+ :style => "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; #{o}"}
end
def tmb_opt_img_tag
{:src => self.url, :width => tw, :height => th, :alt => self.caption}
end
+ def tag_id c = nil
+ 'panel' + tag_panel_id + 'panel_picture' + tag_element_id + c.to_s
+ end
+
+ def field_tag_id f
+ self.tag_id + f.to_s
+ end
+
+ def tag_panel_id
+ self.panel.new_record? ? '0' : self.panel.id.to_s
+ end
+
+ def tag_element_id
+ self.new_record? ? '0' : self.id.to_s
+ end
+
+ def tag_element_type
+ 'panel_picture'
+ end
+
+ def field_tree f
+ 'panels-' + self.tag_panel_id + '-panel_pictures_attributes_-' + self.tag_element_id + '-' + f.to_s
+ end
+
def self.default_page_size
25
end
-<%= form_for(@ground_color) do |f| %>
- <%= render 'system/error_explanation', :obj => @ground_color %>
+<%= form_for(ground_color) do |f| %>
+ <%= render 'system/error_explanation', :obj => ground_color %>
<div class="field">
<%= f.label :code %><br />
- <%= f.text_field :code %>
+ <%= f.text_field :code, :id => ground_color.field_tag_id(:code), :panel_id => ground_color.tag_panel_id, :element_id => ground_color.tag_element_id, :element_type => ground_color.tag_element_type, :column => :code, :tree => ground_color.field_tree(:code) %>
</div>
<div class="field">
<%= f.label :z %><br />
- <%= f.number_field :z %>
+ <%= f.number_field :z, :id => ground_color.field_tag_id(:z), :panel_id => ground_color.tag_panel_id, :element_id => ground_color.tag_element_id, :element_type => ground_color.tag_element_type, :column => :z, :tree => ground_color.field_tree(:z) %>
</div>
- <%= f.hidden_field :panel_id %>
+ <%= f.hidden_field :panel_id, :id => ground_color.field_tag_id(:panel_id), :panel_id => ground_color.tag_panel_id, :element_id => ground_color.tag_element_id, :element_type => ground_color.tag_element_type, :column => :panel_id, :tree => ground_color.field_tree(:panel_id) %>
<div class="actions">
- <%= f.submit %>
+ <%= f.submit t('ground_colors.submit'), :class => "submit" %>
</div>
<% end %>
<h2><%= t('home.index.catch') -%></h2>
<%= render 'panels/standard', :panel => @panel, :author => @author %>
<h2><%= t('ground_colors.update_color') -%></h2>
-<%= render 'form' %>
+<%= render 'form', :ground_color => @ground_color %>
<h2><%= t('home.index.catch') -%></h2>
<%= render 'panels/standard', :panel => @panel, :author => @author %>
<h2><%= t('ground_colors.create_color') -%></h2>
-<%= render 'form' %>
+<%= render 'form', :ground_color => @ground_color %>
-<%= form_for(@ground_picture) do |f| %>
- <%= render 'system/error_explanation', :obj => @ground_picture %>
+<%= form_for(ground_picture) do |f| %>
+ <%= render 'system/error_explanation', :obj => ground_picture %>
<div class="field">
<%= f.label :caption %><br />
- <%= f.text_field :caption %>
+ <%= f.text_field :caption, :id => ground_picture.field_tag_id(:caption), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :caption, :tree => ground_picture.field_tree(:caption) %>
</div>
<div class="field">
<%= f.label :repeat %><br />
- <%= f.collection_select :repeat, t_select_items(MagicNumber['ground_picture_repeat_items']), :last, :first, :html => {:selected => @ground_picture.repeat} %>
+ <%= f.collection_select :repeat, t_select_items(MagicNumber['ground_picture_repeat_items']), :last, :first, {:html => {:selected => ground_picture.repeat}}, {:id => ground_picture.field_tag_id(:repeat), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :repeat, :tree => ground_picture.field_tree(:repeat)} %>
</div>
<div class="field">
<%= f.label :x %><br />
- <%= f.number_field :x %>
+ <%= f.number_field :x, :id => ground_picture.field_tag_id(:x), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :x, :tree => ground_picture.field_tree(:x) %>
</div>
<div class="field">
<%= f.label :y %><br />
- <%= f.number_field :y %>
+ <%= f.number_field :y, :id => ground_picture.field_tag_id(:y), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :y, :tree => ground_picture.field_tree(:y) %>
</div>
<div class="field">
<%= f.label :z %><br />
- <%= f.number_field :z %>
+ <%= f.number_field :z, :id => ground_picture.field_tag_id(:z), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :z, :tree => ground_picture.field_tree(:z) %>
</div>
<div class="field">
<%= f.label :t %><br />
- <%= f.number_field :t %>
+ <%= f.number_field :t, :id => ground_picture.field_tag_id(:t), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :t, :tree => ground_picture.field_tree(:t) %>
</div>
- <%= f.hidden_field :panel_id %>
- <%= f.hidden_field :picture_id %>
+ <%= f.hidden_field :panel_id, :id => ground_picture.field_tag_id(:panel_id), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :panel_id, :tree => ground_picture.field_tree(:panel_id) %>
+ <%= f.hidden_field :picture_id, :id => ground_picture.field_tag_id(:picture_id), :panel_id => ground_picture.tag_panel_id, :element_id => ground_picture.tag_element_id, :element_type => ground_picture.tag_element_type, :column => :picture_id, :tree => ground_picture.field_tree(:picture_id) %>
<div class="actions">
- <%= f.submit %>
+ <%= f.submit t('ground_pictures.submit'), :class => "submit" %>
</div>
<% end %>
<h2><%= t('home.index.catch') -%></h2>
<%= render 'panels/standard', :panel => @panel, :author => @author %>
<h2><%= t('ground_colors.update_color') -%></h2>
-<%= render 'form' %>
+<%= render 'form', :ground_picture => @ground_picture %>
<%= render 'resource_pictures/list_item', :resource_picture => @ground_picture.picture.resource_picture %>
</table>
<% end %>
-<%= render 'form' %>
+<%= render 'form', :ground_picture => @ground_picture %>
<div class="field">
<%= f.label :caption %><br />
- <%= f.text_field :caption %>
+ <%= f.text_field :caption, :id => panel_picture.field_tag_id(:caption), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :caption, :tree => panel_picture.field_tree(:caption) %>
</div>
<div class="field">
<%= f.label :x %><br />
- <%= f.number_field :x %>
+ <%= f.number_field :x, :id => panel_picture.field_tag_id(:x), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :x, :tree => panel_picture.field_tree(:x) %>
</div>
<div class="field">
<%= f.label :y %><br />
- <%= f.number_field :y %>
+ <%= f.number_field :y, :id => panel_picture.field_tag_id(:y), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :y, :tree => panel_picture.field_tree(:y) %>
</div>
<div class="field">
<%= f.label :z %><br />
- <%= f.number_field :z %>
+ <%= f.number_field :z, :id => panel_picture.field_tag_id(:z), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :z, :tree => panel_picture.field_tree(:z) %>
</div>
<div class="field">
<%= f.label :t %><br />
- <%= f.number_field :t %>
+ <%= f.number_field :t, :id => panel_picture.field_tag_id(:t), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :t, :tree => panel_picture.field_tree(:t) %>
</div>
<div class="field">
<%= f.label :width %><br />
- <%= f.number_field :width %>
+ <%= f.number_field :width, :id => panel_picture.field_tag_id(:width), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :width, :tree => panel_picture.field_tree(:width) %>
</div>
<div class="field">
<%= f.label :height %><br />
- <%= f.number_field :height %>
+ <%= f.number_field :height, :id => panel_picture.field_tag_id(:height), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :height, :tree => panel_picture.field_tree(:height) %>
</div>
<div class="field">
<%= f.label :link %><br />
- <%= f.text_field :link %>
+ <%= f.text_field :link, :id => panel_picture.field_tag_id(:link), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :link, :tree => panel_picture.field_tree(:link) %>
</div>
- <%= f.hidden_field :panel_id %>
- <%= f.hidden_field :picture_id %>
+ <%= f.hidden_field :panel_id, :id => panel_picture.field_tag_id(:panel_id), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :panel_id, :tree => panel_picture.field_tree(:panel_id) %>
+ <%= f.hidden_field :picture_id, :id => panel_picture.field_tag_id(:picture_id), :panel_id => panel_picture.tag_panel_id, :element_id => panel_picture.tag_element_id, :element_type => panel_picture.tag_element_type, :column => :picture_id, :tree => panel_picture.field_tree(:picture_id) %>
<div class="actions">
- <%= f.submit %>
+ <%= f.submit t('panel_pictures.submit'), :class => "submit" %>
</div>
<% end %>
-<div id="panel<%= panel.id -%>" trace="pettanr-panel_<%= panel.id -%>" 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;">
+<div id="<%= panel.tag_id -%>" panel_id="<%= panel.tag_panel_id -%>" 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' %>
- <div id="vpicture<%= elm.id -%>">
+ <div id="<%= elm.tag_id(:div) -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>" class="pettanr-panel-picture-wrapper">
<%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(spot)), elm.link) %>
</div>
<% when 'SpeechBalloon' %>
<div id="vballoon<%= elm.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="balloon<%= elm.id -%>" src="<%= elm.balloon.system_picture.url -%>" alt="<%= elm.caption -%>">
+ <img id="balloon<%= elm.id -%>" 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><%= h elm.speech.content -%></span>
</p>
<div class="field">
<%= f.label :caption %><br />
- <%= f.text_field :caption, :id => 'pettanr-panel_' + @panel.id.to_s + '_caption', :tree => 'panels_' + @panel.id.to_s + '_caption' -%>
+ <%= f.text_field :caption, :id => @panel.field_tag_id(:caption), :panel_id => @panel.tag_panel_id, :column => :caption, :tree => @panel.field_tree(:caption) -%>
</div>
<div class="field">
<%= f.label :width %><br />
- <%= f.number_field :width, :id => 'pettanr-panel_' + @panel.id.to_s + '_width', :tree => 'panels_' + @panel.id.to_s + '_width', :trace => 'panel' + @panel.id.to_s %>
+ <%= f.number_field :width, :id => @panel.field_tag_id(:width), :panel_id => @panel.tag_panel_id, :column => :width, :tree => @panel.field_tree(:width) %>
</div>
<div class="field">
<%= f.label :height %><br />
- <%= f.number_field :height, :id => 'pettanr-panel_' + @panel.id.to_s + '_height', :tree => 'panels_' + @panel.id.to_s + '_height', :trace => 'panel' + @panel.id.to_s %>
+ <%= f.number_field :height, :id => @panel.field_tag_id(:height), :panel_id => @panel.tag_panel_id, :column => :height, :tree => @panel.field_tree(:height) %>
</div>
<div class="field">
<%= f.label :border %><br />
- <%= f.number_field :border, :id => 'pettanr-panel_' + @panel.id.to_s + '_border', :tree => 'panels_' + @panel.id.to_s + '_border', :trace => 'panel' + @panel.id.to_s %>
+ <%= f.number_field :border, :id => @panel.field_tag_id(:border), :panel_id => @panel.tag_panel_id, :column => :border, :tree => @panel.field_tree(:border) %>
</div>
<div class="field">
<%= f.label :publish %><br />
- <%= f.collection_select :publish, t_select_items(MagicNumber['panel_visible_items']), :last, :first, :html => {:selected => @panel.publish}, :tree => 'panels_' + @panel.id.to_s + '_caption' %>
+ <%= f.collection_select :publish, t_select_items(MagicNumber['panel_visible_items']), :last, :first, {:html => {:selected => @panel.publish}}, {:id => @panel.field_tag_id(:publish), :panel_id => @panel.tag_panel_id, :column => :publish, :tree => @panel.field_tree(:publish)} %>
</div>
<div class="actions">
- <%= f.submit %>
+ <%= f.submit t('panels.submit'), :class => "submit" %>
</div>
<% end %>
<h2><%= t 'panels.create_from_json' -%></h2>
<% when 'SpeechBalloon' %>
<%= elm.id -%>
<% when 'GroundPicture' %>
- <%= tag(:img, elm.tmb_opt_img_tag) -%>
+ <%= render 'ground_pictures/form', :ground_picture => elm %>
<% when 'GroundColor' %>
- <div style="color: #<%= format("%06x", elm.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", elm.code) -%>;">
- <%= format("%06x", elm.code ^ 0xffffff) %>
- </div>
+ <%= render 'ground_colors/form', :ground_color => elm %>
<% end %>
</div>
<% end %>
<% end %>
</tbody>
</table>
- <%= form_for(@panel) do |f| %>
- <%= hidden_field_tag "json", nil, :id => 't-reorder' %>
- <% unless @panel.new_record? -%>
- <%= content_tag :div, '', :id => "panel-id-elm", :oid => @panel.id -%>
- <% end %>
- <div>
- <%= submit_tag t('panels.create.title') -%>
- </div>
- <% end %>
</div>
<div id="tabs-4">
<h2><%= 'z reorder' -%></h2>
<% end %>
</tbody>
</table>
- <%= form_for(@panel) do |f| %>
- <%= hidden_field_tag "json", nil, :id => 'z-reorder' %>
- <% unless @panel.new_record? -%>
- <%= content_tag :div, '', :id => "panel-id-zorderd", :oid => @panel.id -%>
- <% end %>
- <div>
- <%= submit_tag t('panels.create.title') -%>
- </div>
- <% end %>
</div>
</div>
</style>
<script>
<!--
-var pettanr_current_panel_id = <%= @panel.id -%>;
+var pettanr_current_panel_id = <%= @panel.tag_panel_id -%>;
-$( function() {
- $( '#tabs' ) . tabs();
- $( '#elements-tabs' ) . tabs();
-});
function confirm_confirm_confirm() {
confirm( );
};
set_tree_value(keys, last_attr[key], value);
}
};
-function refresh_attribute() {
- var attr = {};
- jQuery( 'input' ) . map( function() {
- if ($(this).attr('tree')) {
- var keys = $(this).attr('tree').split('_');
- set_tree_value(keys, attr, $(this).val());
- $('#pettanr-panel-json').val(JSON.stringify(attr['panels'][pettanr_current_panel_id.toString() ]));
- }
- } );
-};
jQuery( function() {
- jQuery( $('#pettanr-panel_' + pettanr_current_panel_id.toString() + '_width') ) . focusout(function(){
- $('#' + $(this).attr('trace')).width(parseInt( $(this).val()));
- });
- jQuery( $('#pettanr-panel_' + pettanr_current_panel_id.toString() + '_height') ) . focusout(function(){
- $('#' + $(this).attr('trace')).height(parseInt( $(this).val()));
- });
- jQuery( $('#pettanr-panel_' + pettanr_current_panel_id.toString() + '_border') ) . focusout(function(){
- $('#' + $(this).attr('trace')).css('border-width', parseInt($(this).val()).toString() + 'px');
- });
-} );
-jQuery( function() {
- jQuery( '#pettanr-panel-submit' ) . focusin(function(){
- refresh_attribute();
- });
- jQuery( '#panel' + pettanr_current_panel_id.toString() ) . resizable({
- stop: function( event, ui ) {
- var trace = this.getAttribute('trace');
- $($('#' + trace + '_width')).val($(this).width());
- $($('#' + trace + '_height')).val($(this).height());
- refresh_attribute();
- }
- });
- <% @panel.panel_elements.each do |elm| %>
- <% case elm.class.to_s %>
- <% when 'PanelPicture' %>
- jQuery( '#vpicture<%= elm.id -%>' ) . draggable();
- jQuery( '#panel-picture<%= elm.id -%>' ) . resizable({handles: 'all'});
- <% when 'SpeechBalloon' %>
- jQuery( '#vballoon<%= elm.id -%>' ) . draggable();
- jQuery( '#balloon<%= elm.id -%>' ) . resizable({handles: 'all'});
- <% when 'GroundPicture' %>
- <% when 'GroundColor' %>
- <% end %>
- <% end %>
jQuery( '#t-sortable tbody' ) . sortable( {
update: function( event, ui ) {
var panel_pictures_attributes = {};
<h1><%= t '.title' -%></h1>
+
+<%= render 'panels/body', :panel => @panel, :author => @author, :spot => nil %>
<%= render 'form' %>
title: コマ 生一覧
browse:
title: コマ 生単票
+ submit: コマ作成する
create_from_json: jsonデータからコマ作成する
panel_pictures:
index:
title: コマ絵 生一覧
browse:
title: コマ絵 生単票
+ submit: 作成する
resource_picture: 追加する素材
panel_picture: 変更するコマ絵
speech_balloons:
title: フキダシ 生一覧
browse:
title: フキダシ 生単票
+ submit: 作成する
speeches:
index:
title: セリフ一覧
title: 絵地 生単票
create_ground_picture: 追加する絵地
update_ground_picture: 変更する絵地
+ submit: 作成する
ground_colors:
index:
title: 色地一覧
title: 色地 生単票
create_color: 追加する色地
update_color: 変更する色地
+ submit: 作成する
original_pictures:
index:
title: 原画一覧