Added the ability to copy landing pages

pull/157/head
Jordan Wright 2016-02-15 20:03:27 -06:00
parent 913f444598
commit b51cea7a57
1 changed files with 17 additions and 3 deletions

View File

@ -82,6 +82,16 @@ function edit(idx) {
} }
} }
function copy(idx) {
$("#modalSubmit").unbind('click').click(function() {
save(-1)
})
$("#html_editor").ckeditor()
var page = pages[idx]
$("#name").val("Copy of " + page.name)
$("#html_editor").val(page.html)
}
function load() { function load() {
/* /*
load() - Loads the current pages using the API load() - Loads the current pages using the API
@ -107,14 +117,18 @@ function load() {
pagesTable.row.add([ pagesTable.row.add([
page.name, page.name,
moment(page.modified_date).format('MMMM Do YYYY, h:mm:ss a'), moment(page.modified_date).format('MMMM Do YYYY, h:mm:ss a'),
"<div class='pull-right'><button class='btn btn-primary' data-toggle='modal' data-target='#newLandingPageModal' onclick='edit(" + i + ")'>\ "<div class='pull-right'><span data-toggle='modal' data-target='#newLandingPageModal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Edit Page' onclick='edit(" + i + ")'>\
<i class='fa fa-pencil'></i>\ <i class='fa fa-pencil'></i>\
</button>\ </button></span>\
<button class='btn btn-danger' onclick='deletePage(" + i + ")'>\ <span data-toggle='modal' data-target='#newLandingPageModal'><button class='btn btn-primary' data-toggle='tooltip' data-placement='left' title='Copy Page' onclick='copy(" + i + ")'>\
<i class='fa fa-copy'></i>\
</button></span>\
<button class='btn btn-danger' data-toggle='tooltip' data-placement='left' title='Delete Page' onclick='deletePage(" + i + ")'>\
<i class='fa fa-trash-o'></i>\ <i class='fa fa-trash-o'></i>\
</button></div>" </button></div>"
]).draw() ]).draw()
}) })
$('[data-toggle="tooltip"]').tooltip()
} else { } else {
$("#emptyMessage").show() $("#emptyMessage").show()
} }