Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[Patch] Model name for default submit button value should be titleized

#6188

When a model name is more than one word, ex: Ticket Type, when using f.submit, the text of the submit button does not capitalize each word of the model. The text appears as Create Ticket type.

Attached is a patch to titleize the model name so that the text appears as Create Ticket Type.

Reported by Ben Mills · December 18th, 2010 @ 02:24 AM

State: new
Milestone: none
Assigned to: Ryan Bigg Ryan Bigg
Importance: Low

Activity

  1. Ben Mills
    Ben Mills
    • No changes were found…

    December 18th, 2010 @ 02:26 AM

  2. Johnneylee Jack Rollins
    Johnneylee Jack Rollins

    +1 Makes a good bunch of sense to me.

    December 18th, 2010 @ 02:35 AM

  3. Ben Mills
    Ben Mills

    Updated the patch to just titleize model regardless of what the conditions returns

    December 18th, 2010 @ 02:39 AM

  4. Ryan Bigg
    Ryan Bigg
    • Importance changed from to Low

    please attach tests to this patch

    December 18th, 2010 @ 03:06 AM

  5. Ben Mills
    Ben Mills

    Updated patch to provide a test

    December 18th, 2010 @ 05:26 AM

  6. Ben Mills
  7. Samuel Kadolph
    Samuel Kadolph

    Patch seems logical. However it is currently possible to fix this with localization.

    en:
      activerecord:
        models:
          ticket_type: Ticket Type
    

    December 19th, 2010 @ 07:04 AM

  8. Piotr Sarnacki
    Piotr Sarnacki

    Samuel: Yes, but this patch is about sensible default.

    I would rather say that it should be "Create ticket type" instead of "Create Ticket Type" or "Create Ticket type". Is "titleize" the convention in other places in forms?

    December 19th, 2010 @ 09:38 AM

  9. esparkman
    esparkman

    +1 this makes sense to me as well.

    December 31st, 2010 @ 12:10 AM

  10. salbito
    salbito

    +1 aswell Makes sense as a default avoids having to do this in localization files for every instance of this situation.

    January 1st, 2011 @ 09:18 PM

  11. Ben Mills
    Ben Mills

    Can we get this merged in, please?

    February 8th, 2011 @ 10:40 PM

  12. Dan Pickett
    Dan Pickett
    • Title changed from Model name for default submit button value should be titleized to [Patch] Model name for default submit button value should be titleized
    • Tag changed from actionview, action_view, formbuilder, submit to actionview, action_view, formbuilder, patch, submit

    +1 this is a much better default.

    one of the patch's tests fails on master due to dropping the id on submit inputs in form_for

    I've patched the regression and Ben's original authorship should be maintained.

    February 9th, 2011 @ 01:34 AM