-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add new/create/edit/update/delete controller verbs #75
Conversation
Thanks for giving this a go @fergloragain! The code you wrote looks good, but I'd like to add the views as well. Would you be interested in contributing the svelte views as well? Maybe something like the following? (untested) {{$.Controller.Route}}/new.svelte <h1>New {{$.Name.Singular}}</h1>
<form method="post" action="{{ $.Route }}">
<!-- Add input fields here -->
<input type="submit" value="Create {{ $.Name }}" />
</form>
<a href="..">Back</a> {{$.Controller.Route}}/edit.svelte <script>
export let {{$.Variable}} = {}
</script>
<h1>Edit {{$.Name.Singular}}</h1>
<form method="post" action="{{ $.Route }}">
<!-- Add input fields here -->
<input type="hidden" value="{{$.Variable.Primary}}" />
<input type="submit" value="Create {{ $.Name }}" />
</form>
<a href="..">Back</a> After looking at your PR, I realized that we can't really infer too much about the new and edit views, so I may eventually simplify this command to just be controllers and replace the current command with something like: Either way, let's align this command with the index and show actions. |
This is exciting! Have you considered a way for users to add their own templates at a project scope level? That was a killer feature of ASP.Net MVC eons ago, we wrote some pretty complex templates and generated 95% of our application. |
@TechplexEngineer Yep! I'm still working on exposing this, but you'll be able to create your own commands soon, so you could create a Something like this: package new
type Controller struct {
*scaffold.Template // some scaffolding helper library could be nice
}
func (c *Controller) Auth() error {
c.Template.Files["controller/admin/admin.go"] = `... some template ...`
return c.Write()
} Largely inspired by Laravel's custom command support. Anything you can point me to in the ASP.Net MVC world I could have a look at? I'll try and get an RFC up soon. |
What do you think about wrapping this one up @fergloragain? Otherwise, just let us know :) |
@fergloragain re-opening since we definitely want to incorporate these changes! I'll pull this change in and add the views. |
No description provided.