cleditor
1 week ago
codemirror
1 week ago
marionette
1 week ago
pods-dfv
1 week ago
qtip
1 week ago
selectWoo
1 week ago
sprintf
1 week ago
timepicker
1 week ago
admin-importer.js
1 week ago
advanced.js
1 week ago
codemirror.js
1 week ago
floatmenu.js
1 week ago
handlebars.js
1 week ago
jquery.pods.attach.js
1 week ago
jquery.pods.js
1 week ago
jquery.pods.migrate.js
1 week ago
jquery.pods.upgrade.js
1 week ago
pods-i18n.js
1 week ago
pods-link-picker.js
1 week ago
qtip.js
1 week ago
admin-importer.js
122 lines
| 1 | jQuery(document).ready(function () { |
| 2 | |
| 3 | jQuery('#filter-right-tables, #filter-left-tables').on( 'focus', function() { |
| 4 | if (jQuery(this).val() === 'Filter Tables') { |
| 5 | jQuery(this).val(''); |
| 6 | } |
| 7 | } ); |
| 8 | |
| 9 | jQuery('#filter-right-tables, #filter-left-tables').on( 'blur', function() { |
| 10 | if (jQuery(this).val() === '') { |
| 11 | jQuery(this).val('Filter Tables'); |
| 12 | } |
| 13 | } ); |
| 14 | |
| 15 | jQuery('#filter-right-tables').on( 'keyup', function() { |
| 16 | var query = jQuery(this).val(); |
| 17 | |
| 18 | if (query === '') { |
| 19 | jQuery('ul.list-tables-right li.right-table').removeClass('invisible'); |
| 20 | } else { |
| 21 | jQuery("ul.list-tables-right li.right-table").addClass('invisible'); |
| 22 | jQuery('ul.list-tables-right li.right-table:contains("'+query+'")').each(function() { |
| 23 | jQuery(this).removeClass('invisible'); |
| 24 | }); |
| 25 | } |
| 26 | }); |
| 27 | |
| 28 | jQuery('#filter-left-tables').on( 'keyup', function() { |
| 29 | var query = jQuery(this).val(); |
| 30 | |
| 31 | if (query === '') { |
| 32 | jQuery('ul.list-tables-left li.left-table').removeClass('invisible'); |
| 33 | } else { |
| 34 | jQuery("ul.list-tables-left li.left-table").addClass('invisible'); |
| 35 | jQuery('ul.list-tables-left li.left-table:contains("'+query+'")').each(function() { |
| 36 | jQuery(this).removeClass('invisible'); |
| 37 | }); |
| 38 | } |
| 39 | }); |
| 40 | |
| 41 | jQuery.fn.animateHighlight = function(highlightColor, duration) { |
| 42 | var highlightBg = highlightColor || "#FFFF9C"; |
| 43 | var animateMs = duration || 1500; |
| 44 | if ( window.console ) console.log(this); |
| 45 | var originalBg = '#F5F5F5'; |
| 46 | |
| 47 | this.stop().css("background-color", highlightBg).css("padding", "4px").css("border-radius", "6px").animate({backgroundColor: originalBg}, animateMs); |
| 48 | }; |
| 49 | |
| 50 | /** |
| 51 | * Once a table is selected, it updates the manage div to show the table name, |
| 52 | * and disables all other checkboxes since only one table can be selected |
| 53 | * per import. |
| 54 | */ |
| 55 | jQuery('input[type="checkbox"].pods-importable-table').on( 'click', function () { |
| 56 | var checkedTable = jQuery(this).attr('name'); |
| 57 | var checkedValue = jQuery(this).val(); |
| 58 | var checked = jQuery(this).is(':checked'); |
| 59 | |
| 60 | if (checked) { |
| 61 | jQuery('#import-table-progress span').html('<strong>Selected: </strong>' + checkedValue); |
| 62 | jQuery('#import-table-progress span').animateHighlight(); |
| 63 | |
| 64 | jQuery('#continue-to-field-selection').attr('disabled', false); |
| 65 | } else { |
| 66 | jQuery('#import-table-progress span').html('Select a Table.'); |
| 67 | jQuery('#continue-to-field-selection').attr('disabled', 'disabled'); |
| 68 | } |
| 69 | |
| 70 | jQuery('input[type="checkbox"].pods-importable-table').each(function () { |
| 71 | if (jQuery(this).attr('name') !== checkedTable) { |
| 72 | jQuery(this).attr('disabled', (checked) ? true : false); |
| 73 | } |
| 74 | }); |
| 75 | }); |
| 76 | |
| 77 | // Step 1 submit |
| 78 | jQuery('button#continue-to-field-selection').on( 'click', function () { |
| 79 | jQuery('form#pods-import-table-selection').submit(); |
| 80 | }); |
| 81 | |
| 82 | /** |
| 83 | * On click of either the red x, or green check. Dims the opacity of the |
| 84 | * closest parent tr, and finds all input/select elements within it and disables |
| 85 | * or enables them. |
| 86 | */ |
| 87 | jQuery('.enabled-status.status-switcher').on( 'click', function () { |
| 88 | var enabled = jQuery(this).hasClass('enabled'); |
| 89 | |
| 90 | if (enabled) { |
| 91 | jQuery(this).removeClass('enabled').addClass('disabled'); |
| 92 | jQuery(this).closest('tr.pod-column-row').removeClass('enabled').addClass('disabled'); |
| 93 | |
| 94 | jQuery(this).parent('tr.pod-column-row').find('input, select').each(function () { |
| 95 | jQuery(this).attr('disabled', true); |
| 96 | }); |
| 97 | } else { |
| 98 | jQuery(this).removeClass('disabled').addClass('enabled'); |
| 99 | jQuery(this).closest('tr.pod-column-row').removeClass('disabled').addClass('enabled'); |
| 100 | |
| 101 | jQuery(this).parent('tr.pod-column-row').find('input, select').each(function () { |
| 102 | jQuery(this).attr('disabled', false); |
| 103 | }); |
| 104 | } |
| 105 | }); |
| 106 | |
| 107 | /** |
| 108 | * Ensures at least one column is enabled for converting to a pod, |
| 109 | * and that at a minimum the pod name is entered. |
| 110 | */ |
| 111 | jQuery('a#pods-import-create-pod').on( 'click', function () { |
| 112 | if (jQuery('tr.pod-column-row.enabled').length === 0) { |
| 113 | alert('At least one column must be selected to convert.'); |
| 114 | } else if (jQuery('input[name="new_pod_data[pod_name]"]').val() == '') { |
| 115 | alert('The Pod Name field is required.'); |
| 116 | } else { |
| 117 | jQuery('form#pods-import-create-pod').submit(); |
| 118 | } |
| 119 | }); |
| 120 | |
| 121 | }); |
| 122 |