summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--addons/reference/reference.go54
-rw-r--r--cmd/ponzu/contentType.tmpl4
-rw-r--r--cmd/ponzu/main.go14
-rw-r--r--cmd/ponzu/options.go8
-rw-r--r--management/manager/manager.go5
-rw-r--r--system/addon/api.go2
-rw-r--r--system/admin/admin.go8
-rw-r--r--system/admin/config/config.go4
-rw-r--r--system/admin/handlers.go16
-rw-r--r--system/admin/server.go8
-rw-r--r--system/api/external.go6
-rw-r--r--system/api/handlers.go6
-rw-r--r--system/db/config.go2
-rw-r--r--system/db/content.go2
-rw-r--r--system/db/init.go4
-rw-r--r--system/db/user.go2
-rw-r--r--system/tls/enable.go2
18 files changed, 108 insertions, 49 deletions
diff --git a/README.md b/README.md
index de279df..f9cba63 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ to get thoughts/feedback!
## Installation
```
-$ go get github.com/bosssauce/ponzu/...
+$ go get github.com/ponzu-cms/ponzu/...
```
## Contributing
@@ -25,11 +25,11 @@ $ go get github.com/bosssauce/ponzu/...
_A typical contribution workflow might look like:_
```bash
# clone the repository and checkout ponzu-dev
-$ git clone https://github.com/bosssauce/ponzu 'path/to/local/ponzu'
+$ git clone https://github.com/ponzu-cms/ponzu 'path/to/local/ponzu'
$ git checkout ponzu-dev
# install ponzu with go get or from your own local path
-$ go get github.com/bosssauce/ponzu/...
+$ go get github.com/ponzu-cms/ponzu/...
# or
$ cd /path/to/local/ponzu
$ go install ./...
@@ -45,9 +45,9 @@ $ ponzu --dev new /path/to/new/project # will create $GOPATH/src/path/to/new/pro
$ cd /path/to/new/project
$ ponzu build && ponzu run
-# push to your origin:ponzu-dev branch and create a PR at bosssauce/ponzu
+# push to your origin:ponzu-dev branch and create a PR at ponzu-cms/ponzu
$ git push origin ponzu-dev
-# ... go to https://github.com/bosssauce/ponzu and create a PR
+# ... go to https://github.com/ponzu-cms/ponzu and create a PR
```
**Note:** if you intend to work on your own fork and contribute from it, you will
diff --git a/addons/reference/reference.go b/addons/reference/reference.go
new file mode 100644
index 0000000..35b7d3d
--- /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/ponzu-cms/ponzu/management/editor"
+ "github.com/ponzu-cms/ponzu/system/addon"
+)
+
+// Select returns the []byte of a <select> HTML element plus internal <options> with a label.
+// IMPORTANT:
+// The `fieldName` argument will cause a panic if it is not exactly the string
+// form of the struct field that this editor input is representing
+func Select(fieldName string, p interface{}, attrs map[string]string, contentType, tmplString string) []byte {
+ // decode all content type from db into options map
+ // map["?type=<contentType>&id=<id>"]t.String()
+ options := make(map[string]string)
+
+ var all map[string]interface{}
+ j := addon.ContentAll(contentType)
+
+ err := json.Unmarshal(j, &all)
+ if err != nil {
+ return nil
+ }
+
+ // make template for option html display
+ tmpl := template.Must(template.New(contentType).Parse(tmplString))
+
+ // make data something usable to iterate over and assign options
+ data := all["data"].([]interface{})
+
+ for i := range data {
+ item := data[i].(map[string]interface{})
+ k := fmt.Sprintf("?type=%s&id=%.0f", contentType, item["id"].(float64))
+ v := &bytes.Buffer{}
+ err := tmpl.Execute(v, item)
+ if err != nil {
+ log.Println("Error executing template for reference of:", contentType)
+ return nil
+ }
+
+ options[k] = v.String()
+ }
+
+ return editor.Select(fieldName, p, attrs, options)
+}
diff --git a/cmd/ponzu/contentType.tmpl b/cmd/ponzu/contentType.tmpl
index 1804555..1a57950 100644
--- a/cmd/ponzu/contentType.tmpl
+++ b/cmd/ponzu/contentType.tmpl
@@ -3,8 +3,8 @@ package content
import (
"fmt"
- "github.com/bosssauce/ponzu/management/editor"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/management/editor"
+ "github.com/ponzu-cms/ponzu/system/item"
)
type {{ .Name }} struct {
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go
index b2b5e75..ae646c5 100644
--- a/cmd/ponzu/main.go
+++ b/cmd/ponzu/main.go
@@ -10,14 +10,14 @@ import (
"strings"
"time"
- "github.com/bosssauce/ponzu/system/admin"
- "github.com/bosssauce/ponzu/system/api"
- "github.com/bosssauce/ponzu/system/api/analytics"
- "github.com/bosssauce/ponzu/system/db"
- "github.com/bosssauce/ponzu/system/tls"
+ "github.com/ponzu-cms/ponzu/system/admin"
+ "github.com/ponzu-cms/ponzu/system/api"
+ "github.com/ponzu-cms/ponzu/system/api/analytics"
+ "github.com/ponzu-cms/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/tls"
// import registers content types
- _ "github.com/bosssauce/ponzu/content"
+ _ "github.com/ponzu-cms/ponzu/content"
)
var year = fmt.Sprintf("%d", time.Now().Year())
@@ -57,7 +57,7 @@ new <directory>:
immediately following the 'new' option in the $GOPATH/src directory. Note:
'new' depends on the program 'git' and possibly a network connection. If
there is no local repository to clone from at the local machine's $GOPATH,
- 'new' will attempt to clone the 'github.com/bosssauce/ponzu' package from
+ 'new' will attempt to clone the 'github.com/ponzu-cms/ponzu' package from
over the network.
Example:
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go
index 9c2767f..841af94 100644
--- a/cmd/ponzu/options.go
+++ b/cmd/ponzu/options.go
@@ -53,7 +53,7 @@ func newProjectInDir(path string) error {
return createProjInDir(path)
}
-var ponzuRepo = []string{"github.com", "bosssauce", "ponzu"}
+var ponzuRepo = []string{"github.com", "ponzu-cms", "ponzu"}
func createProjInDir(path string) error {
gopath := os.Getenv("GOPATH")
@@ -144,7 +144,7 @@ func createProjInDir(path string) error {
}
func vendorCorePackages(path string) error {
- vendorPath := filepath.Join(path, "cmd", "ponzu", "vendor", "github.com", "bosssauce", "ponzu")
+ vendorPath := filepath.Join(path, "cmd", "ponzu", "vendor", "github.com", "ponzu-cms", "ponzu")
err := os.MkdirAll(vendorPath, os.ModeDir|os.ModePerm)
if err != nil {
return err
@@ -250,7 +250,11 @@ func buildPonzuServer(args []string) error {
// copy all ./content files to internal vendor directory
src := "content"
+<<<<<<< HEAD
+ dst := filepath.Join("cmd", "ponzu", "vendor", "github.com", "ponzu-cms", "ponzu", "content")
+=======
dst := filepath.Join("cmd", "ponzu", "vendor", "github.com", "bosssauce", "ponzu", "content")
+>>>>>>> ponzu-dev
err = copyFilesWarnConflicts(src, dst, []string{"doc.go"})
if err != nil {
return err
diff --git a/management/manager/manager.go b/management/manager/manager.go
index 5eafb9a..c54918f 100644
--- a/management/manager/manager.go
+++ b/management/manager/manager.go
@@ -5,8 +5,9 @@ import (
"fmt"
"html/template"
- "github.com/bosssauce/ponzu/management/editor"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/management/editor"
+ "github.com/ponzu-cms/ponzu/system/item"
+
uuid "github.com/satori/go.uuid"
)
diff --git a/system/addon/api.go b/system/addon/api.go
index 4c3152b..b79a29e 100644
--- a/system/addon/api.go
+++ b/system/addon/api.go
@@ -9,7 +9,7 @@ import (
"net/http"
"time"
- "github.com/bosssauce/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/db"
)
// ContentAll retrives all items from the HTTP API within the provided namespace
diff --git a/system/admin/admin.go b/system/admin/admin.go
index 78f607d..4d9df30 100644
--- a/system/admin/admin.go
+++ b/system/admin/admin.go
@@ -8,10 +8,10 @@ import (
"html/template"
"net/http"
- "github.com/bosssauce/ponzu/system/admin/user"
- "github.com/bosssauce/ponzu/system/api/analytics"
- "github.com/bosssauce/ponzu/system/db"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/system/admin/user"
+ "github.com/ponzu-cms/ponzu/system/api/analytics"
+ "github.com/ponzu-cms/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/item"
)
var startAdminHTML = `<!doctype html>
diff --git a/system/admin/config/config.go b/system/admin/config/config.go
index ab17425..fdc1ae4 100644
--- a/system/admin/config/config.go
+++ b/system/admin/config/config.go
@@ -1,8 +1,8 @@
package config
import (
- "github.com/bosssauce/ponzu/management/editor"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/management/editor"
+ "github.com/ponzu-cms/ponzu/system/item"
)
// Config represents the confirgurable options of the system
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index 266535a..7d33f80 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -11,14 +11,14 @@ import (
"strings"
"time"
- "github.com/bosssauce/ponzu/management/editor"
- "github.com/bosssauce/ponzu/management/manager"
- "github.com/bosssauce/ponzu/system/admin/config"
- "github.com/bosssauce/ponzu/system/admin/upload"
- "github.com/bosssauce/ponzu/system/admin/user"
- "github.com/bosssauce/ponzu/system/api"
- "github.com/bosssauce/ponzu/system/db"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/management/editor"
+ "github.com/ponzu-cms/ponzu/management/manager"
+ "github.com/ponzu-cms/ponzu/system/admin/config"
+ "github.com/ponzu-cms/ponzu/system/admin/upload"
+ "github.com/ponzu-cms/ponzu/system/admin/user"
+ "github.com/ponzu-cms/ponzu/system/api"
+ "github.com/ponzu-cms/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/item"
"github.com/gorilla/schema"
emailer "github.com/nilslice/email"
diff --git a/system/admin/server.go b/system/admin/server.go
index bc6f4d6..b99ec37 100644
--- a/system/admin/server.go
+++ b/system/admin/server.go
@@ -6,9 +6,9 @@ import (
"os"
"path/filepath"
- "github.com/bosssauce/ponzu/system/admin/user"
- "github.com/bosssauce/ponzu/system/api"
- "github.com/bosssauce/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/admin/user"
+ "github.com/ponzu-cms/ponzu/system/api"
+ "github.com/ponzu-cms/ponzu/system/db"
)
// Run adds Handlers to default http listener for Admin
@@ -42,7 +42,7 @@ func Run() {
log.Fatal("Couldn't find current directory for file server.")
}
- staticDir := filepath.Join(pwd, "cmd", "ponzu", "vendor", "github.com", "bosssauce", "ponzu", "system")
+ staticDir := filepath.Join(pwd, "cmd", "ponzu", "vendor", "github.com", "ponzu-cms", "ponzu", "system")
http.Handle("/admin/static/", db.CacheControl(http.FileServer(restrict(http.Dir(staticDir)))))
// API path needs to be registered within server package so that it is handled
diff --git a/system/api/external.go b/system/api/external.go
index 8112e29..86e4a99 100644
--- a/system/api/external.go
+++ b/system/api/external.go
@@ -7,9 +7,9 @@ import (
"strings"
"time"
- "github.com/bosssauce/ponzu/system/admin/upload"
- "github.com/bosssauce/ponzu/system/db"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/system/admin/upload"
+ "github.com/ponzu-cms/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/item"
)
// Externalable accepts or rejects external POST requests to endpoints such as:
diff --git a/system/api/handlers.go b/system/api/handlers.go
index 1e2f1e2..788b2a0 100644
--- a/system/api/handlers.go
+++ b/system/api/handlers.go
@@ -8,9 +8,9 @@ import (
"strconv"
"strings"
- "github.com/bosssauce/ponzu/system/api/analytics"
- "github.com/bosssauce/ponzu/system/db"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/system/api/analytics"
+ "github.com/ponzu-cms/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/item"
)
func typesHandler(res http.ResponseWriter, req *http.Request) {
diff --git a/system/db/config.go b/system/db/config.go
index 4bbf29b..0e49307 100644
--- a/system/db/config.go
+++ b/system/db/config.go
@@ -7,7 +7,7 @@ import (
"net/url"
"strings"
- "github.com/bosssauce/ponzu/system/admin/config"
+ "github.com/ponzu-cms/ponzu/system/admin/config"
"github.com/boltdb/bolt"
"github.com/gorilla/schema"
diff --git a/system/db/content.go b/system/db/content.go
index 535b601..8bc76a6 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -10,7 +10,7 @@ import (
"strconv"
"strings"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/system/item"
"github.com/boltdb/bolt"
"github.com/gorilla/schema"
diff --git a/system/db/init.go b/system/db/init.go
index 9a0c3e5..bf93bc6 100644
--- a/system/db/init.go
+++ b/system/db/init.go
@@ -4,8 +4,8 @@ import (
"encoding/json"
"log"
- "github.com/bosssauce/ponzu/system/admin/config"
- "github.com/bosssauce/ponzu/system/item"
+ "github.com/ponzu-cms/ponzu/system/admin/config"
+ "github.com/ponzu-cms/ponzu/system/item"
"github.com/boltdb/bolt"
"github.com/nilslice/jwt"
diff --git a/system/db/user.go b/system/db/user.go
index b92a62a..1b15a82 100644
--- a/system/db/user.go
+++ b/system/db/user.go
@@ -7,7 +7,7 @@ import (
"fmt"
"net/http"
- "github.com/bosssauce/ponzu/system/admin/user"
+ "github.com/ponzu-cms/ponzu/system/admin/user"
"github.com/boltdb/bolt"
"github.com/nilslice/jwt"
diff --git a/system/tls/enable.go b/system/tls/enable.go
index 4ade194..04f032a 100644
--- a/system/tls/enable.go
+++ b/system/tls/enable.go
@@ -9,7 +9,7 @@ import (
"path/filepath"
"time"
- "github.com/bosssauce/ponzu/system/db"
+ "github.com/ponzu-cms/ponzu/system/db"
"golang.org/x/crypto/acme/autocert"
)