cms
cms copied to clipboard
Allowing adding a blueprint to user groups
Ok be gentle as I've not worked with Vue a whole lot.
This PR adds the ability to modify the blueprint associated with a user group by adding some new routes, controllers and borrowing from the existing user blueprint approach for this. This would allow developers to add new fields to the groups, such as images, descriptions or whatever they want.
The only 'breaking' change I can see is adding data() to user groups and how that would affect eloquent - would love to hear your thoughts on this.
I will definitely have missed some things here, so marking as a draft for now. But I would value feedback at this stage.
Closes: https://github.com/statamic/ideas/issues/798
Looks like a good addition to me. What more feedback were you looking for at the moment?
That’s probably enough - just wanted to know if it was worth spending time on or if there was a reason it wasn’t there already. If there’s anything approach wise that looks wrong to you do let me know.
I think you're looking good! We haven't added the feature because no one wanted it yet. 🤷
I think this is good to go, but the tests are failing due to a segmentation fault (something on Github's side?)
Thats really helpful thank you. Ive got them all fixed now.
I'm not sure why the tests are failing like that. I pulled the suite down locally, used the same PHP version and composer deps, and it all passes. 🤔
Same! No idea what’s going on.
@jasonvarga I cant figure this one out - everything passes locally using the same PHP and Laravel versions. The only thing I can notice thats different is the PHPunit version (9.5.21 locally versus 8.5.12). Maybe thats something to do with it?
I've got all the tests passing by specifying a min version of phpunit (8.5.23) on the PHP8 mockery action. Hope this is an acceptable solution.
Yeah I'm fine with that.
Looks like Orchestra requires 8.5.21 at a minimum, and 8.5.23 fixes a memory leak. Segfault seems like that's probably what it is. https://github.com/sebastianbergmann/phpunit/pull/4799
This is in a good spot. I think there's just one more thing to sort out.
The handle. Before this PR, you'd get red warning text if you try to change the handle, telling you that references won't be updated.
Now that handle becomes just a basic blueprint field, that feature is gone. I'm fine with putting that text just into the instructions, but then it's also possible to not include the handle field at all. In that case, the handle gets updated based on the title, which is awkward.
I'm thinking this:
- Leave off the handle field from the user group blueprint
- Explicitly add it in the "create" route
- Remove the handle-from-title fallback behavior - if you don't submit the handle, it just doesn't get updated.
- If you want to add a handle field, it becomes the user's responsibility to put instructions saying that it could mess things up.
(Just putting these as notes to ourselves to sort out. You don't need to do anything, @ryanmitchell)
Thanks for the work on this. Its genuinely appreciated.
We can't inject the handle field directly after the title field (we can add it to the top or bottom of the form, but that's awkward), and adding a feature to do so would require a fair bit of work. So we're just going to remove the handle field. At least for now.
So, by default, the handle will get snake_cased from the title on creation. If you want control over the handle, you can add it to your blueprint.
Amazing. So good to see this merge, thank you!