3 <li><a href="#tabs-1">panel</a></li>
4 <li><a href="#tabs-2">t order</a></li>
5 <li><a href="#tabs-3">z order</a></li>
8 <%= form_for(@panel) do |f| %>
9 <%= render 'system/error_explanation', :obj => @panel %>
12 <%= f.label :caption %><br />
13 <%= f.text_field :caption %>
16 <%= f.label :width %><br />
17 <%= f.number_field :width, :id => 'panel-width' %>
20 <%= f.label :height %><br />
21 <%= f.number_field :height, :id => 'panel-height' %>
24 <%= f.label :border %><br />
25 <%= f.number_field :border %>
28 <%= f.label :publish %><br />
29 <%= f.collection_select :publish, t_select_items(MagicNumber['panel_visible_items']), :last, :first, :html => {:selected => @panel.publish} %>
35 <h2><%= t 'panels.create_from_json' -%></h2>
36 <%= form_for(@panel) do |f| %>
37 <%= render 'system/error_explanation', :obj => @panel %>
40 <label for="json">json data</label>
42 <%= text_field_tag "json" %>
44 <%= submit_tag t('panels.create_from_json') -%>
49 <h2><%= 't reorder' -%></h2>
50 <table id="t-sortable">
52 <% @panel.panel_elements.each do |elm| %>
53 <tr classname="<%= elm.class.to_s -%>" oid="<%= elm.id -%>">
54 <% case elm.class.to_s %>
55 <% when 'PanelPicture' %>
57 <%= tag(:img, elm.tmb_opt_img_tag) %>
59 <% when 'SpeechBalloon' %>
64 <% when 'GroundPicture' %>
66 <%= tag(:img, elm.tmb_opt_img_tag) -%>
68 <% when 'GroundColor' %>
69 <td style="color: #<%= format("%06x", elm.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", elm.code) -%>;">
70 <%= format("%06x", elm.code ^ 0xffffff) %>
74 <%= h(truncate(elm.caption, :length => 12)) %>
80 <%= form_for(@panel) do |f| %>
81 <%= hidden_field_tag "json", nil, :id => 't-reorder' %>
82 <% unless @panel.new_record? -%>
83 <%= content_tag :div, '', :id => "panel-id-elm", :oid => @panel.id -%>
86 <%= submit_tag t('panels.create.title') -%>
91 <h2><%= 'z reorder' -%></h2>
92 <table id="z-sortable">
94 <% @panel.zorderd_elements.each do |elm| %>
95 <tr classname="<%= elm.class.to_s -%>" oid="<%= elm.id -%>">
96 <% case elm.class.to_s %>
97 <% when 'PanelPicture' %>
99 <%= tag(:img, elm.tmb_opt_img_tag) %>
101 <% when 'SpeechBalloon' %>
106 <% when 'GroundPicture' %>
108 <%= tag(:img, elm.tmb_opt_img_tag) -%>
110 <% when 'GroundColor' %>
111 <td style="color: #<%= format("%06x", elm.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", elm.code) -%>;">
112 <%= format("%06x", elm.code ^ 0xffffff) %>
116 <%= h(truncate(elm.caption, :length => 12)) %>
122 <%= form_for(@panel) do |f| %>
123 <%= hidden_field_tag "json", nil, :id => 'z-reorder' %>
124 <% unless @panel.new_record? -%>
125 <%= content_tag :div, '', :id => "panel-id-zorderd", :oid => @panel.id -%>
128 <%= submit_tag t('panels.create.title') -%>
137 margin: 0 3px 3px 3px;
145 margin: 0 3px 3px 3px;
156 $( '#tabs' ) . tabs();
158 var panel_attributes = {};
160 jQuery( '#panel<%= @panel.id -%>' ) . resizable({
161 stop: function( event, ui ) {
162 var p = $('#panel<%= @panel.id -%>');
163 $("#panel-width").val(p.width());
165 confirm( p.width() );
166 panel_attributes['width'] = this.getAttribute('width');
169 <% @panel.panel_elements.each do |elm| %>
170 <% case elm.class.to_s %>
171 <% when 'PanelPicture' %>
172 jQuery( '#vpicture<%= elm.id -%>' ) . draggable();
173 jQuery( '#panel-picture<%= elm.id -%>' ) . resizable({handles: 'all'});
174 <% when 'SpeechBalloon' %>
175 jQuery( '#vballoon<%= elm.id -%>' ) . draggable();
176 jQuery( '#balloon<%= elm.id -%>' ) . resizable({handles: 'all'});
177 <% when 'GroundPicture' %>
178 <% when 'GroundColor' %>
181 jQuery( '#t-sortable tbody' ) . sortable( {
182 update: function( event, ui ) {
183 var panel_pictures_attributes = {};
184 var speech_balloons_attributes = {};
185 var ground_colors_attributes = {};
186 var ground_pictures_attributes = {};
188 jQuery( '#t-sortable tr' ) . map( function() {
189 switch ( this.getAttribute("classname") ){
191 panel_pictures_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
193 case 'SpeechBalloon':
194 speech_balloons_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
196 case 'GroundPicture':
197 ground_pictures_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
200 ground_colors_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), t: i};
206 panel_pictures_attributes: panel_pictures_attributes,
207 speech_balloons_attributes: speech_balloons_attributes,
208 ground_pictures_attributes: ground_pictures_attributes,
209 ground_colors_attributes: ground_colors_attributes
211 if ( $("#panel-id-elm") )
212 panel['id'] = $( "#panel-id-elm").attr("oid") ;
213 $("#t-reorder").val(JSON.stringify(panel));
217 jQuery( '#t-sortable tbody' ) . disableSelection();
219 jQuery( '#z-sortable tbody' ) . sortable( {
220 update: function( event, ui ) {
221 var panel_pictures_attributes = {};
222 var speech_balloons_attributes = {};
223 var ground_colors_attributes = {};
224 var ground_pictures_attributes = {};
226 jQuery( '#z-sortable tr' ) . map( function() {
227 switch ( this.getAttribute("classname") ){
229 panel_pictures_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), z: i};
231 case 'SpeechBalloon':
232 speech_balloons_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), z: i};
234 case 'GroundPicture':
235 ground_pictures_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), z: i};
238 ground_colors_attributes[this.getAttribute("oid")] = {id: this.getAttribute("oid"), z: i};
244 panel_pictures_attributes: panel_pictures_attributes,
245 speech_balloons_attributes: speech_balloons_attributes,
246 ground_pictures_attributes: ground_pictures_attributes,
247 ground_colors_attributes: ground_colors_attributes
249 if ( $("#panel-id-zorderd") )
250 panel['id'] = $( "#panel-id-zorderd").attr("oid") ;
251 $("#z-reorder").val(JSON.stringify(panel));
255 jQuery( '#t-sortable tbody' ) . disableSelection();