equal
deleted
inserted
replaced
212 } |
212 } |
213 }, |
213 }, |
214 |
214 |
215 |
215 |
216 /** |
216 /** |
|
217 * Types management |
|
218 */ |
|
219 types: { |
|
220 |
|
221 switchSubtypes: function(element) { |
|
222 var source = $(this); |
|
223 var switcher = $('i.switch', source); |
|
224 var td = source.parents('td'); |
|
225 var subtypes = $('.subtypes', td); |
|
226 var datatype = source.parents('tr'); |
|
227 if (switcher.hasClass('fa-plus-square-o')) { |
|
228 var container = datatype.parents('table'); |
|
229 subtypes.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>'); |
|
230 MyAMS.ajax.post(container.data('ams-location') + '/get-subtypes-table.json', |
|
231 {object_name: datatype.data('ams-element-name')}, |
|
232 function(result) { |
|
233 subtypes.html(result); |
|
234 if (result) { |
|
235 MyAMS.initContent(subtypes); |
|
236 switcher.removeClass('fa-plus-square-o') |
|
237 .addClass('fa-minus-square-o'); |
|
238 } |
|
239 }); |
|
240 } else { |
|
241 MyAMS.skin.cleanContainer(subtypes); |
|
242 subtypes.empty(); |
|
243 switcher.removeClass('fa-minus-square-o') |
|
244 .addClass('fa-plus-square-o'); |
|
245 } |
|
246 }, |
|
247 |
|
248 refreshSubtypes: function(options) { |
|
249 // Reload widget |
|
250 PyAMS_content.refreshTable(options); |
|
251 } |
|
252 }, |
|
253 |
|
254 |
|
255 /** |
217 * Paragraphs management |
256 * Paragraphs management |
218 */ |
257 */ |
219 paragraphs: { |
258 paragraphs: { |
220 |
259 |
221 /* Store and restore paragraphs state on reload */ |
260 /* Store and restore paragraphs state on reload */ |
243 } else { |
282 } else { |
244 $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger'); |
283 $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger'); |
245 } |
284 } |
246 }); |
285 }); |
247 }; |
286 }; |
|
287 }, |
|
288 |
|
289 refreshParagraphs: function(options) { |
|
290 // Reload widget |
|
291 var widget = PyAMS_content.refreshTable(options); |
|
292 // Check fieldset state |
|
293 var legend = widget.siblings('legend'); |
|
294 if (legend.parents('fieldset:first').hasClass('switched')) { |
|
295 legend.click(); |
|
296 } |
248 }, |
297 }, |
249 |
298 |
250 refreshParagraph: function(changes) { |
299 refreshParagraph: function(changes) { |
251 var container = $('table[id="paragraphs_list"]'); |
300 var container = $('table[id="paragraphs_list"]'); |
252 var para = $('tr[data-ams-element-name="' + changes.object_name + '"]', container); |
301 var para = $('tr[data-ams-element-name="' + changes.object_name + '"]', container); |