Commit Graph

30 Commits

Author SHA1 Message Date
Felipe Renan 87ad6f7636 Use form attribute in the boolean nested hidden field
Fixes https://github.com/plataformatec/simple_form/issues/1545
2018-10-06 00:19:51 -03:00
Fabian Schwahn dfcd041b22 Exclude hidden field when unchecked_value: false
Rails does not generate a hidden field for checkboxes if
`unchecked_value` is false. The nested boolean creates its own hidden
field and ignores this rule from rails. That means that the hidden
field is generated for a falsey value when using the nested style, but
not when using the inline style.

This commit fixes this problem by making the nested style behave like
the inline style, adhering to the standard set by rails.

Resolves: #1320
2017-12-07 14:03:42 +01:00
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
Adam Becker 91b779594b specify :boolean_label_class on a per-input basis 2016-08-14 16:11:16 -07:00
capripot c2dd12c0e4 Add `hidden_input` option to checkbox
Give the possibility to skip the creation of the hidden input field
normally created along with checkox field,
replicating [Rails 4.2 behavior](https://github.com/rails/rails/blob/4-2-stable/actionview/lib/action_view/helpers/tags/check_box.rb#L28)
2016-04-15 18:13:31 -04:00
Rafael Mendonça França ee62c0f37a Merge pull request #1143 from obfuscoder/master
Fix wrapper options support for boolean input types
2014-11-19 18:57:03 -02:00
Rafael Mendonça França 914b58cb9d Assert the absent of tags not the escaped text
Nokogiri doesn't escape the output
2014-11-17 17:27:13 -02:00
Obfuscoder c39fc0aec0 Fix wrapper options support for boolean types 2014-10-13 15:24:17 +02:00
Rafael Mendonça França 6db5143488 inline_label disable label on nested boolean inputs 2014-06-17 15:48:26 -03:00
John Voloski e878330f28 improve inputs's tests description and remove 'should' 2014-05-14 14:19:06 -03:00
Rafael Mendonça França f451282bd5 Inline label can contain HTML safe text
Fixes #1032
2014-04-14 11:25:19 -03:00
Rafael Mendonça França 70fee33b50 Put a whitespace before the inline_label if it is present 2014-03-28 18:36:35 -03:00
Rafael Mendonça França 81516dc4a8 Add boolean_label_class config
This config is to make possible to change the class of the label that
wrap the input in a boolean input.

Before this change we always use 'checkbox'. Now the default is still
'checkbox' but it can set to nil
2014-03-12 17:09:02 -03:00
Vasiliy Ermolovich fbaddffd89 input without additional classes should add "checkbox" class to label
closes #809
2013-06-29 14:09:36 +03:00
Renato Mascarenhas 34312c9fbc Use 1.9 hash style on code and docs. 2013-01-28 19:02:59 -02:00
Vasiliy Ermolovich 9503f8e6a4 add ability to specify checked and uncked values for boolean input
closes #643
2012-09-04 22:28:58 +03:00
Amiel Martin a094034926 Boolean hidden field uses name when :nested
Closes #619
2012-07-13 09:47:17 -08:00
Gray Manley 0c017e9efb If inline_label opt is true use default label text
Have the inline label text be set to the default
label text if the inline_label config is true.
2012-04-30 00:34:40 -05:00
Rafael Mendonça França 10592d36bf Fix CHANGELOG 2012-03-02 12:11:06 -03:00
Eric Hochberger a1d8a72712 changelog and test 2012-03-01 10:35:36 -05:00
Timur Vafin 8f800a72d0 Add extra "checkbox" class to label with nested style enabled using :label_input in wrapper config 2012-02-04 01:58:06 +04:00
Carlos Antonio da Silva 9bea76bfb9 Make sure disabled boolean input will generate a disabled hidden as well 2012-01-30 16:46:38 -02:00
Carlos Antonio da Silva fb0360d50a Make boolean input tag generate valid html5 when using nested style
This keeps Rails functionality by adding the required hidden checkbox
which will send an "unchecked value" when checkbox is not checked.
2012-01-30 16:46:37 -02:00
Carlos Antonio da Silva 12850f848e Fix boolean nested style bootstrap integration 2012-01-30 11:18:31 -02:00
Carlos Antonio da Silva 51a816e904 Generate label with text and options for boolean nested 2012-01-27 09:32:19 -02:00
Carlos Antonio da Silva 1b2a4b043d Fix nested style check for options hash 2012-01-26 15:44:13 -02:00
Carlos Antonio da Silva a6c5d8f1d6 Rename checkbox_style to boolean_style to make it more generic 2012-01-26 15:37:41 -02:00
Carlos Antonio da Silva 32952b9132 Add checkbox_style config, to opt for :inline or :nested 2012-01-26 11:30:08 -02:00
Carlos Antonio da Silva 961f5f577e Strip extra spaces from class html attribute 2012-01-26 10:58:34 -02:00
José Valim cc72315703 Break inputs_test.rb into many files as well. 2011-09-08 16:04:36 +02:00