Form helper changes to automatically translate the disable-with option

12 views
Skip to first unread message

Mark Edmondson

unread,
Jun 12, 2019, 4:32:22 PM6/12/19
to Ruby on Rails: Core
In much the same way the submit button is automatically translated to "Create %{model}" and "Update %{model}", (where model is translated through the traditional activerecord model name translation keys) it should be possible to translate the disable-with value for specific models, with an obvious default.

Currently, the default disable-with value uses that from the button so a user sees no text change other than the button becoming disabled.

I'm proposing a change to set default translations as:

en:
  helpers
:
    disable_with
:
      create
: Creating %{model}
      update
: Updating %{model}


which can be overwritten with:


en
:
  helpers
:
    disable_with
:
      blog
/post:
        create
: Creating your %{model}


And the FormHelper#submit method changing to support this.

Thoughts? Opinions?
Reply all
Reply to author
Forward
0 new messages