Skip to content
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

[cli] adding reference type and auto-repeater generate syntax #140

Merged
merged 1 commit into from
May 8, 2017

Conversation

nilslice
Copy link
Contributor

@nilslice nilslice commented May 8, 2017

This PR contains some updates to the CLI a bit to add the ability to generate references to other content types.. here's the syntax:

$ ponzu gen c author name:string bio:string:textarea city:string year_joined:int
$ ponzu gen c article title:string author:@author,name,city content:string:richtext photos:"[]string":file

The trailing ,name,city suffix to author:@author set the displayed option names in the select dropdown inside the CMS. If you leave them blank, it defaults to Author: {{ .id }}

Additionally, any []T slice type i.e. photos:"[]string":file in the example above, will automatically generate a editor.FileRepeater, or the "Repeater" for the view specifier (as long as one exists).

Currently, there are "Repeaters" for file, select, and input which will each have their Repeater generated automatically when accompanied by a []T type

For example:
$ ponzu gen c gallery images:"[]string":file => editor.FileRepeater()
$ ponzu gen c gallery images:"string":file => editor.File()

Side Note: you never specify the view type (file, select, richtext etc) for a reference, i.e. @author.. it will always be a reference.Select or reference.SelectRepeater if you pass []@author

@nilslice nilslice merged commit de04f5b into master May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant