summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-10-30 23:31:37 -0700
committerSteve Manuel <nilslice@gmail.com>2016-10-30 23:31:37 -0700
commitdd4a88bed52b6127503824218fb97645d44e1a7d (patch)
treea4f5aad277aadee61ee9d4aa319de836d694b595
parentb1dd82806b8e31ff62d5cbb0612998411a8a1259 (diff)
adding initial code for merging pending to private content
-rw-r--r--management/editor/editor.go16
-rw-r--r--system/admin/server.go2
2 files changed, 17 insertions, 1 deletions
diff --git a/management/editor/editor.go b/management/editor/editor.go
index 3b26adb..6a17acb 100644
--- a/management/editor/editor.go
+++ b/management/editor/editor.go
@@ -110,15 +110,22 @@ func Form(post Editable, fields ...Field) ([]byte, error) {
<button class="right waves-effect waves-light btn red delete-post" type="submit">Delete</button>
</div>
+<div class="input-field external post-controls">
+ <div>This post is pending approval. By clicking 'Approve' it will be immediately published.</div>
+ <button class="right waves-effect waves-light btn blue approve-post" type="submit">Approve</button>
+</div>
+
<script>
$(function() {
var form = $('form'),
del = form.find('button.delete-post'),
+ approve = form.find('.post-controls.external'),
id = form.find('input[name=id]');
// hide delete button if this is a new post, or a non-post editor page
if (id.val() === '-1' || form.attr('action') !== '/admin/edit') {
del.hide();
+ approve.hide();
}
del.on('click', function(e) {
@@ -131,6 +138,15 @@ func Form(post Editable, fields ...Field) ([]byte, error) {
form.submit();
}
});
+
+ approve.find('button').on('click', function(e) {
+ e.preventDefault();
+ var action = form.attr('action');
+ action = action + '/approve';
+ form.attr('action', action);
+
+ form.submit();
+ });
});
</script>
`
diff --git a/system/admin/server.go b/system/admin/server.go
index 161220e..5d93d84 100644
--- a/system/admin/server.go
+++ b/system/admin/server.go
@@ -24,11 +24,11 @@ func Run() {
http.HandleFunc("/admin/configure/users/delete", user.Auth(configUsersDeleteHandler))
http.HandleFunc("/admin/posts", user.Auth(postsHandler))
- http.HandleFunc("/admin/posts/approve", user.Auth(approvePostHandler))
http.HandleFunc("/admin/posts/search", user.Auth(searchHandler))
http.HandleFunc("/admin/edit", user.Auth(editHandler))
http.HandleFunc("/admin/edit/delete", user.Auth(deleteHandler))
+ http.HandleFunc("/admin/edit/approve", user.Auth(approvePostHandler))
http.HandleFunc("/admin/edit/upload", user.Auth(editUploadHandler))
pwd, err := os.Getwd()