Comments (16)
@fbaube - very glad to hear it is working for you now.
In order to use Ponzu with Buffalo or any other web framework, you need to think of Ponzu as the data layer (DB/backend/etc) and Buffalo as the frontend. You will make HTTP calls to fetch your Ponzu CMS data from the controllers/models in the frontend, and use that JSON data to populate your views with content or conversely send data to Ponzu from Buffalo in a controller/model via the same HTTP API.
Since your Ponzu content types are all exported from the content
package, you can easily re-use them in any other Go app, so unmarshaling your JSON from a Ponzu API response back into Go structs is simple: import the content package from your Ponzu project and use your content types.
At the moment, I do not have plans to make a video for Ponzu+Buffalo specifically, but I am working on a set of videos to show how one might use Ponzu with a smaller web framework (maybe in Go, maybe not) or just net/http
to make a simple frontend that talks to Ponzu over HTTP.
I believe the GopherCon website is the current best available combination of Ponzu+Buffalo:
- Buffalo app (website frontend): https://github.com/gopheracademy/gcon
- Ponzu CMS (database backend): https://github.com/gopheracademy/gccms
You can see how they import the Ponzu content types from within the Buffalo models package:
https://github.com/gopheracademy/gcon/blob/master/models/workshop.go#L6 and @bketelsen wrote an optional, but super useful cache & content API generator to work with Ponzu data:
https://github.com/bketelsen/ponzi
https://github.com/bketelsen/ponzigen
That's about all I can offer from a "how to use" Ponzu+Buffalo, so I hope it helps.. Both the #buffalo and #ponzu channels on the Gopher's Slack are pretty active with people who can help. So I'd suggest that those be the next places you check for more specific questions. I'm happy to help, but don't know much about Buffalo specifically.
Steve
from ponzu.
thats all.
looks really useful. Will give it a whirl now
from ponzu.
I have this in content/myfields.go:
type Myfields struct {
item.Item
Mytitle string `json:"mytitle"`
Myrich1 string `json:"myrich1"`
Myrich2 string `json:"myrich2"`
Myrich3 string `json:"myrich3"`
Mystringlist []string `json:"mystringlist"`
Mycheckbox string `json:"mycheckbox"`
Myfile string `json:"myfile"`
Myselect string `json:"myselect"`
Mytags string `json:"mytags"`
Mytextarea string `json:"mytextarea"`
Mytimestamp string `json:"mytimestamp"`
}
I assume I have some incorrect values in the code block above (all the "string" entries), but it's generating a UI without any visible errors (except, there is no UI widget generated for the "[]string" item).
I'll keep experimenting :)
from ponzu.
from ponzu.
Like, just paste in the whole thing ?
from ponzu.
from ponzu.
Here's my content/myfields.go. Note that I did not use "ponzu gen" for this; I hacked it custom.
from ponzu.
from ponzu.
Ah, right you are, I added an entry and it appeared. But the widget only displays as a single text field, so are the list entries separated by whitespace ?
from ponzu.
from ponzu.
The new "gen c" syntax works nicely. After the following command, and "ponzu build", I only had to go in and change the editor for "mystringlist" from Input(..) to InputRepeater(..).The UI looks fine; I'll exercise it next. Now I'm curious how it all integrates with Buffalo, mainly bcos Buffalo's DB access layer is based on "sqlx"; is there any chance of that video demo happening soon ?
ponzu gen c myfields
mytitle:string:text
mydesc:string:textarea
myrich1:string:richtext
myrich2:string:richtext
myrich3:string:richtext
mystringlist:"[]string"
mycheckbox:string:checkbox
myfile:string:file
myselect:string:select
from ponzu.
@fbaube - I finally have a walk-through introduction to Ponzu recorded:
https://www.youtube.com/watch?v=T_1ncPoLgrg
I hope its helpful! Feel free to comment here after I close the issue.
from ponzu.
@nilslice the video is very helpful to start and get the overall understanding
but it seems that it is worth to have the 'kitchen sink' example somewhere written in the docs, because it's not very convenient to navigate the video to find, for example, the checkbox usage example, it would be better to work with searchable text
by the way, I've noticed that the General Usage command example:
$ ponzu gen content review title:"string" body:"string":richtext rating:"int"
produces:
type Review struct {
item.Item
Title string `json:"title"`
Body string `json:"body"`
Rating int `json:"rating"`
Tags []string `json:"tags"`
}
The field Tags wasn't mentioned in the command but exists in the struct. It seems like a little bit confusing.
from ponzu.
@iharsuvorau - thanks for calling that out, I can definitely edit it unless you want to open a PR to remove the Tags
field from the struct in the docs?
from ponzu.
@nilslice I'm trying to push but have the same error as in #192:
$ git push origin ponzu-dev
remote: Permission to ponzu-cms/ponzu.git denied to iharsuvorau.
fatal: unable to access 'https://github.com/ponzu-cms/ponzu/': The requested URL returned error: 403
.git/config:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/ponzu-cms/ponzu
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "ponzu-dev"]
remote = origin
merge = refs/heads/ponzu-dev
from ponzu.
@iharsuvorau - thank you! you'll need to make a pull request on the Github repo page itself, not through Git. Fork the repo, clone it and checkout a ponzu-dev
branch, make your changes locally, then push to your repo. Then open a PR to ponzu, to merge into the ponzu-dev
branch from your ponzu-dev
branch.
from ponzu.
Related Issues (20)
- CLI is not working HOT 14
- Zap v11 was deleted HOT 14
- go module support HOT 9
- search sort HOT 2
- Custom databases HOT 3
- ponzu 0.11.0 fails to build HOT 2
- The "must" search operator in blevesearch can't be passed into ponzu HOT 1
- NOTICE: original author & maintainer is stepping away from the project HOT 7
- how to change to Summernote
- Redis Support for ponzu
- There is three CSRF vulnerability that can add the administrator account, delete administrator account, edit configuration.
- Only latest tag saving
- Error with "go get..." HOT 6
- Current state of Ponzu HOT 1
- Is this project still maintained? HOT 3
- Suggested install method no longer works HOT 2
- Is Ponzu dead? HOT 10
- Potential goroutine leak in achive.go
- How can you develop addons more efficiently?
- How to setup development env
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ponzu.