New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content Field Blank With Ponzu #119
Comments
I am running go1.8 ponzu version 0.9.1 ponzu --cli version 0.9.1 |
Could you paste the generated review.go file here too? Did you edit it at all or immediate just build and run? Also, can you try visiting http://localhost:8080/admin/edit?type=Review It's strange that you're able to run the project but the content type isn't showing. |
package content
import (
"fmt"
"github.com/ponzu-cms/ponzu/management/editor"
"github.com/ponzu-cms/ponzu/system/item"
)
type Review struct {
item.Item
Title string `json:"title"`
Author string `json:"author"`
Rating float64 `json:"rating"`
Body string `json:"body"`
WebsiteUrl string `json:"website_url"`
Items []string `json:"items"`
Photos []string `json:"photos"`
}
// MarshalEditor writes a buffer of html to edit a Review within the CMS
// and implements editor.Editable
func (r *Review) MarshalEditor() ([]byte, error) {
view, err := editor.Form(r,
// Take note that the first argument to these Input-like functions
// is the string version of each Review field, and must follow
// this pattern for auto-decoding and auto-encoding reasons:
editor.Field{
View: editor.Input("Title", r, map[string]string{
"label": "Title",
"type": "text",
"placeholder": "Enter the Title here",
}),
},
editor.Field{
View: editor.Input("Author", r, map[string]string{
"label": "Author",
"type": "text",
"placeholder": "Enter the Author here",
}),
},
editor.Field{
View: editor.Input("Rating", r, map[string]string{
"label": "Rating",
"type": "text",
"placeholder": "Enter the Rating here",
}),
},
editor.Field{
View: editor.Input("Body", r, map[string]string{
"label": "Body",
"type": "text",
"placeholder": "Enter the Body here",
}),
},
editor.Field{
View: editor.Input("WebsiteUrl", r, map[string]string{
"label": "WebsiteUrl",
"type": "text",
"placeholder": "Enter the WebsiteUrl here",
}),
},
editor.Field{
View: editor.Input("Items", r, map[string]string{
"label": "Items",
"type": "text",
"placeholder": "Enter the Items here",
}),
},
editor.Field{
View: editor.Input("Photos", r, map[string]string{
"label": "Photos",
"type": "text",
"placeholder": "Enter the Photos here",
}),
},
)
if err != nil {
return nil, fmt.Errorf("Failed to render Review editor view: %s", err.Error())
}
return view, nil
}
func init() {
item.Types["Review"] = func() interface{} { return new(Review) }
} |
This is what I get when I visit the link above |
Hmm.. what is the output of |
/Users/nem/go/src/github.com/wearevest/vestCMS is the output of pwd I just got it working when I reinstalled it in a different place. i'm going to try to reinstall |
Ok, great - go ahead and close this issue if your new build works. Otherwise let me know and I will try to continue help w/ debugging. |
It's working now, I'm not exactly sure why. If I have any other problems I will let you know thank you. |
Sounds good! Glad it's working now |
I love what you guys have done with ponzu unfortunately it's not working for me.
I followed the quickstart performing the following steps
I installed ponzu with go get
I created a new 'ponzu' project in my go path
I changed directories to the new project
I ran ponzu generate content review title:”string” author:”string” rating:”float64” body:”string” website_url:”string” items:”[]string” photos:”[]string”
I ran ponzu build
I ran ponzu run
then I navigated to localhost:8080
this is the directory
this is my terminal
this is the admin running
The text was updated successfully, but these errors were encountered: