| @@ -214,14 +214,17 @@ | ||
| 214 | 214 | |
| 215 | 215 | // Initial State |
| 216 | 216 | WPUltimatePostGrid.changedType(); |
| 217 | 217 | WPUltimatePostGrid.changedPostType(); |
| 218 | + WPUltimatePostGrid.changedTaxonomy(); | |
| 218 | 219 | WPUltimatePostGrid.changedOrderBy(); |
| 219 | 220 | WPUltimatePostGrid.changedLimitPosts(); |
| 221 | + WPUltimatePostGrid.changedLimitTerms(); | |
| 220 | 222 | WPUltimatePostGrid.initRules(); |
| 221 | 223 | WPUltimatePostGrid.changedFilterType(); |
| 224 | + WPUltimatePostGrid.changedShowCount(); | |
| 222 | 225 | WPUltimatePostGrid.changedMultiselect(); |
| 223 | - WPUltimatePostGrid.changedLimitTerms(); | |
| 226 | + WPUltimatePostGrid.changedLimitFilterTerms(); | |
| 224 | 227 | WPUltimatePostGrid.changedDropdownLabels(); |
| 225 | 228 | WPUltimatePostGrid.changedIsotopeFilterStyle(); |
| 226 | 229 | WPUltimatePostGrid.changedIsotopeFilterText(); |
| 227 | 230 | WPUltimatePostGrid.changedLayoutMode(); |
| @@ -231,10 +234,12 @@ | ||
| 231 | 234 | |
| 232 | 235 | // Events |
| 233 | 236 | jQuery('#wpupg_type').on('change', function() { WPUltimatePostGrid.changedType(); }); |
| 234 | 237 | jQuery('#wpupg_post_types').on('change', function() { WPUltimatePostGrid.changedPostType(); }); |
| 238 | + jQuery('#wpupg_taxonomies').on('change', function() { WPUltimatePostGrid.changedTaxonomy(); }); | |
| 235 | 239 | jQuery('#wpupg_order_by').on('change', function() { WPUltimatePostGrid.changedOrderBy(); }); |
| 236 | 240 | jQuery('#wpupg_limit_posts').on('change', function() { WPUltimatePostGrid.changedLimitPosts(); }); |
| 241 | + jQuery('#wpupg_limit_terms').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); }); | |
| 237 | 242 | jQuery('#wpupg_add_rule').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.addRule(); }); |
| 238 | 243 | jQuery('.wpupg_rule_delete').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.removeRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| 239 | 244 | jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); }); |
| 240 | 245 | jQuery('.rule_container_wpupg_general_date').find('select').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| @@ -239,11 +244,12 @@ | ||
| 239 | 244 | jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); }); |
| 240 | 245 | jQuery('.rule_container_wpupg_general_date').find('select').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| 241 | 246 | jQuery('.wpupg-date').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| 242 | 247 | jQuery('#wpupg_filter_type').on('change', function() { WPUltimatePostGrid.changedFilterType(); }); |
| 248 | + jQuery('#wpupg_filter_count').on('change', function() { WPUltimatePostGrid.changedShowCount(); }); | |
| 243 | 249 | jQuery('#wpupg_filter_multiselect').on('change', function() { WPUltimatePostGrid.changedMultiselect(); }); |
| 244 | - jQuery('.wpupg_filter_taxonomy').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); WPUltimatePostGrid.changedDropdownLabels(); }); | |
| 245 | - jQuery('#wpupg_filter_limit').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); }); | |
| 250 | + jQuery('.wpupg_filter_taxonomy').on('change', function() { WPUltimatePostGrid.changedLimitFilterTerms(); WPUltimatePostGrid.changedDropdownLabels(); }); | |
| 251 | + jQuery('#wpupg_filter_limit').on('change', function() { WPUltimatePostGrid.changedLimitFilterTerms(); }); | |
| 246 | 252 | jQuery('#wpupg_layout_mode').on('change', function() { WPUltimatePostGrid.changedLayoutMode(); }); |
| 247 | 253 | jQuery('#wpupg_pagination_type').on('change', function() { WPUltimatePostGrid.changedPaginationType(); }); |
| 248 | 254 | jQuery('#wpupg_pagination_load_more_button_text').on('change keyup', function() { WPUltimatePostGrid.changedPaginationText(); }); |
| 249 | 255 | |
| @@ -322,18 +328,22 @@ | ||
| 322 | 328 | WPUltimatePostGrid.checkPremiumFeatures('type', true); |
| 323 | 329 | jQuery('#wpupg_meta_box_data_source_terms').show(); |
| 324 | 330 | |
| 325 | 331 | jQuery('#wpupg_meta_box_data_source').hide(); |
| 332 | + jQuery('#wpupg_meta_box_limit_terms').show(); | |
| 326 | 333 | jQuery('#wpupg_meta_box_limit_posts').hide(); |
| 327 | 334 | jQuery('#wpupg_meta_box_filter').hide(); |
| 328 | 335 | jQuery('#wpupg_meta_box_isotope_filter').hide(); |
| 329 | 336 | jQuery('#wpupg_meta_box_pagination').hide(); |
| 330 | 337 | jQuery('#wpupg_meta_box_pagination_style').hide(); |
| 338 | + | |
| 339 | + WPUltimatePostGrid.changedLimitTerms(); | |
| 331 | 340 | } else { |
| 332 | 341 | WPUltimatePostGrid.checkPremiumFeatures('type', false); |
| 333 | 342 | jQuery('#wpupg_meta_box_data_source_terms').hide(); |
| 334 | 343 | |
| 335 | 344 | jQuery('#wpupg_meta_box_data_source').show(); |
| 345 | + jQuery('#wpupg_meta_box_limit_terms').hide(); | |
| 336 | 346 | jQuery('#wpupg_meta_box_limit_posts').show(); |
| 337 | 347 | jQuery('#wpupg_meta_box_filter').show(); |
| 338 | 348 | jQuery('#wpupg_meta_box_isotope_filter').show(); |
| 339 | 349 | jQuery('#wpupg_meta_box_pagination').show(); |
| @@ -344,8 +354,15 @@ | ||
| 344 | 354 | WPUltimatePostGrid.changedPaginationType(); |
| 345 | 355 | } |
| 346 | 356 | }; |
| 347 | 357 | |
| 358 | +WPUltimatePostGrid.changedTaxonomy = function() { | |
| 359 | + var taxonomy = jQuery('#wpupg_taxonomies').find(':selected').val(); | |
| 360 | + | |
| 361 | + jQuery('#wpupg_form_limit_terms').find('tr').hide(); | |
| 362 | + jQuery('#wpupg_form_limit_terms').find('tr#wpupg_form_limit_terms_' + taxonomy).show(); | |
| 363 | +}; | |
| 364 | + | |
| 348 | 365 | WPUltimatePostGrid.changedPostType = function() { |
| 349 | 366 | var post_type = jQuery('#wpupg_post_types').find(':selected').val(); |
| 350 | 367 | |
| 351 | 368 | jQuery('.wpupg_filter_taxonomy_container').hide(); |
| @@ -362,9 +379,9 @@ | ||
| 362 | 379 | WPUltimatePostGrid.filter_possible = false; |
| 363 | 380 | } |
| 364 | 381 | |
| 365 | 382 | WPUltimatePostGrid.changedFilterType(); |
| 366 | - WPUltimatePostGrid.changedLimitTerms(); | |
| 383 | + WPUltimatePostGrid.changedLimitFilterTerms(); | |
| 367 | 384 | WPUltimatePostGrid.changedDropdownLabels(); |
| 368 | 385 | }; |
| 369 | 386 | |
| 370 | 387 | WPUltimatePostGrid.changedOrderBy = function() { |
| @@ -378,8 +395,16 @@ | ||
| 378 | 395 | jQuery('.wpupg_order_custom_key_container').hide(); |
| 379 | 396 | } |
| 380 | 397 | }; |
| 381 | 398 | |
| 399 | +WPUltimatePostGrid.changedLimitTerms = function() { | |
| 400 | + if(jQuery('#wpupg_limit_terms').is(':checked')) { | |
| 401 | + jQuery('#wpupg_meta_box_limit_terms').show(); | |
| 402 | + } else { | |
| 403 | + jQuery('#wpupg_meta_box_limit_terms').hide(); | |
| 404 | + } | |
| 405 | +}; | |
| 406 | + | |
| 382 | 407 | WPUltimatePostGrid.changedLimitPosts = function() { |
| 383 | 408 | if(jQuery('#wpupg_limit_posts').is(':checked')) { |
| 384 | 409 | WPUltimatePostGrid.checkPremiumFeatures('limit_posts', true); |
| 385 | 410 | jQuery('#wpupg_meta_box_limit_posts').show(); |
| @@ -465,11 +490,17 @@ | ||
| 465 | 490 | }; |
| 466 | 491 | |
| 467 | 492 | WPUltimatePostGrid.changedFilterType = function() { |
| 468 | 493 | var filter_type = jQuery('#wpupg_filter_type').find(':selected').val(); |
| 494 | + var filter_type_search = false; | |
| 469 | 495 | |
| 496 | + if(filter_type.substring(0,5) == 'text_') { | |
| 497 | + filter_type = filter_type.substring(5); | |
| 498 | + filter_type_search = true; | |
| 499 | + } | |
| 500 | + | |
| 470 | 501 | // Hide & Show Filter Settings |
| 471 | - if(filter_type == 'none') { | |
| 502 | + if(filter_type == 'none' || filter_type == 'text') { | |
| 472 | 503 | jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').hide(); |
| 473 | 504 | } else { |
| 474 | 505 | jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').show(); |
| 475 | 506 | } |
| @@ -474,9 +505,9 @@ | ||
| 474 | 505 | jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').show(); |
| 475 | 506 | } |
| 476 | 507 | |
| 477 | 508 | // Premium only filters |
| 478 | - if(filter_type == 'dropdown') { | |
| 509 | + if(filter_type == 'dropdown' || filter_type == 'text') { | |
| 479 | 510 | WPUltimatePostGrid.checkPremiumFeatures('filter_type', true); |
| 480 | 511 | } else { |
| 481 | 512 | WPUltimatePostGrid.checkPremiumFeatures('filter_type', false); |
| 482 | 513 | } |
| @@ -482,18 +513,33 @@ | ||
| 482 | 513 | } |
| 483 | 514 | |
| 484 | 515 | // Hide & Show Filter Styles |
| 485 | 516 | jQuery('#wpupg_meta_box_isotope_filter').hide(); |
| 517 | + jQuery('#wpupg_meta_box_text_filter').hide(); | |
| 486 | 518 | jQuery('#wpupg_meta_box_dropdown_filter').hide(); |
| 487 | 519 | |
| 488 | 520 | if(WPUltimatePostGrid.filter_possible) { |
| 489 | 521 | jQuery('#wpupg_meta_box_' + filter_type + '_filter').show(); |
| 522 | + | |
| 523 | + if(filter_type_search) { | |
| 524 | + jQuery('#wpupg_meta_box_text_filter').show(); | |
| 525 | + } | |
| 490 | 526 | } |
| 491 | 527 | |
| 492 | - WPUltimatePostGrid.changedLimitTerms(); | |
| 528 | + WPUltimatePostGrid.changedLimitFilterTerms(); | |
| 493 | 529 | WPUltimatePostGrid.changedDropdownLabels(); |
| 494 | 530 | }; |
| 495 | 531 | |
| 532 | +WPUltimatePostGrid.changedShowCount = function() { | |
| 533 | + var show_count = jQuery('#wpupg_filter_count').is(':checked'); | |
| 534 | + | |
| 535 | + if(show_count) { | |
| 536 | + WPUltimatePostGrid.checkPremiumFeatures('show_count', true); | |
| 537 | + } else { | |
| 538 | + WPUltimatePostGrid.checkPremiumFeatures('show_count', false); | |
| 539 | + } | |
| 540 | +}; | |
| 541 | + | |
| 496 | 542 | WPUltimatePostGrid.changedMultiselect = function() { |
| 497 | 543 | var multiselect = jQuery('#wpupg_filter_multiselect').is(':checked'); |
| 498 | 544 | |
| 499 | 545 | if(multiselect) { |
| @@ -504,9 +550,9 @@ | ||
| 504 | 550 | jQuery('.wpupg_multiselect').hide(); |
| 505 | 551 | } |
| 506 | 552 | }; |
| 507 | 553 | |
| 508 | -WPUltimatePostGrid.changedLimitTerms = function() { | |
| 554 | +WPUltimatePostGrid.changedLimitFilterTerms = function() { | |
| 509 | 555 | var limit_terms = jQuery('#wpupg_filter_limit').is(':checked'); |
| 510 | 556 | var post_type = jQuery('#wpupg_post_types').find(':selected').val(); |
| 511 | 557 | var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val(); |
| 512 | 558 | |
| @@ -529,8 +575,12 @@ | ||
| 529 | 575 | WPUltimatePostGrid.changedDropdownLabels = function() { |
| 530 | 576 | var filter_type = jQuery('#wpupg_filter_type').find(':selected').val(); |
| 531 | 577 | var post_type = jQuery('#wpupg_post_types').find(':selected').val(); |
| 532 | 578 | var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val(); |
| 579 | + | |
| 580 | + if(filter_type.substring(0,5) == 'text_') { | |
| 581 | + filter_type = filter_type.substring(5); | |
| 582 | + } | |
| 533 | 583 | |
| 534 | 584 | if( !jQuery.isArray( taxonomies ) ) { |
| 535 | 585 | taxonomies = [taxonomies]; |
| 536 | 586 | } |