![]() |
SparkPlug - Rails inspired Scaffolding - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: SparkPlug - Rails inspired Scaffolding (/showthread.php?tid=5777) Pages:
1
2
|
SparkPlug - Rails inspired Scaffolding - El Forum - 02-03-2008 [eluser]Pascal Kriete[/eluser] A nice Scaffolding library is one thing I was looking forward to in 1.6, especially since the existing one is now deprecated. Since that didn't happen, I decided to see how much I could get done in one weekend. This is the result of that weekend project. Mind you, it's not anywhere near being finished, but it works, which was the weekend goal. Currently it consists of two files. One for dynamic scaffolding, very much like what already exists. The other one generates the scaffold code very similar to what rails does when you execute: ./script/generate scaffold Table Controller I hate the code most applications generate, simply because I like to follow my own coding style. And changing all the curly braces every time gets really annoying. So drawing from personal experience, I added templates to the generator (at the bottom of the file). Eventually I would like to consolidate the two files, and figure out how much of the code they can share, but for now it's easier to keep them seperate. I'm not happy with all of it yet, especially the views need work, but the weekend is over and I have to get something out the door. Get it here: SparkPlug Don't forget to read the wiki page. Tested on OS X with MAMP, please check the paths before running it - just to be sure. Any feedback is appreciated. SparkPlug - Rails inspired Scaffolding - El Forum - 02-03-2008 [eluser]Michael Wales[/eluser] Definitely looking forward to trying this out. Might I make another suggestion for SparkPlug - Rails inspired migrations. It makes developing with multiple developers so much easier... SparkPlug - Rails inspired Scaffolding - El Forum - 02-03-2008 [eluser]Pascal Kriete[/eluser] Hmm, hadn't thought of that. With the addition of the dbforge it wouldn't be too hard to implement. I'll definitely keep that in mind as I clean up the existing code. SparkPlug - Rails inspired Scaffolding - El Forum - 02-04-2008 [eluser]lifewithryan[/eluser] I like the idea of "coding-style" templates....wish I'd have thought of that one. I'm big on not forcing people to live by "your" decisions and leaving things as open as possible...the style templates adds another level of freedom there. Do you provide a way to edit what gets generated or how it gets implemented? SparkPlug - Rails inspired Scaffolding - El Forum - 02-04-2008 [eluser]Rick Jolly[/eluser] [quote author="Michael Wales" date="1202103644"]Definitely looking forward to trying this out. Might I make another suggestion for SparkPlug - Rails inspired migrations. It makes developing with multiple developers so much easier...[/quote] Clemens tackled Rails inspired migrations. He called it PHake. I haven't tried it and development seems to have stalled: http://blog.hyperblast.at/2007/04/21/introducing-phake/ SparkPlug - Rails inspired Scaffolding - El Forum - 02-04-2008 [eluser]Pascal Kriete[/eluser] [quote author="lifewithryan" date="1202170520"]Do you provide a way to edit what gets generated or how it gets implemented?[/quote] This is a concept I've been struggling with. For example the basic show view on the released version right now looks like this: Code: <? foreach ($fields as $field): ?> ![]() Since I already have basic variable tags in my views, some clever coding might allow for modifiers to 'choose' eventually. It's not one of my priorities though. SparkPlug - Rails inspired Scaffolding - El Forum - 02-05-2008 [eluser]Pascal Kriete[/eluser] Sorry for the double post, I just want to 'announce' an update that, to me, marks the beginning as a usable library - without any of the weekend hacks. And I've started creating some decent documentation on the google code wiki. The changes are too many to list, and don't belong here. Refer to the [url="http://code.google.com/p/sparkplug/wiki/ChangeLog"]Change Log[/url]. I highly suggest you read the developer information in the wiki if you want to hack around the code (and who doesn't ![]() Thanks for all the valuable feedback. SparkPlug - Rails inspired Scaffolding - El Forum - 02-10-2008 [eluser]Sean Downey[/eluser] Hello I really like your scaffolding. I have only really used the scaffolding function so far and not the generate but I have made a few changes. Where can I send the file?? The biggest change is in retrieving the field details from the DB. //$fields = $this->CI->db->field_data($this->table); $fields = $this->_db_get_fields(); I have created a new function to get better info about the field types eg enum - and I have added those to the _insertMarkup and _editMarkup functions. I also put the 1.6 Scaffolding styles into your _header function. I also changed the field labels from ucfirst($field->name) to ucwords(str_replace("_", " ", $field->name)) I can't remember if I made any other small changes but you could tell using a diff anyway. I really like your class and how simple it is to get going. Another feature I think it requires is a "confirm" on deleting records. After that - to make it a really good start for a backend system would be to try to get the relations between tables to work. I hope that you continue to develop this class - if you would like help let me know because I think I will try to build on what you started. Best regards Sean SparkPlug - Rails inspired Scaffolding - El Forum - 02-10-2008 [eluser]Pascal Kriete[/eluser] Hey Sean, First off, thanks for you interest. I would love to see the changes you've made. For now, the file should fit into a pm attachment, and we'll work something out for anything beyond that. I do plan on actively developing this library, but I'm nearing finals time so updates will be slow for the next 2 or 3 weeks. cheers SparkPlug - Rails inspired Scaffolding - El Forum - 02-11-2008 [eluser]Sean Downey[/eluser] Sent that now. Thanks |