Closed cryophallion closed 10 years ago
One further note I forgot on the commit. Since body types has a unique slug, I left off duplicate, and just included add new
Hi, Thanks again for your contributions (even though I'm not merging them all). So... I actually just finished a project that had "duplicate" functionality. I implemented it as another button in the "view" list though (so there is "Edit", "Duplicate", and "Delete" next to each item in the list). All it does is call up the "add" form and pre-populate it with data from an existing record. The benefit of this is it's highly generic and can be used for pretty much any situation, because the duplicate function is not actually saving anything but rather just loading up default data -- so there is still a validation step required before the user saves the new duplicate record (which would catch any edge cases such as checking for unique url slugs).
I do like your idea for the "Save and Add New" button -- would you mind submitting a new pull request that has only that feature in it?
If I add the duplicate function and you ad the "Save and Add New" function, then I imagine they could be easily combined into a third feature... a "Save and Add New Duplicate" button.
One last thought... it seems to me that the "Save and Add New" button(s) might only be useful on the "Add New" form, not when you're editing an existing record. What are your thoughts on that?
Thanks again.
Ok, in order:
Mind you, and let me be clear: This is your project, and I will completely understand if you decide against these options. I just want to present a reasonable contrasting view before you make your decision. I find informed decisions to be much better reasoned, and make projects better in the long term. Let me know your rebuttals, I think we both just want what is best for this library.
See https://github.com/jordanlev/c5_boilerplate_crud/pull/9#issuecomment-40539273 for resolution of these excellent points you brought up. Thanks.
Many people prefer to not have to go back to the list view and click again to add a new item. Additionally, for example in cars, you may have several cars of different years and you want to duplicate most of the info, but change a couple of fields. These changes add that functionality
NOTES: You have to use a manual hidden id field since C5's form helper overrides it with the post variable (submitting a pull request for a fix for this to the C5 core soon) The buttons were changed to the form instead of interface button style since they needed different names. Formatting was left intact