plush icon indicating copy to clipboard operation
plush copied to clipboard

How to use GroupBy?

Open vizcay opened this issue 7 years ago • 2 comments

Hi, sorry but I wasn't able to locate the docs for that (tried at https://godoc.org/github.com/gobuffalo/buffalo and also at the README but no examples).

I need to pair a slice into 2 per row pairs.

Ruby developer, learning Go and Buffalo at the same time..

Thanks!

vizcay avatar Aug 14 '18 02:08 vizcay

Sounds like a good case for a custom helper ( https://gobuffalo.io/en/docs/custom-helpers ). If you give more info/an example of use, one of us may be able to help more with how you might make that helper.

mclark4386 avatar Dec 13 '18 08:12 mclark4386

That helper take a int (how many groups you want) and a slice to divide up.

https://github.com/gobuffalo/plush/blob/master/iterators_test.go

The tests explain it a bit clearer; but we need more docs there.

<%= form_for(contact, {action: "/contact"}) { %> <%= f.InputTag("Name") %> <%= f.InputTag("Email") %> <%= f.InputTag("Company") %> <%= f.TextArea("Description", {rows: 10, label: "Please let us what you are looking for in regards to training."}) %>

That’s a real world example. It takes the slice and breaks it into 2 so I can make two nice columns in HTML On Dec 13, 2018, 3:29 AM -0500, Matthew Clark [email protected], wrote:

Sounds like a good case for a custom helper ( https://gobuffalo.io/en/docs/custom-helpers ). If you give more info/an example of use, one of us may be able to help more with how you might make that helper. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

markbates avatar Dec 13 '18 12:12 markbates

Closing. It seems like it's an answered question.

sio4 avatar Sep 04 '22 13:09 sio4