lonnieezell / Bonfire

Jumpstart your CodeIgniter web applications with a modular, HMVC-ready, backend.
http://cibonfire.com
1.39k stars 524 forks source link

Front-end framework/form library support #879

Open mwhitneysdsu opened 11 years ago

mwhitneysdsu commented 11 years ago

One item I've given some consideration is a library similar to (or extending) the form library with "driver" support for different frameworks (I don't want to lock myself into CodeIgniter's drivers here, it's just the easiest way for me to explain the idea at the moment). I would love to be able to use a library to generate framework-compatible (and 508/accessible) HTML without feeling that I'm locked into whatever framework Bonfire is currently using (or knowing that I could move to another front-end framework by writing some code to support the framework and have my existing pages just work when I change the library configuration and pull in the files required for the framework).

While the idea of adapting my existing code to use a library is daunting (because I don't even use the existing form library often), it's not nearly as bad as the thought of going through this list http://getbootstrap.com/getting-started/#migration for every page/form on the site, or the thought of continuing to write 2.x markup that will have to be changed when I do move to 3.

I guess I am primarily interested in whether this is something that would interest others or even if someone has already started work on something like this.

ragingdave commented 11 years ago

This would be great! I suppose something similar to the way that CI handles the alert errors, is what your thinking. I did something similar on another project that generated a form a variety of ways(table, list, etc) although it was not in CI/bonfire. I'll see if I can round up the code from that, would love to be involved.

jbalatero commented 9 years ago

Hello @mwhitneysdsu, this seems a very good idea. Have you started this yet? I would love to.

mwhitneysdsu commented 9 years ago

I have made various attempts at starting this, but I don't have any code which I have actually considered worth using (even privately), at this point. Given that Bootstrap 4 is on the way, something which at least makes it simple to move between versions of Bootstrap would be very useful.

lonnieezell commented 9 years ago

I attempted this - but didn't quite get as thorough as I would like - in Sprint. It might be a good starting point if we wanted to port...and probably do some more additions to the UIKit concepts.

https://github.com/ci-bonfire/Sprint/blob/develop/myth/_docs_src/general/uikits.md

jbalatero commented 9 years ago

@lonnieezell What do you mean by "but didn't quite get as thorough as I would like"? Have you implemented the driver-like design for this? Like I can extend a base class to support any framework I like.

lonnieezell commented 9 years ago

@JbalTero Yes, it's a driver-like design. You can see the files themselves (for Bootstrap 3 and Foundation 5) over here: https://github.com/ci-bonfire/Sprint/tree/develop/myth/UIKits

When I said that I "didn't quite get as thorough as I would like", I meant that only a limited set of standard UI components are there. Only what you see in that docs file, which was mostly limited to grid, basic nav items, buttons, and notices/alerts. Granted, that covers a pretty large chunk of common elements, but there are more that should be supported that aren't currently.

jbalatero commented 9 years ago

Well that is a very good start. And it's actually the kind bonfire needs for front-end flexibility. Though I don't think it's easy to implement.

lonnieezell commented 9 years ago

No, it's not the most pleasant to work with :)

I think ideally it would be part of a template engine, or would supplant the parser in CI to add tags for these sorts of things. But that would take a bit of work. Though would be nice to see CI's parser support custom tags... might be something I'll have to look at in v4.

mwhitneysdsu commented 9 years ago

At one point, I was thinking that it would be nice to have something similar to ASP.Net Web Server Controls. It's essentially a combination of a template engine and a set of standard controls (I believe the original design for Web Server Controls was to make it easy to port non-web-based client software to ASP.Net, or at least to make developing both types of applications similar in some ways). The main thing I like about ASP.Net's equivalent of a template engine, though, is that they use HTML with specific attributes (which are not standard HTML attributes, like runat="server") to specify that a control is generated by the server, or HTML/XML-like elements to define Web Server Controls (usually something like <asp:button runat="server" id="Button1" />), which the server may replace with larger blocks of HTML which may vary based on the site's template/theme and the destination browser.