PluginProbe ʕ •ᴥ•ʔ
Nested Pages / 3.2.14
Nested Pages v3.2.14
3.2.15 3.2.14 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.2 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.3.1 1.6.3.2 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.6 1.6.7 1.6.8 1.7.0 1.7.1 2.0.1 2.0.2 2.0.3 2.0.4 3.0.1 3.0.10 3.0.11 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.21 3.1.22 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7
wp-nested-pages / assets / js / lib / nestedpages.quickedit-post.js
wp-nested-pages / assets / js / lib Last commit date
jquery.mjs.nestedSortable.js 4 years ago jquery.ui.touch-punch.min.js 11 years ago nestedpages-factory.js 3 years ago nestedpages.bulk-actions.js 4 years ago nestedpages.check-all.js 9 years ago nestedpages.clone.js 3 years ago nestedpages.confirm-delete.js 8 years ago nestedpages.dropdowns.js 8 years ago nestedpages.formatter.js 3 years ago nestedpages.hidden-item-count.js 9 years ago nestedpages.manual-sync.js 9 years ago nestedpages.menu-links.js 3 years ago nestedpages.menu-search.js 2 weeks ago nestedpages.menu-toggle.js 8 years ago nestedpages.modals.js 8 years ago nestedpages.move-post.js 8 years ago nestedpages.nesting.js 3 years ago nestedpages.new-post.js 6 years ago nestedpages.page-toggle.js 4 years ago nestedpages.post-search.js 9 years ago nestedpages.quickedit-link.js 8 years ago nestedpages.quickedit-post.js 3 years ago nestedpages.settings-admin-customization.js 7 years ago nestedpages.settings-reset.js 7 years ago nestedpages.settings.js 3 years ago nestedpages.sync-menu-setting.js 8 years ago nestedpages.tabs.js 6 years ago nestedpages.trash-with-children.js 6 years ago nestedpages.trash.js 8 years ago nestedpages.userprefs-reset.js 7 years ago nestedpages.wpml.js 8 years ago
nestedpages.quickedit-post.js
548 lines
1 var NestedPages = NestedPages || {};
2
3 /**
4 * Quick Edit functionality for posts
5 * @package Nested Pages
6 * @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
7 */
8 NestedPages.QuickEditPost = function()
9 {
10 var plugin = this;
11 var $ = jQuery;
12
13 plugin.formatter = new NestedPages.Formatter;
14 plugin.button = ''; // The quick edit button
15 plugin.initialData = ''; // The unedited post data
16 plugin.parent_li = ''; // The post's nested pages list element
17 plugin.form = ''; // The newly created form
18 plugin.flatTerms = ''; // Object containing flat taxonomy IDs
19 plugin.termNames = ''; // Flat Taxonomy Term Names
20 plugin.saveButton = ''; // Save button
21 plugin.newData = ''; // New Data, after save
22 plugin.row = ''; // The row being edited
23
24 plugin.bindEvents = function()
25 {
26 $(document).on('click', NestedPages.selectors.quickEditOpen, function(e){
27 e.preventDefault();
28 plugin.button = $(this);
29 plugin.openForm();
30 });
31 $(document).on('click', NestedPages.selectors.quickEditCancel, function(e){
32 e.preventDefault();
33 plugin.formatter.removeQuickEdit();
34 });
35 $(document).on('change', '.keep_private', function(){
36 if ( this.checked ){
37 $('.post_password').val('').prop('readonly', true);
38 } else {
39 $('.post_password').prop('readonly', false);
40 }
41 });
42 $(document).on('click', NestedPages.selectors.quickEditSaveButton, function(e){
43 e.preventDefault();
44 plugin.saveButton = $(this);
45 plugin.save();
46 });
47 $(document).on('keydown', function(e){
48 if ( e.keyCode === 27 ) plugin.formatter.removeQuickEdit();
49 });
50 }
51
52
53 // Create and open the quick edit form
54 plugin.openForm = function()
55 {
56 plugin.setInitialData();
57 plugin.createForm();
58 plugin.populateForm();
59 plugin.populateFlatTaxonomies();
60 }
61
62
63 // Set the unedited initial data
64 plugin.setInitialData = function()
65 {
66 plugin.initialData = {
67 id : $(plugin.button).attr('data-id'),
68 title : $(plugin.button).attr('data-title'),
69 slug : $(plugin.button).attr('data-slug'),
70 author : $(plugin.button).attr('data-author'),
71 cs : $(plugin.button).attr('data-commentstatus'),
72 status : $(plugin.button).attr('data-status'),
73 template : $(plugin.button).attr('data-template'),
74 month : $(plugin.button).attr('data-month'),
75 day : $(plugin.button).attr('data-day'),
76 year : $(plugin.button).attr('data-year'),
77 hour : $(plugin.button).attr('data-hour'),
78 minute : $(plugin.button).attr('data-minute'),
79 navstatus : $(plugin.button).attr('data-navstatus'),
80 navCustomUrl: $(plugin.button).attr('data-custom-url'),
81 npstatus : $(plugin.button).attr('data-np-status'),
82 navtitle : $(plugin.button).attr('data-navtitle'),
83 navtitleattr : $(plugin.button).attr('data-navtitleattr'),
84 navcss : $(plugin.button).attr('data-navcss'),
85 linktarget : $(plugin.button).attr('data-linktarget'),
86 password : $(plugin.button).attr('data-password'),
87 datepicker : $(plugin.button).attr('data-datepicker'),
88 time: $(plugin.button).attr('data-formattedtime'),
89 timeTwentyFour : $(plugin.button).attr('data-time'),
90 ampm: $(plugin.button).attr('data-ampm'),
91 timeFormat: $(plugin.button).attr('data-timeformat'),
92 sticky: $(plugin.button).attr('data-sticky')
93 };
94
95 // Add Custom Fields if Available
96 var attrs = $(plugin.button)[0].attributes;
97 $.each(attrs, function(i, attr){
98 if ( !attr.name.includes('data-npcustom') ) return;
99 plugin.initialData[attr.name] = attr.value;
100 });
101
102 // Add Array of Taxonomies to the data object using classes applied to the list element
103 plugin.initialData.h_taxonomies = [];
104 plugin.initialData.f_taxonomies = [];
105
106 plugin.parent_li = $(plugin.button).closest(NestedPages.selectors.row).parent('li');
107 var classes = $(plugin.parent_li).attr('class').split(/\s+/);
108 for ( i = 0; i < classes.length; i++ ){
109 if ( classes[i].substring(0, 3) === 'in-'){
110 plugin.initialData.h_taxonomies.push(classes[i]);
111 }
112 if ( classes[i].substring(0, 4) === 'inf-' ){
113 plugin.initialData.f_taxonomies.push(classes[i]);
114 }
115 }
116 }
117
118
119 // Create the form and append it to the row
120 plugin.createForm = function()
121 {
122 plugin.form = $(NestedPages.selectors.quickEditPostForm).clone();
123 if ( $(plugin.parent_li).children('ol').length > 0 ){
124 var child_ol = $(plugin.parent_li).children('ol');
125 $(plugin.form).insertBefore(child_ol);
126 } else {
127 $(plugin.form).appendTo(plugin.parent_li);
128 }
129 $(plugin.form).siblings(NestedPages.selectors.row).hide();
130 $(plugin.form).show();
131 }
132
133
134 // Populate the new quick edit form
135 plugin.populateForm = function()
136 {
137 $(plugin.form).find('.page_id').html('<em>ID:</em> ' + plugin.initialData.id);
138 $(plugin.form).find('.np_id').val(plugin.initialData.id);
139 $(plugin.form).find('.np_title').val(plugin.initialData.title);
140 $(plugin.form).find('.np_slug').val(plugin.initialData.slug);
141 $(plugin.form).find('.np_author select').val(plugin.initialData.author);
142 $(plugin.form).find('.np_status').val(plugin.initialData.status);
143 $(plugin.form).find('.np_nav_title').val(plugin.initialData.navtitle);
144 $(plugin.form).find('.np_nav_css_classes').val(plugin.initialData.navcss);
145 $(plugin.form).find('.np_title_attribute').val(plugin.initialData.navtitleattr);
146 $(plugin.form).find('.np_nav_custom_url').val(plugin.initialData.navCustomUrl);
147 $(plugin.form).find('.post_password').val(plugin.initialData.password);
148 $(plugin.form).find('.np_publish_date').val(plugin.initialData.datepicker);
149 if ( plugin.initialData.cs === 'open' ) $(plugin.form).find('.np_cs').attr('checked', 'checked');
150
151 if ( plugin.initialData.template !== '' ){
152 $(plugin.form).find('.np_template').val(plugin.initialData.template);
153 } else {
154 $(plugin.form).find('.np_template').val('default');
155 }
156
157 if ( plugin.initialData.status === 'private' ){
158 $(plugin.form).find('.post_password').attr('readonly', true);
159 $(plugin.form).find('.keep_private').attr('checked', true);
160 }
161
162 if ( plugin.initialData.npstatus === 'hide' ){
163 $(plugin.form).find('.nested_pages_status').attr('checked', 'checked');
164 } else {
165 $(plugin.form).find('.nested_pages_status').removeAttr('checked');
166 }
167
168 if ( plugin.initialData.navstatus === 'hide' ) {
169 $(plugin.form).find('.np_nav_status').attr('checked', 'checked');
170 } else {
171 $(plugin.form).find('.np_nav_status').attr('checked', false);
172 }
173
174 if ( plugin.initialData.linktarget === "_blank" ) {
175 $(plugin.form).find('.link_target').attr('checked', 'checked');
176 } else {
177 $(plugin.form).find('.link_target').attr('checked', false);
178 }
179
180 if ( plugin.initialData.status === "private" ) {
181 $(plugin.form).find('.np_status').val('publish');
182 }
183
184 if ( plugin.initialData.sticky === 'sticky' ){
185 $(plugin.form).find('.np-sticky').attr('checked', 'checked');
186 } else {
187 $(plugin.form).find('.np-sticky').removeAttr('checked');
188 }
189
190 // Date Fields
191 if ( plugin.initialData.timeFormat === 'H:i' ){
192 $(plugin.form).find('.np_time').val(plugin.initialData.timeTwentyFour);
193 } else {
194 $(plugin.form).find('.np_time').val(plugin.initialData.time);
195 $(plugin.form).find('.np_ampm').val(plugin.initialData.ampm);
196 $(plugin.form).find('select[name="mm"]').val(plugin.initialData.month);
197 $(plugin.form).find('input[name="jj"]').val(plugin.initialData.day);
198 $(plugin.form).find('input[name="aa"]').val(plugin.initialData.year);
199 $(plugin.form).find('input[name="hh"]').val(plugin.initialData.hour);
200 $(plugin.form).find('input[name="mn"]').val(plugin.initialData.minute);
201 }
202
203 // Custom Fields
204 for ( var key in plugin.initialData ){
205 if ( !key.includes('npcustom') ) continue;
206 if ( plugin.initialData.hasOwnProperty(key) ){
207 var inputName = key.replace('data-npcustom-', '');
208 inputName = inputName.toLowerCase();
209 $(plugin.form).find('[data-np-custom-field="' + inputName + '"]').val(plugin.initialData[key]);
210 }
211 }
212
213 plugin.populateFlatTaxonomies();
214
215 // Populate Hierarchical Taxonomy Checkboxes
216 if ( plugin.initialData.hasOwnProperty('h_taxonomies') ){
217 var taxonomies = plugin.initialData.h_taxonomies;
218 for ( i = 0; i < taxonomies.length; i++ ){
219 var tax = '#' + taxonomies[i];
220 $(plugin.form).find(tax).attr('checked', 'checked');
221 }
222 }
223
224 var datepickers = $(plugin.form).find('.np_datepicker');
225 $.each(datepickers, function(){
226 var $this = $(this);
227 $this.datepicker({
228 dateFormat: $this.attr('data-datepicker-format'),
229 beforeShow: function(input, inst) {
230 $('#ui-datepicker-div').addClass('nestedpages-datepicker');
231 }
232 });
233 });
234
235 plugin.formatter.showQuickEdit();
236 $(plugin.form).show();
237 }
238
239
240 // Populate the flat taxonomies
241 plugin.populateFlatTaxonomies = function()
242 {
243 if ( !plugin.initialData.hasOwnProperty('f_taxonomies') ) return;
244 plugin.createTaxonomyObject();
245 plugin.getTermNames();
246 plugin.setWPSuggest();
247 }
248
249
250 // Create an object of taxonomies from class names
251 plugin.createTaxonomyObject = function()
252 {
253 var out = "";
254 var terms = {};
255 for ( i = 0; i < plugin.initialData.f_taxonomies.length; i++ ){
256
257 // Get the term
258 var singleTerm = plugin.initialData.f_taxonomies[i];
259
260 var tax_array = singleTerm.split('-'); // split the string into an array
261 var splitter = tax_array.indexOf('nps'); // find the index of the name splitter
262 var term = tax_array.splice(splitter + 1); // Splice off the name
263 term = term.join('-'); // Join the name back into a string
264
265
266 // Get the taxonomy
267 var tax = singleTerm.split('-').splice(0, splitter);
268 tax.shift('inf');
269 var taxonomy = tax.join('-');
270
271 // Add taxonomy array to object
272 if ( !(taxonomy in terms) ){
273 terms[taxonomy] = [];
274 }
275 // push term to taxonomy array
276 var term_array = terms[taxonomy];
277 term_array.push(term);
278 }
279 plugin.flatTerms = terms;
280 }
281
282
283 // Get the taxonomy names from the ids
284 plugin.getTermNames = function()
285 {
286 $.ajax({
287 url: NestedPages.jsData.ajaxurl,
288 type: 'post',
289 datatype: 'json',
290 data : {
291 action : NestedPages.formActions.getTaxonomies,
292 nonce : NestedPages.jsData.nonce,
293 terms : plugin.flatTerms
294 },
295 success: function(data){
296 plugin.termNames = data.terms;
297 plugin.populateFlatTaxonomyFields();
298 }
299 });
300 }
301
302
303 // Populate the flat taxonomy fields in the form
304 plugin.populateFlatTaxonomyFields = function()
305 {
306 if ( !plugin.termNames ) return;
307 $.each(plugin.termNames, function(i, v){
308 var textarea = $('#' + i + '-quickedit');
309 $(textarea).val(v.join(','));
310 });
311 }
312
313
314 // Initialize WP Auto Suggest on Flat Taxonomy fields
315 plugin.setWPSuggest = function()
316 {
317 var tagfields = $(plugin.form).find('[data-autotag]');
318 $.each(tagfields, function(i, v){
319 var taxonomy = $(this).attr('data-taxonomy');
320 $(this).suggest(ajaxurl + '?action=ajax-tag-search&tax=' + taxonomy , {multiple:true, multipleSep: ","});
321 });
322 }
323
324
325 // Save the quick edit
326 plugin.save = function()
327 {
328 plugin.toggleLoading(true);
329
330 $.ajax({
331 url: NestedPages.jsData.ajaxurl,
332 type: 'post',
333 datatype: 'json',
334 data: $(plugin.form).find('form').serialize() + '&action=' + NestedPages.formActions.quickEditPost + '&nonce=' + NestedPages.jsData.nonce + '&syncmenu=' + NestedPages.jsData.syncmenu + '&post_type=' + NestedPages.jsData.posttype,
335 success: function(data){
336 if (data.status === 'error'){
337 plugin.toggleLoading(false);
338 $(plugin.form).find(NestedPages.selectors.quickEditErrorDiv).text(data.message).show();
339 } else {
340 plugin.toggleLoading(false);
341 plugin.newData = data.post_data;
342 plugin.updatePostRow();
343 }
344 },
345 error: function(data){
346 console.log(data);
347 }
348 });
349 }
350
351
352 // Update the Row after saving quick edit data
353 plugin.updatePostRow = function()
354 {
355 plugin.row = $(plugin.button).parents('.row-inner');
356
357 $(plugin.row).find('.title').text(plugin.newData.post_title);
358 $(plugin.row).find('.np-view-button').attr('href', plugin.newData.permalink);
359
360 var status = $(plugin.row).find('.status');
361 if ( (plugin.newData._status !== 'publish') && (plugin.newData._status !== 'future') ){
362 var newStatus = nestedpages.post_statuses[plugin.newData._status].label;
363 $(status).text('(' + newStatus + ')');
364 } else {
365 $(status).text('');
366 }
367 if ( plugin.newData.keep_private === 'private' ){
368 $(status).text(nestedpages.private);
369 }
370
371 // Password Lock Icon
372 if ( plugin.newData.post_password !== "" && typeof plugin.newData.post_password !== 'undefined'){
373 var statustext = $(status).text();
374 statustext += ' <span class="locked">';
375 statustext += '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>'
376 statustext += '</span>';
377 $(status).html(statustext);
378 }
379
380 // Hide / Show in Nav
381 var nav_status = $(plugin.row).find('.nav-status');
382 if ( (plugin.newData.nav_status == 'hide') ){
383 $(nav_status).text('(Hidden)');
384 } else {
385 $(nav_status).text('');
386 }
387
388 // Hide / Show in Nested Pages
389 var li = $(plugin.row).parent('li');
390 if ( (plugin.newData.np_status == 'hide') ){
391 $(li).addClass('np-hide');
392 $(plugin.row).find('.status').after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>');
393 } else {
394 $(li).removeClass('np-hide');
395 $(plugin.row).find('.status-np-hidden').remove();
396 }
397
398 // Sticky
399 var sticky = $(plugin.row).find('.sticky');
400 if ( (plugin.newData.sticky == 'sticky') ){
401 $(sticky).show();
402 } else {
403 $(sticky).hide();
404 }
405
406 // Author for Non-Hierarchical Types
407 if ( !NestedPages.jsData.hierarchical ){
408 $(plugin.row).find('.np-author-display').text(plugin.newData.author_name);
409 }
410
411 var button = $(plugin.row).find(NestedPages.selectors.quickEditOpen);
412
413 $(button).attr('data-id', plugin.newData.post_id);
414 $(button).attr('data-template', plugin.newData.page_template);
415 $(button).attr('data-title', plugin.newData.post_title);
416 $(button).attr('data-slug', plugin.newData.post_name);
417 $(button).attr('data-commentstatus', plugin.newData.comment_status);
418 $(button).attr('data-status', plugin.newData._status);
419 $(button).attr('data-sticky', plugin.newData.sticky);
420
421 // Private Status
422 if ( plugin.newData.keep_private === 'private' ) {
423 $(button).attr('data-status', 'private');
424 }
425
426 $(button).attr('data-author', plugin.newData.post_author);
427 $(button).attr('data-np-status', plugin.newData.np_status);
428 $(button).attr('data-password', plugin.newData.post_password);
429
430 $(button).attr('data-navstatus', plugin.newData.nav_status);
431 $(button).attr('data-navtitle', plugin.newData.np_nav_title);
432 $(button).attr('data-linktarget', plugin.newData.link_target);
433 $(button).attr('data-navtitleattr', plugin.newData.np_title_attribute);
434 $(button).attr('data-navcss', plugin.newData.np_nav_css_classes);
435
436 $(button).attr('data-month', plugin.newData.mm);
437 $(button).attr('data-day', plugin.newData.jj);
438 $(button).attr('data-year', plugin.newData.aa);
439 $(button).attr('data-hour', plugin.newData.hh);
440 $(button).attr('data-minute', plugin.newData.mn);
441 $(button).attr('data-datepicker', plugin.newData.np_date);
442 $(button).attr('data-time', plugin.newData.np_time);
443 $(button).attr('data-formattedtime', plugin.newData.np_time);
444 $(button).attr('data-ampm', plugin.newData.np_ampm);
445
446 // Custom Fields
447 for ( var key in plugin.newData ){
448 if ( !key.includes('np_custom') ) continue;
449 if ( plugin.newData.hasOwnProperty(key) ){
450 var attrName = key.replace('np_custom_', 'data-npcustom-');
451 $(button).attr(attrName, plugin.newData[key]);
452 }
453 }
454
455 plugin.removeTaxonomyClasses();
456 plugin.addCategoryClasses();
457 plugin.addHierarchicalClasses();
458 plugin.addFlatClasses();
459 plugin.addStatusClass();
460
461 plugin.formatter.removeQuickEdit();
462 plugin.formatter.flashRow(plugin.row);
463 }
464
465
466 // Add Status Class
467 plugin.addStatusClass = function()
468 {
469 var statuses = ['published', 'draft', 'pending', 'future'];
470 for ( i = 0; i < statuses.length; i++ ){
471 $(plugin.row).removeClass(statuses[i]);
472 }
473 $(plugin.row).addClass(plugin.newData._status);
474 }
475
476
477 // Remove Taxonomy Classes from the updated row
478 plugin.removeTaxonomyClasses = function()
479 {
480 taxonomies = [];
481 var classes = $(plugin.row).attr('class').split(/\s+/);
482 for ( i = 0; i < classes.length; i++ ){
483 if ( classes[i].substring(0, 3) === 'in-'){ // hierarchical
484 $(plugin.row).removeClass(classes[i]);
485 }
486 if ( classes[i].substring(0, 4) === 'inf-'){ // flat
487 $(plugin.row).removeClass(classes[i]);
488 }
489 }
490 }
491
492
493 // Add Category Classes to the Row
494 plugin.addCategoryClasses = function()
495 {
496 if ( !plugin.newData.hasOwnProperty('post_category') ) return;
497 var cats = plugin.newData.post_category;
498 for ( i = 0; i < cats.length; i++ ){
499 var taxclass = 'in-category-' + cats[i];
500 $(plugin.row).addClass(taxclass);
501 }
502 }
503
504
505 // Add hierarchical taxonomy classes to the row
506 plugin.addHierarchicalClasses = function()
507 {
508 if ( !plugin.newData.hasOwnProperty('tax_input') ) return;
509 var taxonomies = plugin.newData.tax_input;
510 $.each(taxonomies, function(tax, terms){
511 for (i = 0; i < terms.length; i++){
512 var taxclass = 'in-' + tax + '-' + terms[i];
513 $(plugin.row).addClass(taxclass);
514 }
515 });
516 }
517
518
519 // Add flat taxonomy classes to the row
520 plugin.addFlatClasses = function()
521 {
522 if ( !plugin.newData.hasOwnProperty('flat_tax') ) return;
523 var taxonomies = plugin.newData.flat_tax;
524 $.each(taxonomies, function(tax, terms){
525 for (i = 0; i < terms.length; i++){
526 var taxclass = 'inf-' + tax + '-nps-' + terms[i];
527 $(plugin.row).addClass(taxclass);
528 }
529 });
530 }
531
532
533 // Toggle Form Loading State
534 plugin.toggleLoading = function(loading)
535 {
536 if ( loading ){
537 $(NestedPages.selectors.quickEditErrorDiv).hide();
538 $(plugin.saveButton).attr('disabled', 'disabled');
539 $(NestedPages.selectors.quickEditLoadingIndicator).show();
540 return;
541 }
542 $(plugin.saveButton).attr('disabled', false);
543 $(NestedPages.selectors.quickEditLoadingIndicator).hide();
544 }
545
546 return plugin.bindEvents();
547
548 }