From ac82561825ab76f2b5db5c4086541e590fcb70cb Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 11 Jan 2017 11:37:56 -0800 Subject: extending the "addon" platform within ponzu to register, present and manage addons --- management/editor/editor.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'management/editor') diff --git a/management/editor/editor.go b/management/editor/editor.go index 511edb2..404e7cd 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -10,7 +10,6 @@ import ( // Editable ensures data is editable type Editable interface { - Editor() *Editor MarshalEditor() ([]byte, error) } @@ -36,7 +35,7 @@ type Field struct { // Form takes editable content and any number of Field funcs to describe the edit // page for any content struct added by a user func Form(post Editable, fields ...Field) ([]byte, error) { - editor := post.Editor() + editor := &Editor{} editor.ViewBuf = &bytes.Buffer{} _, err := editor.ViewBuf.WriteString(`
`) @@ -149,7 +148,8 @@ func Form(post Editable, fields ...Field) ([]byte, error) { save = form.find('button.save-post'), del = form.find('button.delete-post'), external = form.find('.post-controls.external'), - id = form.find('input[name=id]'); + id = form.find('input[name=id]'), + timestamp = $('.__ponzu.content-only'); // hide if this is a new post, or a non-post editor page if (id.val() === '-1' || form.attr('action') !== '/admin/edit') { @@ -162,6 +162,11 @@ func Form(post Editable, fields ...Field) ([]byte, error) { external.hide(); } + // no timestamp on addons + if (form.attr('action') === '/admin/addon') { + timestamp.hide(); + } + save.on('click', function(e) { e.preventDefault(); -- cgit v1.2.3