Commit Graph

23 Commits

Author SHA1 Message Date
Dillon Welch cac943e891 Add frozen_string_literal in all .rb files
I noticed these files all had strings such as "", "  ", "_" that were
allocated each time some common methods were called, over 1000x on a
page in my app. This comment freezes all of these strings such that
they're only allocated once, saving many KB of memory allocation.
2017-11-27 17:06:18 -08:00
Lauro Caetano 63fb9a2773 Change the translation mechanism to use
`ActionView::Helpers::TranslationHelper`.

It has some advantages over only using `I18n.t`, such as the safe
translation if the key has the suffix `_html`.
2014-04-04 14:51:21 -03:00
Rafael Mendonça França 86d0923ddc Forgot to send some files 💣 2014-03-11 19:53:29 -03:00
Rafael Mendonça França e9384fb4bd Whitespaces 2014-03-11 19:13:59 -03:00
Rafael Mendonça França 645988a855 Pass the context when rendering the component 2014-03-10 18:41:36 -03:00
Rafael Mendonça França 5335e42f76 Make sure hint text is escaped if it is not safe
Signed-off-by: Rafael Mendonça França <rafaelmfranca@gmail.com>
2013-11-29 13:35:24 -02:00
Carlos Antonio da Silva 645dd5257d Do not lookup for hints if it was explicitly given false
After #405 we added hint classes for the wrappers, but this has forced the
loading of the hint text doing I18n lookups, even though it was explicitly
given false. This checks for the option in #has_hint?, avoiding the lookup
in such cases.

This issues has been caught after #627 and some further investigation,
thanks to @shwoodard.
2012-10-26 01:50:01 -02:00
Tom Stone 739f4da2c1 Refactored html support for hints 2012-03-07 13:59:35 +00:00
Tom Stone ccdcde855b Hints are assumed html_safe 2012-03-07 13:44:56 +00:00
José Valim 0fabc1b859 Allow inputs to be marked as optional.
This means they won't do any lookup unless explicitly told to.
2012-01-11 21:14:31 +01:00
Carlos Antonio da Silva d719e47c18 Use similar api for hints and errors, and cache hint to avoid double lookup 2012-01-10 19:00:14 -02:00
Carlos Antonio da Silva 2df1aa6c0c Cleanup: no need to call presence, as the translate helper already does it 2011-12-10 15:56:47 -02:00
José Valim 50b24b5cbe Deprecate translate in favor of disabling the automatic lookup in hints and placeholders. 2011-12-04 15:49:57 +01:00
José Valim e8749ae07e Add class default options to avoid has_*? checks. 2011-12-04 13:29:59 +01:00
José Valim 6bf59dd508 Get rid of the enabled/disabled in favor of has_*? syntax. 2011-12-04 12:29:53 +01:00
José Valim f6d4ef7928 Use alias. 2011-09-08 16:04:37 +02:00
José Valim 3ee59b5d0d Break form builder test into smaller files. 2011-09-08 16:04:36 +02:00
José Valim 98d7c6f627 Move hint to new wrappers API. 2011-09-08 16:03:26 +02:00
José Valim f50e5bdaea Provide enable/disable API. 2011-09-03 12:55:53 +02:00
Johan Buts 7480184056 Added hint class as a configuration option on setup 2010-11-07 17:00:49 +08:00
Jonathan Hicks 22d05e65ab Adding a placeholder option to the string input and have it use
i18n translation, when possible.
2010-09-24 11:32:58 +08:00
José Valim 1ef232cf6d Numberic type inputs now have type=number for HTML5. 2010-06-01 23:40:12 +02:00
José Valim 7d7c6cda72 Code refactoring finished. Now tests one. 2010-01-09 16:05:02 +01:00