Commit 60556271 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Send form_data using getContent in gadget

parent 75d281d3
...@@ -135,8 +135,7 @@ ...@@ -135,8 +135,7 @@
if (evt.target.nextSibling.className === 'Unchanged') { if (evt.target.nextSibling.className === 'Unchanged') {
var nodeChildPath = evt.target.nextElementSibling.nextElementSibling.querySelectorAll('input[type=checkbox][name="child_path"]'), var nodeChildPath = evt.target.nextElementSibling.nextElementSibling.querySelectorAll('input[type=checkbox][name="child_path"]'),
nodeParentPath = evt.target.nextElementSibling.nextElementSibling.querySelectorAll('input[type=checkbox][name="parent_path"]'), nodeParentPath = evt.target.nextElementSibling.nextElementSibling.querySelectorAll('input[type=checkbox][name="parent_path"]'),
i, i;
element;
// If there is no nodeParentPath and some childParentPath, update // If there is no nodeParentPath and some childParentPath, update
// the checked status of the childParentPath // the checked status of the childParentPath
if ((!nodeParentPath.length) && (nodeChildPath.length)) { if ((!nodeParentPath.length) && (nodeChildPath.length)) {
...@@ -150,28 +149,27 @@ ...@@ -150,28 +149,27 @@
} }
}, false, false) }, false, false)
.declareMethod('getContent', function (options) { .declareMethod('getContent', function () {
var i, var i,
path_list = []; path_list = [];
// Get all the checked checkbox from both child_path and parent_path // Get all the checked checkbox from both child_path and parent_path
var checkedInputList = this.element.querySelectorAll( var checkedInputList = this.element.querySelectorAll(
'input[type=checkbox][name$="_path"]:checked'); 'input[type=checkbox][name$="_path"]:checked'
),
nextLabelElement;
// Filter all paths except for those 'Unchanged' // Filter all paths except for those 'Unchanged'
for (i = 0; i < checkedInputList.length; ++i) { for (i = 0; i < checkedInputList.length; ++i) {
var nextLabelElement = checkedInputList[i].nextElementSibling; nextLabelElement = checkedInputList[i].nextElementSibling;
if (nextLabelElement.className !== "Unchanged") { if (nextLabelElement.className !== "Unchanged") {
path_list.push(nextLabelElement.dataset.path) path_list.push(nextLabelElement.dataset.path);
} }
} }
var form_data = {'check_needed': 'True',
'item_path_list': path_list} ;
jIO.util.ajax({ return form_data
type: 'POST',
url: this.action_url,
data: {'checkNeeded': 'True',
'item_path_list': path_list}
});
}); });
}(rJS, jIO, Handlebars, RSVP, window)); }(rJS, jIO, Handlebars, RSVP, window));
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment