From 0f227125f2c6d996d1528048d00f3e9a23e08df0 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 2 Feb 2017 17:39:17 +0530 Subject: added some minor changes --- js/textbook_companion_fixer_edit_category.js | 14 +++++++++++--- textbook_companion_fixer_edit_book_category.inc | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/js/textbook_companion_fixer_edit_category.js b/js/textbook_companion_fixer_edit_category.js index 2821382..f10973b 100644 --- a/js/textbook_companion_fixer_edit_category.js +++ b/js/textbook_companion_fixer_edit_category.js @@ -74,20 +74,28 @@ $("input[name='ids[]']:checked").each(function (){ main_cat_chk_value.push(parseInt($(this).val())); }); - console.log(modPath); + var sub_cat_select_value = $.map($('select[name="subcats"] :selected'), function (val, _) { + var newObj = {}; + if(val.value > '0'){ + newObj.subcats = val.value; + } + return newObj; + }); + var pref_id = $('.prefrence_id').val(); + console.log(pref_id); $.ajax({ url: modPath, type: "POST", data: { pref_id: pref_id, main_category: main_cat_chk_value, - subcategory: "" + sub_category: sub_cat_select_value }, dataType: "html", success: function(data) { $updating.hide(); $done.show(); - console.log("data: +" + main_cat_chk_value); + console.log("data1: " + main_cat_chk_value + " data2: "+ sub_cat_select_value); $done.fadeOut("slow"); //alert("ok"); } diff --git a/textbook_companion_fixer_edit_book_category.inc b/textbook_companion_fixer_edit_book_category.inc index 56429cc..d7b640b 100644 --- a/textbook_companion_fixer_edit_book_category.inc +++ b/textbook_companion_fixer_edit_book_category.inc @@ -98,6 +98,9 @@ function textbook_companion_fixer_category_edit_form($form, &$form_state) '#type' => 'item', '#title' => t('Year of pulication'), '#markup' => $preference_data->year + ); + $form["wrapper"]['pref_id'] = array( + '#markup' => '' ); $form["wrapper"]['main_category']= array( "#markup" => _textbook_companion_fixer_list_of_category_checkboxes(), -- cgit