summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/addon/addon.go6
-rw-r--r--system/addon/manager.go8
-rw-r--r--system/admin/config/config.go12
3 files changed, 15 insertions, 11 deletions
diff --git a/system/addon/addon.go b/system/addon/addon.go
index 22e2114..a423d07 100644
--- a/system/addon/addon.go
+++ b/system/addon/addon.go
@@ -38,9 +38,9 @@ type Addon struct {
Meta
}
-// New constructs a new addon to be registered. Meta is a addon.Meta and fn is a
-// closure returning a pointer to your own addon type
-func New(m Meta, fn func() interface{}) Addon {
+// Register constructs a new addon and registers it with the system. Meta is a
+// addon.Meta and fn is a closure returning a pointer to your own addon type
+func Register(m Meta, fn func() interface{}) Addon {
// get or create the reverse DNS identifier
if m.PonzuAddonReverseDNS == "" {
revDNS, err := reverseDNS(m)
diff --git a/system/addon/manager.go b/system/addon/manager.go
index 3757421..acd779a 100644
--- a/system/addon/manager.go
+++ b/system/addon/manager.go
@@ -15,11 +15,11 @@ const defaultInput = `<input type="hidden" name="%s" value="%s"/>`
const managerHTML = `
<div class="card editor">
<form method="post" action="/admin/addon" enctype="multipart/form-data">
+ <div class="card-content">
+ <div class="card-title">{{ .AddonName }}</div>
+ </div>
{{ .DefaultInputs }}
{{ .Editor }}
- <div class="row">
- <button type="submit" class="btn green waves-effect waves-light right">Save</button>
- </div>
</form>
</div>
`
@@ -27,6 +27,7 @@ const managerHTML = `
type manager struct {
DefaultInputs template.HTML
Editor template.HTML
+ AddonName string
}
// Manage ...
@@ -77,6 +78,7 @@ func Manage(data url.Values, reverseDNS string) ([]byte, error) {
m := manager{
DefaultInputs: template.HTML(inputs.Bytes()),
Editor: template.HTML(v),
+ AddonName: data.Get("addon_name"),
}
// execute html template into buffer for func return val
diff --git a/system/admin/config/config.go b/system/admin/config/config.go
index 2bc80c6..7b57dc0 100644
--- a/system/admin/config/config.go
+++ b/system/admin/config/config.go
@@ -8,7 +8,6 @@ import (
// Config represents the confirgurable options of the system
type Config struct {
item.Item
- editor editor.Editor
Name string `json:"name"`
Domain string `json:"domain"`
@@ -23,9 +22,6 @@ type Config struct {
// String partially implements item.Identifiable and overrides Item's String()
func (c *Config) String() string { return c.Name }
-// Editor partially implements editor.Editable
-func (c *Config) Editor() *editor.Editor { return &c.editor }
-
// MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable
func (c *Config) MarshalEditor() ([]byte, error) {
view, err := editor.Form(c,
@@ -90,7 +86,13 @@ func (c *Config) MarshalEditor() ([]byte, error) {
return nil, err
}
- open := []byte(`<div class="card"><form action="/admin/configure" method="post">`)
+ open := []byte(`
+ <div class="card">
+ <div class="card-content">
+ <div class="card-title">System Configuration</div>
+ </div>
+ <form action="/admin/configure" method="post">
+ `)
close := []byte(`</form></div>`)
script := []byte(`
<script>