summaryrefslogtreecommitdiff
path: root/management
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-17 06:05:07 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-17 06:05:07 -0800
commitd4b94e4b37bb4b28dae2a91bf4a9872e0a801c1a (patch)
tree7b00da4e19fd39293fd2c5dfd4e0e5818e6bcfed /management
parentf680588370706affb2ef98ba2a93d93fb5284683 (diff)
moving reference into content package and testing API based approach
Diffstat (limited to 'management')
-rw-r--r--management/reference/reference.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/management/reference/reference.go b/management/reference/reference.go
deleted file mode 100644
index e6d7edd..0000000
--- a/management/reference/reference.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package reference
-
-import (
- "encoding/json"
- "fmt"
- "log"
-
- "github.com/bosssauce/ponzu/management/editor"
- "github.com/bosssauce/ponzu/system/db"
-)
-
-// 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, display string) []byte {
- // decode all content type from db into options map
- // map["?type=<contentType>&id=<id>"]t.String()
- options := make(map[string]string)
- jj := db.ContentAll(contentType + "__sorted")
-
- data := make(map[string]interface{})
- for i := range jj {
- err := json.Unmarshal(jj[i], data)
- if err != nil {
- log.Println("Error decoding into reference handle:", contentType, err)
- }
-
- k := fmt.Sprintf("?type=%s&id=%d", contentType, data["id"].(int))
- v := data[display].(string)
- options[k] = v
- }
-
- return editor.Select(fieldName, p, attrs, options)
-}