From: Chad K. <ch...@2t...> - 2013-04-27 14:47:59
|
I was thinking in the context of REST. Yes, makes sense. On Apr 27, 2013, at 5:20 AM, Shad Laws <sh...@sh...> wrote: > I haven't dug too deeply into this piece of the puzzle yet, but my initial thought is to still leave these as two separate action routes. This seems to mirror what we use in many other places, where each of the CRUD functions has an independent route, which maps pretty easily to ORM, SQL, REST, etc. functions. Seem reasonable? > > Shad > > > On 26 April 2013 20:39, Chad Kieffer <ch...@2t...> wrote: >> +1 from me, too. For clarity, will separate action routes be kept or will add/edit be replaced with something like save? >> >> On Apr 24, 2013, at 10:42 AM, Bharat Mediratta <bh...@me...> wrote: >> >>> >>> Fantastic. I never liked the way we had this split up before so it's nice to see that Formo can streamline it for us. >>> >>> I've also never been happy with our form/{add,edit}/ routing - that was a framework put in place before it was clear what the true need would be and it's only used in 9 places. I'd be happy to see that routing go away and let each controller do it in a more ad hoc approach. Take a look at that while you're in there and let me know what you think. >>> >>> -Bharat >>> >>> >>> On Wed, Apr 24, 2013 at 1:13 AM, Shad Laws <sh...@sh...> wrote: >>>> Hey everyone, >>>> >>>> I'm working on getting acquainted with Formo a bit more, and it seems like the default, expected actions of Formo is a bit different than how we were using Forge in Gallery 3.0.x. >>>> >>>> Before, we usually (but not always) had a separate controller action for showing a form vs. validating a form (e.g. action_edit() and action_save()). Also, it was common to have a third function generate the form for us, so we ended handling the form in three places. >>>> >>>> It seems that the default, expected behavior of Formo is to do this in one place with one action. It's smart enough to figure out if we have post data or not, and therefore if we are in "edit" or "save" mode (following the example). An example: >>>> >>>> public function action_edit() { >>>> $form = Formo::form(...) >>>> ->....; // build form, load with default values. >>>> >>>> if ($form->load()->validate()) { >>>> // load() gets the values from post/files and fills the values, >>>> // then validate() checks stuff and does nothing if the form isn't >>>> // yet sent (nothing loaded) or adds errors if it was. >>>> >>>> // Do some more stuff... then: >>>> Message::success(t("Done!")); >>>> // And/or: >>>> $this->redirect("somewhere/else"); >>>> } >>>> >>>> $view = .....; >>>> $view->form = $form; >>>> >>>> $this->response->body($view); >>>> } >>>> >>>> I can overload a couple Formo classes to ensure that each form contains and validates our csrf, similar to what we did with Forge. >>>> >>>> Does this seem like a reasonable approach? Is there some other reason why we intentionally divided these up into multiple actions before? >>>> >>>> Take care, >>>> Shad >>>> >>>> ------------------------------------------------------------------------------ >>>> Try New Relic Now & We'll Send You this Cool Shirt >>>> New Relic is the only SaaS-based application performance monitoring service >>>> that delivers powerful full stack analytics. Optimize and monitor your >>>> browser, app, & servers with just a few lines of code. Try New Relic >>>> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >>>> __[ g a l l e r y - d e v e l ]_________________________ >>>> >>>> [ list info/archive --> http://gallery.sf.net/lists.php ] >>>> [ gallery info/FAQ/download --> http://gallery.sf.net ] >>> >>> ------------------------------------------------------------------------------ >>> Try New Relic Now & We'll Send You this Cool Shirt >>> New Relic is the only SaaS-based application performance monitoring service >>> that delivers powerful full stack analytics. Optimize and monitor your >>> browser, app, & servers with just a few lines of code. Try New Relic >>> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >>> __[ g a l l e r y - d e v e l ]_________________________ >>> >>> [ list info/archive --> http://gallery.sf.net/lists.php ] >>> [ gallery info/FAQ/download --> http://gallery.sf.net ] > |