From 78de7ed98abff93fe5fef94907bcfa4f76dcef07 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 27 May 2017 10:27:51 -0700 Subject: adding docs to repo --- docs/build/Interfaces/Editor/index.html | 1059 +++++++++++++++++++++++++++++++ 1 file changed, 1059 insertions(+) create mode 100644 docs/build/Interfaces/Editor/index.html (limited to 'docs/build/Interfaces/Editor') diff --git a/docs/build/Interfaces/Editor/index.html b/docs/build/Interfaces/Editor/index.html new file mode 100644 index 0000000..c6b25f7 --- /dev/null +++ b/docs/build/Interfaces/Editor/index.html @@ -0,0 +1,1059 @@ + + + + + + + + + + + + + + + + + + Editor Package Interfaces + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ + + +

Editor

+ +

Ponzu provides a set of interfaces from the management/editor package which +extend the system's functionality and determine how content editors are rendered +within the CMS.

+
+

Interfaces

+

editor.Editable

+

Editable determines what []bytes are rendered inside the editor page. Use +Edtiable on anything inside your CMS that you want to provide configuration, editable +fields, or any HTML/markup to display to an end-user.

+
+

Implementing editor.Editable

+

Most of the time, Ponzu developers generate the majority of this code using +the Ponzu CLI generate command.

+
+
Method Set
+
type Editable interface {
+    MarshalEditor() ([]byte, error)
+}
+
+ + +
Implementation
+
func (p *Post) MarshalEditor() ([]byte, error) {
+    // The editor.Form func sets up a structured UI with default styles and form
+    // elements based on the fields provided. Most often, Ponzu developers will
+    // have the `$ ponzu generate` command generate the MarshalEditor func and 
+    // its internal form fields
+    view, err := editor.Form(p,
+        editor.Field{
+            View: editor.Input("Name", p, map[string]string{
+                "label":       "Name",
+                "type":        "text",
+                "placeholder": "Enter the Name here",
+            }),
+        },
+    )
+}
+
+ + +
+

MarshalEditor() & View Rendering

+

Although it is common to use the editor.Form and editor.Fields to structure your content editor inside MarshalEditor(), the method signature defines that its return value needs only to be []byte, error. Keep in mind that you can return a []byte of any raw HTML or other markup to be rendered in the editor view.

+
+
+

editor.Mergeable

+

Mergable enables a CMS end-user to merge the "Pending" content from an outside source into the "Public" section, and thus making it visible via the public content API. It also allows the end-user to reject content. "Approve" and "Reject" buttons will be visible on the edit page for content submitted.

+
Method Set
+
type Mergeable interface {
+    Approve(http.ResponseWriter, *http.Request) error
+}
+
+ + +
Example
+
func (p *Post) Approve(res http.ResponseWriter, req *http.Request) error {
+    return nil
+}
+
+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3