mirror of https://github.com/gophish/gophish
Upgrade SweetAlert2 Dependency (#1583)
Upgrades the SweetAlert2 dependency to version 8.x.x. Co-authored-by: Glenn Wilkinson <glenn.wilkinson@gmail.com>pull/1519/merge
parent
20295bd96a
commit
6222c5e180
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,7 @@
|
||||||
|
.swal2-popup {
|
||||||
|
font-size: 1.6rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-tabs {
|
.nav-tabs {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
var groups=[];function save(e){var t=[];$.each($("#targetsTable").DataTable().rows().data(),function(e,a){t.push({first_name:unescapeHtml(a[0]),last_name:unescapeHtml(a[1]),email:unescapeHtml(a[2]),position:unescapeHtml(a[3])})});var a={name:$("#name").val(),targets:t};-1!=e?(a.id=e,api.groupId.put(a).success(function(e){successFlash("Group updated successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})):api.groups.post(a).success(function(e){successFlash("Group added successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#targetsTable").dataTable().DataTable().clear().draw(),$("#name").val(""),$("#modal\\.flashes").empty()}function edit(e){if(targets=$("#targetsTable").dataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),$("#modalSubmit").unbind("click").click(function(){save(e)}),-1==e);else api.groupId.get(e).success(function(e){$("#name").val(e.name),$.each(e.targets,function(e,a){targets.DataTable().row.add([escapeHtml(a.first_name),escapeHtml(a.last_name),escapeHtml(a.email),escapeHtml(a.position),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>']).draw()})}).error(function(){errorFlash("Error fetching group")});$("#csvupload").fileupload({url:"/api/import/group",dataType:"json",beforeSend:function(e){e.setRequestHeader("Authorization","Bearer "+user.api_key)},add:function(e,a){$("#modal\\.flashes").empty();var t=a.originalFiles[0].name;if(t&&!/(csv|txt)$/i.test(t.split(".").pop()))return modalError("Unsupported file extension (use .csv or .txt)"),!1;a.submit()},done:function(e,a){$.each(a.result,function(e,a){addTarget(a.first_name,a.last_name,a.email,a.position)}),targets.DataTable().draw()}})}var downloadCSVTemplate=function(){var e="group_template.csv",a=Papa.unparse([{"First Name":"Example","Last Name":"User",Email:"foobar@example.com",Position:"Systems Administrator"}],{}),t=new Blob([a],{type:"text/csv;charset=utf-8;"});if(navigator.msSaveBlob)navigator.msSaveBlob(t,e);else{var s=window.URL.createObjectURL(t),o=document.createElement("a");o.href=s,o.setAttribute("download",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)}},deleteGroup=function(s){var e=groups.find(function(e){return e.id===s});e&&swal({title:"Are you sure?",text:"This will delete the group. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete "+escapeHtml(e.name),confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,t){api.groupId.delete(s).success(function(e){a()}).error(function(e){t(e.responseJSON.message)})})}}).then(function(){swal("Group Deleted!","This group has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})};function addTarget(e,a,t,s){var o=escapeHtml(t).toLowerCase(),r=[escapeHtml(e),escapeHtml(a),o,escapeHtml(s),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'],n=targets.DataTable(),i=n.column(2,{order:"index"}).data().indexOf(o);0<=i?n.row(i,{order:"index"}).data(r):n.row.add(r)}function load(){$("#groupTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.groups.summary().success(function(e){if($("#loading").hide(),0<e.total){groups=e.groups,$("#emptyMessage").hide(),$("#groupTable").show();var t=$("#groupTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]});t.clear(),$.each(groups,function(e,a){t.row.add([escapeHtml(a.name),escapeHtml(a.num_targets),moment(a.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-backdrop='static' data-target='#modal' onclick='edit("+a.id+")'> <i class='fa fa-pencil'></i> </button> <button class='btn btn-danger' onclick='deleteGroup("+a.id+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()})}else $("#emptyMessage").show()}).error(function(){errorFlash("Error fetching groups")})}$(document).ready(function(){load(),$("#targetForm").submit(function(){var e=document.getElementById("targetForm");if(e.checkValidity())return addTarget($("#firstName").val(),$("#lastName").val(),$("#email").val(),$("#position").val()),targets.DataTable().draw(),$("#targetForm>div>input").val(""),$("#firstName").focus(),!1;e.reportValidity()}),$("#targetsTable").on("click","span>i.fa-trash-o",function(){targets.DataTable().row($(this).parents("tr")).remove().draw()}),$("#modal").on("hide.bs.modal",function(){dismiss()}),$("#csv-template").click(downloadCSVTemplate)});
|
var groups=[];function save(e){var t=[];$.each($("#targetsTable").DataTable().rows().data(),function(e,a){t.push({first_name:unescapeHtml(a[0]),last_name:unescapeHtml(a[1]),email:unescapeHtml(a[2]),position:unescapeHtml(a[3])})});var a={name:$("#name").val(),targets:t};-1!=e?(a.id=e,api.groupId.put(a).success(function(e){successFlash("Group updated successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})):api.groups.post(a).success(function(e){successFlash("Group added successfully!"),load(),dismiss(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})}function dismiss(){$("#targetsTable").dataTable().DataTable().clear().draw(),$("#name").val(""),$("#modal\\.flashes").empty()}function edit(e){if(targets=$("#targetsTable").dataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]}),$("#modalSubmit").unbind("click").click(function(){save(e)}),-1==e);else api.groupId.get(e).success(function(e){$("#name").val(e.name),$.each(e.targets,function(e,a){targets.DataTable().row.add([escapeHtml(a.first_name),escapeHtml(a.last_name),escapeHtml(a.email),escapeHtml(a.position),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>']).draw()})}).error(function(){errorFlash("Error fetching group")});$("#csvupload").fileupload({url:"/api/import/group",dataType:"json",beforeSend:function(e){e.setRequestHeader("Authorization","Bearer "+user.api_key)},add:function(e,a){$("#modal\\.flashes").empty();var t=a.originalFiles[0].name;if(t&&!/(csv|txt)$/i.test(t.split(".").pop()))return modalError("Unsupported file extension (use .csv or .txt)"),!1;a.submit()},done:function(e,a){$.each(a.result,function(e,a){addTarget(a.first_name,a.last_name,a.email,a.position)}),targets.DataTable().draw()}})}var downloadCSVTemplate=function(){var e="group_template.csv",a=Papa.unparse([{"First Name":"Example","Last Name":"User",Email:"foobar@example.com",Position:"Systems Administrator"}],{}),t=new Blob([a],{type:"text/csv;charset=utf-8;"});if(navigator.msSaveBlob)navigator.msSaveBlob(t,e);else{var o=window.URL.createObjectURL(t),s=document.createElement("a");s.href=o,s.setAttribute("download",e),document.body.appendChild(s),s.click(),document.body.removeChild(s)}},deleteGroup=function(o){var e=groups.find(function(e){return e.id===o});e&&Swal.fire({title:"Are you sure?",text:"This will delete the group. This can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete "+escapeHtml(e.name),confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(a,t){api.groupId.delete(o).success(function(e){a()}).error(function(e){t(e.responseJSON.message)})})}}).then(function(e){e.value&&Swal.fire("Group Deleted!","This group has been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})};function addTarget(e,a,t,o){var s=escapeHtml(t).toLowerCase(),r=[escapeHtml(e),escapeHtml(a),s,escapeHtml(o),'<span style="cursor:pointer;"><i class="fa fa-trash-o"></i></span>'],n=targets.DataTable(),i=n.column(2,{order:"index"}).data().indexOf(s);0<=i?n.row(i,{order:"index"}).data(r):n.row.add(r)}function load(){$("#groupTable").hide(),$("#emptyMessage").hide(),$("#loading").show(),api.groups.summary().success(function(e){if($("#loading").hide(),0<e.total){groups=e.groups,$("#emptyMessage").hide(),$("#groupTable").show();var t=$("#groupTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]});t.clear(),$.each(groups,function(e,a){t.row.add([escapeHtml(a.name),escapeHtml(a.num_targets),moment(a.modified_date).format("MMMM Do YYYY, h:mm:ss a"),"<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-backdrop='static' data-target='#modal' onclick='edit("+a.id+")'> <i class='fa fa-pencil'></i> </button> <button class='btn btn-danger' onclick='deleteGroup("+a.id+")'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()})}else $("#emptyMessage").show()}).error(function(){errorFlash("Error fetching groups")})}$(document).ready(function(){load(),$("#targetForm").submit(function(){var e=document.getElementById("targetForm");if(e.checkValidity())return addTarget($("#firstName").val(),$("#lastName").val(),$("#email").val(),$("#position").val()),targets.DataTable().draw(),$("#targetForm>div>input").val(""),$("#firstName").focus(),!1;e.reportValidity()}),$("#targetsTable").on("click","span>i.fa-trash-o",function(){targets.DataTable().row($(this).parents("tr")).remove().draw()}),$("#modal").on("hide.bs.modal",function(){dismiss()}),$("#csv-template").click(downloadCSVTemplate)});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){var r=[],n=function(){$("#username").val(""),$("#password").val(""),$("#confirm_password").val(""),$("#role").val(""),$("#modal\\.flashes").empty()},o=function(e){$("#modalSubmit").unbind("click").click(function(){!function(e){if($("#password").val()===$("#confirm_password").val()){var t={username:$("#username").val(),password:$("#password").val(),role:$("#role").val()};-1!=e?(t.id=e,api.userId.put(t).success(function(e){successFlash("User ".concat(t.username," updated successfully!")),s(),n(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})):api.users.post(t).success(function(e){successFlash("User ".concat(t.username," registered successfully!")),s(),n(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})}else modalError("Passwords must match.")}(e)}),$("#role").select2(),-1==e?($("#role").val("user"),$("#role").trigger("change")):api.userId.get(e).success(function(e){$("#username").val(e.username),$("#role").val(e.role.slug),$("#role").trigger("change")}).error(function(){errorFlash("Error fetching user")})},s=function(){$("#userTable").hide(),$("#loading").show(),api.users.get().success(function(e){r=e,$("#loading").hide(),$("#userTable").show();var t=$("#userTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]});t.clear(),$.each(r,function(e,r){t.row.add([escapeHtml(r.username),escapeHtml(r.role.name),"<div class='pull-right'><button class='btn btn-primary edit_button' data-toggle='modal' data-backdrop='static' data-target='#modal' data-user-id='"+r.id+"'> <i class='fa fa-pencil'></i> </button> <button class='btn btn-danger delete_button' data-user-id='"+r.id+"'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()})}).error(function(){errorFlash("Error fetching users")})};$(document).ready(function(){s(),$("#modal").on("hide.bs.modal",function(){n()}),$.fn.select2.defaults.set("width","100%"),$.fn.select2.defaults.set("dropdownParent",$("#role-select")),$.fn.select2.defaults.set("theme","bootstrap"),$.fn.select2.defaults.set("sorter",function(e){return e.sort(function(e,t){return e.text.toLowerCase()>t.text.toLowerCase()?1:e.text.toLowerCase()<t.text.toLowerCase()?-1:0})}),$("#new_button").on("click",function(){o(-1)}),$("#userTable").on("click",".edit_button",function(e){o($(this).attr("data-user-id"))}),$("#userTable").on("click",".delete_button",function(e){var t,n;t=$(this).attr("data-user-id"),(n=r.find(function(e){return e.id==t}))&&swal({title:"Are you sure?",text:"This will delete the account for ".concat(n.username," as well as all of the objects they have created.\n\nThis can't be undone!"),type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete",confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(e,r){api.userId.delete(t).success(function(t){e()}).error(function(e){r(e.responseJSON.message)})})}}).then(function(){swal("User Deleted!","The user account for ".concat(n.username," and all associated objects have been deleted!"),"success"),$('button:contains("OK")').on("click",function(){location.reload()})})})})}]);
|
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){var r=[],n=function(){$("#username").val(""),$("#password").val(""),$("#confirm_password").val(""),$("#role").val(""),$("#modal\\.flashes").empty()},o=function(e){$("#modalSubmit").unbind("click").click(function(){!function(e){if($("#password").val()===$("#confirm_password").val()){var t={username:$("#username").val(),password:$("#password").val(),role:$("#role").val()};-1!=e?(t.id=e,api.userId.put(t).success(function(e){successFlash("User "+escapeHtml(t.username)+" updated successfully!"),s(),n(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})):api.users.post(t).success(function(e){successFlash("User "+escapeHtml(t.username)+" registered successfully!"),s(),n(),$("#modal").modal("hide")}).error(function(e){modalError(e.responseJSON.message)})}else modalError("Passwords must match.")}(e)}),$("#role").select2(),-1==e?($("#role").val("user"),$("#role").trigger("change")):api.userId.get(e).success(function(e){$("#username").val(e.username),$("#role").val(e.role.slug),$("#role").trigger("change")}).error(function(){errorFlash("Error fetching user")})},s=function(){$("#userTable").hide(),$("#loading").show(),api.users.get().success(function(e){r=e,$("#loading").hide(),$("#userTable").show();var t=$("#userTable").DataTable({destroy:!0,columnDefs:[{orderable:!1,targets:"no-sort"}]});t.clear(),$.each(r,function(e,r){t.row.add([escapeHtml(r.username),escapeHtml(r.role.name),"<div class='pull-right'><button class='btn btn-primary edit_button' data-toggle='modal' data-backdrop='static' data-target='#modal' data-user-id='"+r.id+"'> <i class='fa fa-pencil'></i> </button> <button class='btn btn-danger delete_button' data-user-id='"+r.id+"'> <i class='fa fa-trash-o'></i> </button></div>"]).draw()})}).error(function(){errorFlash("Error fetching users")})};$(document).ready(function(){s(),$("#modal").on("hide.bs.modal",function(){n()}),$.fn.select2.defaults.set("width","100%"),$.fn.select2.defaults.set("dropdownParent",$("#role-select")),$.fn.select2.defaults.set("theme","bootstrap"),$.fn.select2.defaults.set("sorter",function(e){return e.sort(function(e,t){return e.text.toLowerCase()>t.text.toLowerCase()?1:e.text.toLowerCase()<t.text.toLowerCase()?-1:0})}),$("#new_button").on("click",function(){o(-1)}),$("#userTable").on("click",".edit_button",function(e){o($(this).attr("data-user-id"))}),$("#userTable").on("click",".delete_button",function(e){var t,n;t=$(this).attr("data-user-id"),(n=r.find(function(e){return e.id==t}))&&Swal.fire({title:"Are you sure?",text:"This will delete the account for "+escapeHtml(n.username)+" as well as all of the objects they have created.\n\nThis can't be undone!",type:"warning",animation:!1,showCancelButton:!0,confirmButtonText:"Delete",confirmButtonColor:"#428bca",reverseButtons:!0,allowOutsideClick:!1,preConfirm:function(){return new Promise(function(e,r){api.userId.delete(t).success(function(t){e()}).error(function(e){r(e.responseJSON.message)})}).catch(function(e){Swal.showValidationMessage(e)})}}).then(function(e){e.value&&Swal.fire("User Deleted!","The user account for "+escapeHtml(n.username)+" and all associated objects have been deleted!","success"),$('button:contains("OK")').on("click",function(){location.reload()})})})})}]);
|
File diff suppressed because one or more lines are too long
|
@ -125,7 +125,7 @@ function dismiss() {
|
||||||
|
|
||||||
// Deletes a campaign after prompting the user
|
// Deletes a campaign after prompting the user
|
||||||
function deleteCampaign() {
|
function deleteCampaign() {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the campaign. This can't be undone!",
|
text: "This will delete the campaign. This can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -147,12 +147,14 @@ function deleteCampaign() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if(result.value){
|
||||||
'Campaign Deleted!',
|
Swal.fire(
|
||||||
'This campaign has been deleted!',
|
'Campaign Deleted!',
|
||||||
'success'
|
'This campaign has been deleted!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.href = '/campaigns'
|
location.href = '/campaigns'
|
||||||
})
|
})
|
||||||
|
@ -161,7 +163,7 @@ function deleteCampaign() {
|
||||||
|
|
||||||
// Completes a campaign after prompting the user
|
// Completes a campaign after prompting the user
|
||||||
function completeCampaign() {
|
function completeCampaign() {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "Gophish will stop processing events for this campaign",
|
text: "Gophish will stop processing events for this campaign",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -183,15 +185,17 @@ function completeCampaign() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if (result.value){
|
||||||
'Campaign Completed!',
|
Swal.fire(
|
||||||
'This campaign has been completed!',
|
'Campaign Completed!',
|
||||||
'success'
|
'This campaign has been completed!',
|
||||||
);
|
'success'
|
||||||
$('#complete_button')[0].disabled = true;
|
);
|
||||||
$('#complete_button').text('Completed!')
|
$('#complete_button')[0].disabled = true;
|
||||||
doPoll = false;
|
$('#complete_button').text('Completed!')
|
||||||
|
doPoll = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +257,7 @@ function replay(event_idx) {
|
||||||
})
|
})
|
||||||
/* Ensure we know where to send the user */
|
/* Ensure we know where to send the user */
|
||||||
// Prompt for the URL
|
// Prompt for the URL
|
||||||
swal({
|
Swal.fire({
|
||||||
title: 'Where do you want the credentials submitted to?',
|
title: 'Where do you want the credentials submitted to?',
|
||||||
input: 'text',
|
input: 'text',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
|
@ -269,8 +273,10 @@ function replay(event_idx) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
url = result
|
if (result.value){
|
||||||
submitForm()
|
url = result.value
|
||||||
|
submitForm()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
submitForm()
|
submitForm()
|
||||||
|
|
|
@ -13,7 +13,7 @@ var campaign = {}
|
||||||
|
|
||||||
// Launch attempts to POST to /campaigns/
|
// Launch attempts to POST to /campaigns/
|
||||||
function launch() {
|
function launch() {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will schedule the campaign to be launched.",
|
text: "This will schedule the campaign to be launched.",
|
||||||
type: "question",
|
type: "question",
|
||||||
|
@ -62,16 +62,18 @@ function launch() {
|
||||||
.error(function (data) {
|
.error(function (data) {
|
||||||
$("#modal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
|
$("#modal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
|
||||||
<i class=\"fa fa-exclamation-circle\"></i> " + data.responseJSON.message + "</div>")
|
<i class=\"fa fa-exclamation-circle\"></i> " + data.responseJSON.message + "</div>")
|
||||||
swal.close()
|
Swal.close()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if (result.value){
|
||||||
'Campaign Scheduled!',
|
Swal.fire(
|
||||||
'This campaign has been scheduled for launch!',
|
'Campaign Scheduled!',
|
||||||
'success'
|
'This campaign has been scheduled for launch!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
window.location = "/campaigns/" + campaign.id.toString()
|
window.location = "/campaigns/" + campaign.id.toString()
|
||||||
})
|
})
|
||||||
|
@ -124,7 +126,7 @@ function dismiss() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteCampaign(idx) {
|
function deleteCampaign(idx) {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the campaign. This can't be undone!",
|
text: "This will delete the campaign. This can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -145,12 +147,14 @@ function deleteCampaign(idx) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if (result.value){
|
||||||
'Campaign Deleted!',
|
Swal.fire(
|
||||||
'This campaign has been deleted!',
|
'Campaign Deleted!',
|
||||||
'success'
|
'This campaign has been deleted!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
@ -166,8 +170,10 @@ function setupOptions() {
|
||||||
} else {
|
} else {
|
||||||
var group_s2 = $.map(groups, function (obj) {
|
var group_s2 = $.map(groups, function (obj) {
|
||||||
obj.text = obj.name
|
obj.text = obj.name
|
||||||
|
obj.title = obj.targets.length + " targets"
|
||||||
return obj
|
return obj
|
||||||
});
|
});
|
||||||
|
console.log(group_s2)
|
||||||
$("#users.form-control").select2({
|
$("#users.form-control").select2({
|
||||||
placeholder: "Select Groups",
|
placeholder: "Select Groups",
|
||||||
data: group_s2,
|
data: group_s2,
|
||||||
|
|
|
@ -148,7 +148,7 @@ var deleteGroup = function (id) {
|
||||||
if (!group) {
|
if (!group) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the group. This can't be undone!",
|
text: "This will delete the group. This can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -169,12 +169,14 @@ var deleteGroup = function (id) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if (result.value){
|
||||||
'Group Deleted!',
|
Swal.fire(
|
||||||
'This group has been deleted!',
|
'Group Deleted!',
|
||||||
'success'
|
'This group has been deleted!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
|
@ -50,7 +50,7 @@ function dismiss() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var deletePage = function (idx) {
|
var deletePage = function (idx) {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the landing page. This can't be undone!",
|
text: "This will delete the landing page. This can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -71,12 +71,14 @@ var deletePage = function (idx) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if (result.value){
|
||||||
'Landing Page Deleted!',
|
Swal.fire(
|
||||||
'This landing page has been deleted!',
|
'Landing Page Deleted!',
|
||||||
'success'
|
'This landing page has been deleted!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
|
@ -104,7 +104,7 @@ var dismissSendTestEmailModal = function () {
|
||||||
|
|
||||||
|
|
||||||
var deleteProfile = function (idx) {
|
var deleteProfile = function (idx) {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the sending profile. This can't be undone!",
|
text: "This will delete the sending profile. This can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -125,12 +125,14 @@ var deleteProfile = function (idx) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if (result.value){
|
||||||
'Sending Profile Deleted!',
|
Swal.fire(
|
||||||
'This sending profile has been deleted!',
|
'Sending Profile Deleted!',
|
||||||
'success'
|
'This sending profile has been deleted!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
|
@ -79,7 +79,7 @@ function dismiss() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var deleteTemplate = function (idx) {
|
var deleteTemplate = function (idx) {
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the template. This can't be undone!",
|
text: "This will delete the template. This can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -100,12 +100,14 @@ var deleteTemplate = function (idx) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (result) {
|
||||||
swal(
|
if(result.value) {
|
||||||
'Template Deleted!',
|
Swal.fire(
|
||||||
'This template has been deleted!',
|
'Template Deleted!',
|
||||||
'success'
|
'This template has been deleted!',
|
||||||
);
|
'success'
|
||||||
|
);
|
||||||
|
}
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
|
@ -77,7 +77,7 @@ const deleteUser = (id) => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
swal({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "This will delete the account for " + escapeHtml(user.username) + " as well as all of the objects they have created.\n\nThis can't be undone!",
|
text: "This will delete the account for " + escapeHtml(user.username) + " as well as all of the objects they have created.\n\nThis can't be undone!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -97,13 +97,18 @@ const deleteUser = (id) => {
|
||||||
reject(data.responseJSON.message)
|
reject(data.responseJSON.message)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
Swal.showValidationMessage(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).then(function (result) {
|
||||||
|
if (result.value){
|
||||||
|
Swal.fire(
|
||||||
|
'User Deleted!',
|
||||||
|
"The user account for " + escapeHtml(user.username) + " and all associated objects have been deleted!",
|
||||||
|
'success'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}).then(function () {
|
|
||||||
swal(
|
|
||||||
'User Deleted!',
|
|
||||||
"The user account for " + escapeHtml(user.username) + " and all associated objects have been deleted!",
|
|
||||||
'success'
|
|
||||||
);
|
|
||||||
$('button:contains("OK")').on('click', function () {
|
$('button:contains("OK")').on('click', function () {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue