diff --git a/static/js/app/campaigns.js b/static/js/app/campaigns.js index cf6cfacb..fcf638a3 100644 --- a/static/js/app/campaigns.js +++ b/static/js/app/campaigns.js @@ -25,6 +25,11 @@ function save(){ }) } +function dismiss(){ + $("#modal\\.flashes").empty() + $("#modal").modal('hide') +} + function groupAdd(name){ groups.append({ name: name diff --git a/static/js/app/partials/modals/userModal.html b/static/js/app/partials/modals/userModal.html index f3ce3747..2d1cfde2 100644 --- a/static/js/app/partials/modals/userModal.html +++ b/static/js/app/partials/modals/userModal.html @@ -42,7 +42,7 @@ diff --git a/static/js/app/users.js b/static/js/app/users.js index 26f32171..97b9ed27 100644 --- a/static/js/app/users.js +++ b/static/js/app/users.js @@ -10,6 +10,7 @@ function save(){ .success(function(data){ successFlash("Campaign successfully launched!") load() + dismiss() }) .error(function(data){ $("#modal\\.flashes").empty().append("
\ @@ -17,12 +18,47 @@ function save(){ }) } +function dismiss(){ + $("#modal\\.flashes").empty() + $("#modal").modal('hide') +} + function groupAdd(name){ groups.append({ name: name }) } +function edit(group){ + if (group == "new") { + console.log("new") + group = {} + } + targets = $("#targetsTable").dataTable() + // Handle Addition + $("#targetForm").submit(function(){ + targets.DataTable() + .row.add([ + $("#firstName").val(), + $("#lastName").val(), + $("#email").val(), + $("#position").val(), + '' + ]) + .draw() + $("#targetForm>div>input").val('') + $("#firstName").focus() + return false + }) + // Handle Deletion + $("#targetsTable").on("click", "span>i.fa-trash-o", function(){ + targets.DataTable() + .row( $(this).parents('tr') ) + .remove() + .draw(); + }) +} + function load(){ api.groups.get() .success(function(groups){ diff --git a/templates/campaigns.html b/templates/campaigns.html index 5c113b16..9501f052 100644 --- a/templates/campaigns.html +++ b/templates/campaigns.html @@ -27,7 +27,7 @@
- +
 
@@ -74,7 +74,7 @@
-