1 <%= form_for(@panel) do |f| %>
2 <%= render 'system/error_explanation', :obj => @panel %>
5 <%= f.label :caption %><br />
6 <%= f.text_field :caption %>
9 <%= f.label :width %><br />
10 <%= f.number_field :width %>
13 <%= f.label :height %><br />
14 <%= f.number_field :height %>
17 <%= f.label :border %><br />
18 <%= f.number_field :border %>
21 <%= f.label :publish %><br />
22 <%= f.collection_select :publish, t_select_items(MagicNumber['panel_visible_items']), :last, :first, :html => {:selected => @panel.publish} %>
29 <h2><%= t 'panels.create_from_json' -%></h2>
30 <%= form_for(@panel) do |f| %>
31 <%= render 'system/error_explanation', :obj => @panel %>
34 <label for="json">json data</label>
36 <%= text_field_tag "json" %>
38 <%= submit_tag t('panels.create_from_json') -%>
42 <h2><%= 't reorder' -%></h2>
43 <table id="t-sortable">
45 <% @panel.panel_elements.each do |elm| %>
46 <tr classname="<%= elm.class.to_s -%>" oid="<%= elm.id -%>">
47 <% case elm.class.to_s %>
48 <% when 'PanelPicture' %>
50 <%= link_to(tag(:img, elm.tmb_opt_img_tag), elm) %>
52 <% when 'SpeechBalloon' %>
57 <% when 'GroundPicture' %>
59 <%= link_to(tag(:img, elm.tmb_opt_img_tag), elm.picture) -%>
61 <% when 'GroundColor' %>
62 <td style="color: #<%= format("%06x", elm.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", elm.code) -%>;">
63 <%= format("%06x", elm.code ^ 0xffffff) %>
67 <%= h(truncate(elm.caption, :length => 12)) %>
73 <%= form_for(@panel) do |f| %>
74 <%= hidden_field_tag "json", nil, :id => 't-reorder' %>
75 <% unless @panel.new_record? -%>
76 <%= content_tag :div, '', :id => "panel-id-elm", :oid => @panel.id -%>
79 <%= submit_tag t('panels.create.title') -%>
86 jQuery( '#t-sortable tbody' ) . sortable( {
87 update: function( event, ui ) {
88 var panel_pictures_attributes = {};
89 var speech_balloons_attributes = {};
90 var ground_colors_attributes = {};
91 var ground_pictures_attributes = {};
93 jQuery( '#t-sortable tr' ) . map( function() {
94 switch ( this.getAttribute("classname") ){
96 panel_pictures_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
99 speech_balloons_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
101 case 'GroundPicture':
102 ground_pictures_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
105 ground_colors_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
111 panel_pictures_attributes: panel_pictures_attributes,
112 speech_balloons_attributes: speech_balloons_attributes,
113 ground_pictures_attributes: ground_pictures_attributes,
114 ground_colors_attributes: ground_colors_attributes
116 if ( $("#panel-id-elm") )
117 panel['id'] = $( "#panel-id-elm").attr("oid") ;
118 $("#t-reorder").val(JSON.stringify(panel));
122 jQuery( '#t-sortable tbody' ) . disableSelection();