From 3791fadda7b761ffba38c567da29e2e71acd1dfb Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 19 Dec 2016 11:19:53 -0800 Subject: [addons] Creating foundation for plugin-like system "Addons" (#24) * adding addons dir and sample addon which enables the use of a new input element in forms for referencing other content. "addons" is a conceptual plugin-like feature, similar to wordpress "plugins" dir, but not as sophisticated --- addons/reference/reference.go | 54 +++++++++++ cmd/ponzu/contentType.tmpl | 5 +- cmd/ponzu/main.go | 12 ++- cmd/ponzu/options.go | 114 +++++++++++++++-------- content/doc.go | 6 ++ content/item.go | 138 ---------------------------- content/types.go | 21 ----- management/editor/editor.go | 6 -- management/editor/elements.go | 2 - management/manager/manager.go | 10 +- management/manager/process.go | 72 --------------- system/addon/api.go | 47 ++++++++++ system/admin/admin.go | 12 +-- system/admin/config/config.go | 14 ++- system/admin/handlers.go | 56 +++++------ system/api/external.go | 8 +- system/api/handlers.go | 10 +- system/api/server.go | 4 +- system/db/cache.go | 35 +------ system/db/config.go | 44 +++++++++ system/db/content.go | 20 ++-- system/db/init.go | 6 +- system/item/item.go | 209 ++++++++++++++++++++++++++++++++++++++++++ system/item/types.go | 21 +++++ 24 files changed, 544 insertions(+), 382 deletions(-) create mode 100644 addons/reference/reference.go create mode 100644 content/doc.go delete mode 100644 content/item.go delete mode 100644 content/types.go delete mode 100644 management/manager/process.go create mode 100644 system/addon/api.go create mode 100644 system/item/item.go create mode 100644 system/item/types.go diff --git a/addons/reference/reference.go b/addons/reference/reference.go new file mode 100644 index 0000000..78e46eb --- /dev/null +++ b/addons/reference/reference.go @@ -0,0 +1,54 @@ +// Package reference is a Ponzu addon to enable content editors to create +// references to other content types which are stored as query strings within +// the referencer's content DB +package reference + +import ( + "bytes" + "encoding/json" + "fmt" + "html/template" + "log" + + "github.com/bosssauce/ponzu/management/editor" + "github.com/bosssauce/ponzu/system/addon" +) + +// Select returns the []byte of a