On Thursday, 23 May 2013 00:02:00 UTC+12, Uncle Cheese wrote:
Wow, glad to see this module is getting some attention. I whipped it up really quickly one afternoon when my tedium with the GridField workflow had reached its peak. It has a long way to go. There are a number of major DRY violations because GridFieldItemRequest is not that decoratable. That would be an easy core update, though.
The biggest issue with the module right now is that the previous/next functionality is not orthogonal. If you sort or filter the grid, the adjacent records are not accurate in the detail view. As far as I can tell, there is no way to get that information from the edit view of GridField.
While "save and go to previous" is a bit of a stretch, I think "save and next" is extremely useful when doing bulk updates, e.g. having added a new field and populating it across all records. If adding and removing buttons is really desirable, I think a simple entry in the _config layer is all you would need. I think that level of configuration is expected with modules now.
Nicolaas brings up a great point about DOM, so let's remember the lessons learned from that endeavor. Yes, it made the CMS more usable, but at what cost? It was a monolithic beast that contained every feature under the sun, and it was impossibly opaque and inextensible. Meanwhile, the whole thing had a single point of maintenance and development, so when Uncle Cheese got tired of closing tickets, it simply decayed.
On the other hand, if we look at GridField as being just the opposite -- divergent, decoupled, and fed by an ecosystem of plugins, maybe that's a more forward-thinking, sustainable solution. The introduction of Composer has really been a game-changer in the "everyone uses it" problem.
Just had an IRL chat with Nicolaas about this, thought it might be appropriate to give my 2c:
- GridField was definitely designed to be a decoupled systems where people could combine a collection of components to meet their needs. It's likely -- and healthy -- that developers of applications find themselves frequently adding additional modules of GridField components and our goal is to ensure that our module management tools make that straightforward.
- The default components bundled with silverstripe/framework should probably be limited to those needed to power the default ModelAdmin scaffolds, as well as AssetAdmin, SecurityAdmin. So the question of whether to bundle a component becomes "should that be part of our default ModelAdmin scaffold"
- I agree with Ingo and Paul that replacing "Save" with "Save & Close" and "Save & Add New" is something we should do in core.
- "Save & Next", "Save & Prev" or a "Save" button alongside "Next" & "Prev" buttons are something that make sense in more data-heavy applications targeted at power users and should be installable with a module, but not included in core. However, I think we should introduce the following core refactorings to make this less awkward:
- The GridFieldConfigs used for scaffolding has_many and many_many should be able to be customised, either across the board, on a specific data type, or on a specific ModelAdmin. In principle, this would mean that you could get these extra features by doing nothing other than installing a module.
- As Uncle Cheese aluded to, GridFieldDetailForm should have some mechanism for adding additional buttons.
Responding to a more specific point of Aarons': "The biggest issue with the module right now is that the previous/next functionality is not orthogonal. If you sort or filter the grid, the adjacent records are not accurate in the detail view. As far as I can tell, there is no way to get that information from the edit view of GridField."
--> You should be fine if you include your component *after* the filter/sort components. Having looked at your code, it seems like there may be a bug in the relevant part of core.
With the release candidate of 3.1 just around the corner, I think that all of this is best left for 3.2 (i.e., master). But let's aim to make things better for that release! (Gallery view, too. Zauberfisch: any update?)