From ff6d949f7cf948a5d88fde184def982ab22874f9 Mon Sep 17 00:00:00 2001 From: Georgios Tsakalos Date: Thu, 3 Mar 2016 18:20:53 +0200 Subject: [PATCH] add remove software function in js --- module/schools/public/js/schools/software.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/module/schools/public/js/schools/software.js b/module/schools/public/js/schools/software.js index 725e94f..4c092d7 100644 --- a/module/schools/public/js/schools/software.js +++ b/module/schools/public/js/schools/software.js @@ -112,7 +112,6 @@ _.each(this.form[0].elements, function (element) { var element = $(element), name = element.attr('name'); - //if ('checkbox') element.val(softwareAttributes[name] || ''); }); this.show(); @@ -143,8 +142,22 @@ } }); }, + removeSoftware: function () { + var that = this; + $.ajax({ + url: that.url, + type: 'delete', + data: { + 'id': that.software.get('id') + } + }).done(function () { + that.model.remove(that.sowftare.get('id')); + that.hide(); + }).fail(function(xhr, err){ + }); + } }); - + new SoftwareCollectionView({model: new SoftwareCollection() }); }(window.EDULABS.utils)); -- GitLab