Added ability to delete templates

pull/24/head
unknown 2015-08-14 18:27:04 -05:00
parent d79de6263d
commit ba43e683c2
1 changed files with 11 additions and 1 deletions

View File

@ -59,6 +59,16 @@ function dismiss(){
$("#html_editor").val("") $("#html_editor").val("")
} }
function deleteTemplate(idx){
if (confirm("Delete " + templates[idx].name + "?")){
api.templateId.delete(templates[idx].id)
.success(function(data){
successFlash(data.message)
load()
})
}
}
function attach(files){ function attach(files){
attachmentsTable = $("#attachmentsTable").DataTable(); attachmentsTable = $("#attachmentsTable").DataTable();
$.each(files, function(i, file){ $.each(files, function(i, file){
@ -144,7 +154,7 @@ function load(){
"<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-target='#modal' onclick='edit(" + i + ")'>\ "<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-target='#modal' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\ <i class='fa fa-pencil'></i>\
</button>\ </button>\
<button class='btn btn-danger' onclick='alert(\"test\")'>\ <button class='btn btn-danger' onclick='deleteTemplate(" + i + ")'>\
<i class='fa fa-trash-o'></i>\ <i class='fa fa-trash-o'></i>\
</button></div>" </button></div>"
]).draw() ]).draw()