loadsys / CakePHP-Skeleton

Base CakePHP 3.x and 2.x project skeletons for new projects.
10 stars 1 forks source link

Add a BoostrapFormHelper #45

Open beporter opened 9 years ago

beporter commented 9 years ago

The current bake templates mostly output Bootstrap styled code by default. One area that is weak are generated <forms> for add/edit. The current templates were taken from ABUS, which used the BoostCake helpers to auto-inject Bootstrap-specific settings into calls to Form->create(), Form-->input(), etc. We need something similar, but without the huge bloated, regex-powered BoostCake stuff.

I started some work on this a long time ago in what is currently View/Helper/TwitterBootstrapHelper.php. This is kind of a mixup of HtmlHelper and FormHelper currently. There are probably some base functions like _buttonOptions() that could be placed in a central class, and then break out the assistance methods for overriding Form->create() or Html->getCrumbs()` into respective BootstrapFormHelper and BootstrapHtmlHelper classes like in Joey's loadsys/twitter-bootstrap-helper and BoostCake, but much lighter in weight and tuned for BT3 (with no regex either).

We don't need to go for full Bootstrap feature completeness, just enough to set proper default TB3 styles for Cake's built-in helper methods and really just our bake templates (which means Form->create, input, end, button and the input subtypes like radio, checkbox, select).

ricog commented 9 years ago

I wanted to point out that we are exploring the Foundation framework for our first 3.x project. It doesn't mean this shouldn't be added in the 3.x branch, but that considerations should be made to be frontend framework agnostic.

beporter commented 9 years ago

Yeah, it's a good conversation to add. I just recently made the 2.x skeleton almost entirely Bootstrapped out of the box. The bake templates and default layouts now produce an operational Bootstrap themed app. (checkboxes and radio buttons being a notable issue still.)

I honestly don't care what we use for 3.x, but I do lean towards bootstrap for a couple reasons:

Whatever we decide, I definitely think there's value in our skeleton providing us with the tools to bake an admin portal (at least-- maybe also a usable frontend) that is presentable to clients as-is. A significant step up from the core's bake skeleton templates.

ricog commented 9 years ago

I'm still figuring things out, but my understanding is that Cake3 uses Foundation (probably in the bake scripts) and Andrew (our best UI person I would bet) prefers it for a number of reasons. I actually know Bootstrap better myself, but am inclined to listen to the guy with the most knowledge of Cake3 and the frontend framework choices.

The main goal in any case should be whatever gives us the best results in the least amount of work. Also, we don't want to be forced to choose one over the other if we have good reason to switch.

On Wed, Jan 28, 2015 at 1:23 PM, Brian Porter notifications@github.com wrote:

Yeah, it's a good conversation to add. I just recently made the 2.x skeleton almost entirely Bootstrapped out of the box. The bake templates and default layouts now produce an operational Bootstrap themed app. (checkboxes and radio buttons being a notable issue still.)

I honestly don't care what we use for 3.x, but I do lean towards bootstrap for a couple reasons:

  • We all are already pretty familiar with it.
  • There's some good tooling.
  • We can re-use a lot of the existing 2.x bake skeletons without much work.
  • It keeps things pretty uniform over time. Our existing app and our new apps will continue to function similarly in terms of admin portals and such. Our clients won't care because they don't use each other's apps, but it makes it a bit easier for us (in particular the PMs.)

Whatever we decide, I definitely think there's value in our skeleton providing us with the tools to bake an admin portal (at least-- maybe also a usable frontend) that is presentable to clients as-is. A significant step up from the core's bake skeleton templates.

— Reply to this email directly or view it on GitHub https://github.com/loadsys/CakePHP-Skeleton/issues/45#issuecomment-71897859 .

Rick Guyer Project Manager Loadsys Consulting Inc. Email: rick@loadsys.com

beporter commented 9 years ago

I think the point of the skeleton though is twofold:

  1. On the front end, it needs to look "good enough" (better than Cake stock) for prototyping greenfield apps, but it will definitely get replaced with a "real" design at some point. On this front, the only thing that matters is our devs' ability to prototype additional features into the baked views until the real design is in place. Right now, all of us are comfortable with Bootstrap. (inertia, yes, I admit.)
  2. On the admin side, the design will likely never get replaced with a "real" design. I'm having a hard time seeing why switching to Foundation would be a benefit here. The least amount of work sure feels like Bootstrap to me and the results are consistent enough that we have 3 production apps in the wild with bootstrap admin portals from the past year.

Is there a "vanilla" baked 3.0 app up somewhere I can look at so I can educate myself more? I've tried to browse the Foundation docs to familiarize myself, but they suck compared to Bootstrap's. (Another turn off?)

I'm open to the idea of switching, but I need a lot more help to see the advantages.