Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Add an "actions" generator #16

Closed
markbates opened this issue Dec 2, 2016 · 5 comments
Closed

Add an "actions" generator #16

markbates opened this issue Dec 2, 2016 · 5 comments

Comments

@markbates
Copy link
Member

No description provided.

@paganotoni
Copy link
Member

@markbates i'm loving buffalo, this is awesome, thanks for taking the lead on this web framework.
Regarding this issue, what do you think should be the output of running

buffalo g action myNewAction

should there be one action per file inside actions folder ? if so, should create a new file with
myNewAction handler ?

@markbates
Copy link
Member Author

Glad you like it!

Here's what I was thinking:

buffalo g action users show foo bar etc…

That would create n files:

actions/users.go
actions/users_test.go
templates/users/show.html
templates/users/foo.html
etc…

If actions/users.go exists it should append to the file. That file would have the actions:

func UsersFoo(c buffalo.Context) error {
  return c.Render(200, r.HTML("users/foo.html")
}

A test asserting the template is rendered would be great as well.

The template should just be something like:

<h1>Users#Foo</h1>

Hopefully that all makes sense. I'm typing on my phone!

Bonus points if you can map the route in app.go! :)

@paganotoni
Copy link
Member

@markbates thanks for the explanation on this one its now very clear. I have a question about how to continue with the PR now that i'm contributor, should i send a PR from buffalo's repo or continue sending PR's from my fork?.

Also on another news i've started writing some test cases for this one on features/actions-generators i'll keep you posted, but if you have the chance please let me know if i'm going the right direction with the tests.

@markbates
Copy link
Member Author

It's up to you whether you would like to create branches here or your fork. Either is fine with me. Just never push directly to master. :)

@markbates
Copy link
Member Author

Closed with #103

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants