diff options
author | Steve <nilslice@gmail.com> | 2016-10-31 00:59:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 00:59:57 -0700 |
commit | 645cfa39a92a9f732629f1e3206ca468ff329138 (patch) | |
tree | 89fc417b79394fb4fc58de997194b9730acfefc1 /management/editor/editor.go | |
parent | 96ebcb095797fe4947d647ad1aa7572d84609fc0 (diff) | |
parent | 682cc2b6d9e3524209fbe3d2773fa31e8de9b88d (diff) |
Merge pull request #11 from bosssauce/ponzu-dev
[core] Enable content to be submitted from external clients
Diffstat (limited to 'management/editor/editor.go')
-rw-r--r-- | management/editor/editor.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/management/editor/editor.go b/management/editor/editor.go index 3b26adb..68b787b 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -110,17 +110,31 @@ 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="row external post-controls"> + <div class="col s12 input-field"> + <button class="right waves-effect waves-light btn blue approve-post" type="submit">Approve</button> + </div> + <label class="approve-details right-align col s12">This content is pending approval. By clicking 'Approve', it will be immediately published.</label> +</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 + // hide 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(); } + // hide approval if not on a pending content item + if (getParam("status") !== "pending") { + approve.hide(); + } + del.on('click', function(e) { e.preventDefault(); var action = form.attr('action'); @@ -131,6 +145,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> ` |