1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
Commit graph

20 commits

Author SHA1 Message Date
Timur Vafin
f62371525d Try convert @object to model in case we got decorated object 2017-12-20 15:09:58 +03: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
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
Rafael Mendonça França
ad9bf4b9aa Move tests to the right place and add missing case 2014-06-23 16:10:00 -03:00
Ian Vaughan
21d03ff583 Only output the wrapper if the block yields content
This change allows the wrappers to not output their rendered HTML when
when the block yields no content.

e.g. when defining an optional component :

  ba.wrapper tag: :div, class: 'form-helper -message -hint' do |bb|
    bb.optional :hint, wrap_with: { tag: :p }
  end

and that component is not used in a template :

  <%= form.input :name %>

Then the HTML output still contains the wrapper output :

  <div class="form-helper -message -help"></div>

If this behaviour is not desired, then the output of the empty tags can
be disabled via the `remove_empty` option.

  ba.wrapper tag: :div, class: 'form-helper -message -hint', remove_empty: true do |bb|
    bb.optional :hint, wrap_with: { tag: :p }
  end

The above config will not output any wrapper HTML.
2014-05-29 10:25:16 +01:00
John Voloski
3bff1fa5a1 improve form_builder's tests description and remove 'should' 2014-05-14 14:18:43 -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
1c6ca9e1f7 Stylistic improvements 2013-04-13 19:52:01 -03:00
Renato Mascarenhas
34312c9fbc Use 1.9 hash style on code and docs. 2013-01-28 19:02:59 -02:00
Rafael Mendonça França
4891aaa4a2 Whitespaces ✂️ 2012-06-26 22:58:27 -03:00
Tom Stone
ccdcde855b Hints are assumed html_safe 2012-03-07 13:44:56 +00:00
Carlos Antonio da Silva
ea07f65fd5 Ensure labels generate clean html. Closes #466 2012-02-22 08:34:02 -02:00
Rafael Mendonça França
f4a1ac6f83 FormBuilder methods should not modify the options hash
Closes #463
2012-02-21 01:42:06 -02:00
José Valim
b9a568d149 Ensure wrap_with without a tag works. 2012-02-18 15:47:02 +01:00
Ram Dobson
b4a32f3664 move default attribute translations out of root
(#384)

- move simpleform.label.username to simpleform.label.defaults.username
- update README
- allow lookup of reflections on simpleform.label.defaults

Conflicts:

	lib/simple_form/inputs/base.rb
	test/components/label_test.rb
	test/form_builder/hint_test.rb
2011-12-10 16:50:03 -05:00
José Valim
259640e4cb Fix ambiguity in i18n lookup, closes #384. 2011-12-08 09:44:08 +01:00
Marcelo Cajueiro
bfe2314901 Add test case to hint (i18n): a model should not be used as attribute in a hint; 2011-11-26 19:34:53 +03:00
José Valim
bf4d766fcb config.components => config.wrappers 2011-09-08 16:04:37 +02:00
José Valim
f93a6be226 Add tests for custom wrappers. 2011-09-08 16:04:36 +02:00
José Valim
3ee59b5d0d Break form builder test into smaller files. 2011-09-08 16:04:36 +02:00