diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-08 19:35:00 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-08 19:35:00 -0800 |
commit | 559e8c8996ab86e254a8fe74f52ebede0ba2013e (patch) | |
tree | a72e0f00ef117a496f52bd9102e9c9ea178d6f91 /management/editor/editor.go | |
parent | bb59898de5856f414ba428c9ec436a4843471a66 (diff) |
only show approve/reject buttons if content type implements api.Mergable
Diffstat (limited to 'management/editor/editor.go')
-rw-r--r-- | management/editor/editor.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/management/editor/editor.go b/management/editor/editor.go index 58a6984..fb60c99 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -4,6 +4,8 @@ package editor import ( "bytes" + + "github.com/bosssauce/ponzu/system/api" ) // Editable ensures data is editable @@ -106,7 +108,11 @@ func Form(post Editable, fields ...Field) ([]byte, error) { <button class="right waves-effect waves-light btn green save-post" type="submit">Save</button> <button class="right waves-effect waves-light btn red delete-post" type="submit">Delete</button> </div> - +` + m, ok := post.(api.Mergeable) + if ok { + submit += + ` <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> @@ -114,7 +120,10 @@ func Form(post Editable, fields ...Field) ([]byte, error) { </div> <label class="approve-details right-align col s12">This content is pending approval. By clicking 'Approve', it will be immediately published. By clicking 'Reject', it will be deleted.</label> </div> +` + } + script := ` <script> $(function() { var form = $('form'), @@ -178,7 +187,7 @@ func Form(post Editable, fields ...Field) ([]byte, error) { }); </script> ` - editor.ViewBuf.Write([]byte(submit + `</td></tr></tbody></table>`)) + editor.ViewBuf.Write([]byte(submit + script + `</td></tr></tbody></table>`)) return editor.ViewBuf.Bytes(), nil } |