simple_form_extensions 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -19,6 +19,40 @@ bundle install
|
|
19
19
|
|
20
20
|
## Getting Started
|
21
21
|
|
22
|
+
|
23
|
+
### Input checkbox
|
24
|
+
|
25
|
+
For `inline_checkbox`:
|
26
|
+
|
27
|
+
```
|
28
|
+
<%= simple_form_for @user, :html => { :class => 'form-horizontal' } do |f| %>
|
29
|
+
<%= f.input :remember_me, wrapper: :inline_checkbox %>
|
30
|
+
<% end %>
|
31
|
+
```
|
32
|
+
|
33
|
+
This generate the following markup:
|
34
|
+
|
35
|
+
```
|
36
|
+
<form class="simple_form form-horizontal">
|
37
|
+
<div class="control-group">
|
38
|
+
<div class="controls">
|
39
|
+
<div class="pull-left">
|
40
|
+
<input name="user[remember_me]" type="hidden" value="0">
|
41
|
+
<label class="checkbox">
|
42
|
+
<input id="user_remember_me" name="user[remember_me]" type="checkbox" value="1">
|
43
|
+
</label>
|
44
|
+
</div>
|
45
|
+
Remember me
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</form>
|
49
|
+
```
|
50
|
+
|
51
|
+
And the result:
|
52
|
+
|
53
|
+
![Inline checkbox 1](https://bitbucket.org/mespina/simple_form_extensions/raw/master/app/assets/images/simple_form_extensions/inline_checkbox.png)
|
54
|
+
|
55
|
+
|
22
56
|
### Appending
|
23
57
|
|
24
58
|
For `append` value into input:
|
Binary file
|
@@ -42,4 +42,16 @@ SimpleForm.setup do |config|
|
|
42
42
|
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
config.wrappers :inline_checkbox, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
|
47
|
+
b.use :html5
|
48
|
+
b.use :placeholder
|
49
|
+
b.wrapper :tag => 'div', :class => 'controls' do |ba|
|
50
|
+
ba.use :input, class: 'pull-left'
|
51
|
+
ba.use :label_text
|
52
|
+
|
53
|
+
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
54
|
+
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
55
|
+
end
|
56
|
+
end
|
45
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -36,6 +36,7 @@ extra_rdoc_files: []
|
|
36
36
|
files:
|
37
37
|
- app/assets/images/simple_form_extensions/append_1.png
|
38
38
|
- app/assets/images/simple_form_extensions/append_2.png
|
39
|
+
- app/assets/images/simple_form_extensions/inline_checkbox.png
|
39
40
|
- app/assets/images/simple_form_extensions/prepend_1.png
|
40
41
|
- app/assets/images/simple_form_extensions/prepend_2.png
|
41
42
|
- app/assets/images/simple_form_extensions/prepend_append_1.png
|