Skip to content

Commit

Permalink
[WebUI IntelliHome#7] Fixing functions to add and delete elements
Browse files Browse the repository at this point in the history
  • Loading branch information
skullbocks committed Aug 20, 2014
1 parent 0b6fb97 commit 637db85
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions assets/public/js/functions_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
window.location.href = $(this).attr("data-post");
});
$body.on('click', '.delete-row', function() {
$.post("/admin/delete_" + $(this).attr("data-type") + "/" + $(this).parent().parent().attr("id"), function(data) {
if (data == 1) {
$(this).parent().parent().hide("fast").remove();
var $thisButton = $(this);
console.log($thisButton.parent().parent());
$.post("/admin/delete_" + $thisButton.attr("data-type") + "/" + $thisButton.parent().parent().attr("id"), function(data) {
if (data.result == 1) {
$thisButton.parent().parent().hide("fast").remove();
if ($thisButton.hasClass('.popover-remove-row')){
$(".popover-gpio-"+$thisButton.attr("data-type")).find('tr#'+$thisButton.parent().parent().attr("id")).remove();
}
}
});
}, 'json');
});
$gpioPopover.popover({
html: true,
Expand Down

0 comments on commit 637db85

Please sign in to comment.