WP PLUGIN ソート対象拡張
・サイドメニュー位置修正 ・カスタムフィールド入力用テキストボックス位置等修正 ・ソート対象チェックボックスのチェック状態によって昇降順ラジオボタンの活性/非活性化するよう修正
This commit is contained in:
+50
-69
@@ -7,8 +7,6 @@ jQuery(function ($) {
|
||||
order_list();
|
||||
|
||||
//order type
|
||||
// change_search_order();
|
||||
// change_normal_order();
|
||||
change_sort_box();
|
||||
|
||||
//Tax select
|
||||
@@ -18,6 +16,8 @@ jQuery(function ($) {
|
||||
change_search_per_page();
|
||||
change_tax_per_page();
|
||||
|
||||
change_custom_field_sort();
|
||||
change_normal_field_sort();
|
||||
|
||||
function change_tab_menu() {
|
||||
let submit_type = $('.post-order-box-outer').data('submit_type');
|
||||
@@ -60,80 +60,23 @@ jQuery(function ($) {
|
||||
}
|
||||
}
|
||||
|
||||
function change_normal_order() {
|
||||
let s_radio = $('.apop_normal_order');
|
||||
let s_box = $('.normal_sort_box');
|
||||
let default_index = $('.apop_normal_order_target').data('normal_order_target') - 1;
|
||||
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$('.normal_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||
|
||||
s_radio.on('click', function () {
|
||||
let target_index = $(this).val() - 1;
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$('.normal_sort_box:eq(' + target_index + ')').show().find('input').prop('disabled', false);
|
||||
})
|
||||
}
|
||||
|
||||
function change_search_order() {
|
||||
let s_radio = $('.apop_search_order');
|
||||
let s_box = $('.search_sort_box');
|
||||
let default_index = $('.apop_search_order_target').data('search_order_target') - 1;
|
||||
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
|
||||
$('.search_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||
|
||||
s_radio.on('click', function () {
|
||||
let target_index = $(this).val() - 1;
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$('.search_sort_box:eq(' + target_index + ')').show().find('input').prop('disabled', false);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function change_sort_box() {
|
||||
let parent_selector = $('.list-orders-inner');
|
||||
let parent_selector_size = parent_selector.length;
|
||||
let s_radio = $('.sort_menu');
|
||||
let s_box = $('.sort_box');
|
||||
let sort_menu_size = $('.sort_menu_list').length;
|
||||
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
|
||||
for (let i = 0; i < parent_selector_size; i++) {
|
||||
let my_target = $('.list-orders-inner:eq(' + i + ')');
|
||||
let default_index = my_target.find('.sort_menu_list').data('order_target') - 1;
|
||||
if (typeof default_index !== "undefined") {
|
||||
my_target.find('.sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||
} else if (isNaN(default_index)) {
|
||||
my_target.find('.sort_box:eq(0)').show().find('input').prop('disabled', false);
|
||||
}
|
||||
$('.sort_box').hide();
|
||||
for (let i = 0; i < sort_menu_size; i++) {
|
||||
let type_index = $('.sort_menu_list:eq(' + i + ')').data('order_target') - 1;
|
||||
$('.sort_menu_list:eq(' + i + ')').siblings('.sort_box:eq(' + type_index + ')').show();
|
||||
}
|
||||
|
||||
s_radio.on('click', function () {
|
||||
let target_index = $(this).val() - 1;
|
||||
$(this).parents('.list-orders-inner')
|
||||
.find('.sort_box').hide()
|
||||
.find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$(this).parents('.list-orders-inner')
|
||||
.find('.sort_box:eq(' + target_index + ')').show()
|
||||
.find('input').prop('disabled', false);
|
||||
$(this).parents('.list-orders-inner').find('.sort_box').hide();
|
||||
$(this).parents('.list-orders-inner').find('.sort_box:eq(' + target_index + ')').show();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function select_tax() {
|
||||
let select_cat_checkbox = $('.select_cat_checkbox');
|
||||
let input_chk_size = select_cat_checkbox.length;
|
||||
@@ -182,9 +125,7 @@ jQuery(function ($) {
|
||||
function change_tax_per_page() {
|
||||
let set_number = $('.set_number');
|
||||
let input_chk_size = set_number.length;
|
||||
|
||||
let i = 0;
|
||||
for (i; i < input_chk_size; i++) {
|
||||
for (let i = 0; i < input_chk_size; i++) {
|
||||
let input_num_box = $('.set_number:eq(' + i + ')').siblings('.per_page_cat_input');
|
||||
if (input_num_box.val() == '') {
|
||||
input_num_box.prop('disabled', true);
|
||||
@@ -202,4 +143,44 @@ jQuery(function ($) {
|
||||
});
|
||||
}
|
||||
|
||||
function change_custom_field_sort() {
|
||||
let s_box = $('.sort_box');
|
||||
let custom_field_check = $('.custom_field_check');
|
||||
|
||||
s_box.find(custom_field_check).each(function () {
|
||||
if ($(this).prop('checked') == false) {
|
||||
$(this).parents('.product-list-sort-type').find('.custom_field_key').prop('disabled', true);
|
||||
$(this).parents('.product-list-sort-type').find('.custom_field_meta_value').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
custom_field_check.on('click', function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$(this).parents('.product-list-sort-type').find('.custom_field_key').prop('disabled', false);
|
||||
$(this).parents('.product-list-sort-type').find('.custom_field_meta_value').prop('disabled', false);
|
||||
} else {
|
||||
$(this).parents('.product-list-sort-type').find('.custom_field_key').val('').prop('disabled', true);
|
||||
$(this).parents('.product-list-sort-type').find('.custom_field_meta_value').prop('disabled', true);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function change_normal_field_sort() {
|
||||
let s_box = $('.sort_box');
|
||||
let targets = '.custom_field_check, .sort_date_check, .sort_title_check, .sort_ID_check, .sort_modified_check';
|
||||
|
||||
s_box.find(targets).each(function () {
|
||||
if ($(this).prop('checked') == false) {
|
||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
$(targets).on('click', function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', false)
|
||||
} else {
|
||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user