webhook / webhook-cms

The CMS layer for Webhook.com
http://www.webhook.com
MIT License
178 stars 41 forks source link

Repeatable Grid Field Automatically Spawns New Rows #210

Closed budparr closed 9 years ago

budparr commented 9 years ago

1) Create a content type with a repeatable grid field type.

2) Add new entry. observe: Repeatable had one row expanded.

3) Save entry. observe: Even though there was no content in the first repeater row there is now a second row.

The repeating stops there, unless you add content to one of the rows, then the row adds yet another row, so it gets pretty bad if you're adding content to any of the rows because it appears that there's a new row on every save.

Also note, separately from the above issue, that, IMHO, the rows should be not expanded by default. I can elaborate on my logic in another issue if it's welcome.

budparr commented 9 years ago

Update: I tried this on a clean install and not seeing the issue. I'm only seeing this on my starter theme: https://github.com/budparr/webhook-authors/archive/master.zip I can't tell exactly what it is yet. I'll troubleshoot a bit more.

budparr commented 9 years ago

I figured out what the issue is. I narrowed it down to where the repeater field has a Drop-down field type within it. The Drop-down field itself is okay, BUT, when you add additional options to that field (when creating the field), the default value "defaults" to the last value added. That shouldn't be a problem, but whenever you save an entry, WH thinks you're adding a new row because there's a field already populated with a value in it.

gpbmike commented 9 years ago

Thanks for reporting this Bud. We're thinking about how to handle this in a way that makes sense.

budparr commented 9 years ago

Sure thing. My 2 cents: I think the rows shouldn't be created automatically at all. Perhaps just have a prominent button indicating a new row can be created.

There seems to be an underlying UI assumption that a new row is always wanted if there are none (or n have been created already), when you a) may not want one at all, or b) once you've added a row or rows that's all you'll want.

snide commented 9 years ago

You might be right. Though I tend to like to have it just open and ready so I can save time. We'll think on it, but that's obviously the easiest solution, though it would still record data if you hit that button and then decided you didn't want to fill it in.

Either way, good spot as always. Thanks for being so precise with these reports, they are very helpful.

budparr commented 9 years ago

A story. This might be a bit of an edge case, but I hope still reinforces my point in case you're still considering what to do, though apologies in advance for belaboring it.

I created a single entry content type to hold my site's menu. I used the grid repeater to hold the menu items (which is a beauteous draggable thing!). Now, whenever I go to that page there's a new, expanded row, which, because I'm done making entries, is not needed. So there should be a row at all unless it's called upon, in my view.

gpbmike commented 9 years ago

Hey Bud, I started work on this yesterday, but didn't finish it. Commit: https://github.com/webhook/webhook-cms/commit/93ea927791465c6f273cfac63417a730759e95b7

Image of unstyled ghost row

Not styled yet, but the idea is that we will sort of show an empty row, but it won't save unless you "unlock it". The idea is that we still want the user to see that there is a form there that can be filled out.

budparr commented 9 years ago

Sounds good. Thanks for letting me know.

gpbmike commented 9 years ago

Hey Bud, just a heads up that this change is live now. Cheers.

budparr commented 9 years ago

Awesome, thanks!