repres-bootstrap 1.7 → 1.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cda580abee7f81a8bc5995939640f43bce38c743
|
4
|
+
data.tar.gz: 58e7b3eaecaf2e8be6436554c517f09961b5cce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 316ca9a8e8b45bc4737d1d9824411e27ad7bce25c45c64c55ae22cbbce4ecd81b3829af7671642d704733f2ce3c01bd8ae38b77cccdc4bdf3ef3b170dbd34ffd
|
7
|
+
data.tar.gz: 2ab07cf60765438c8b49467777a399f83666a7c8a601e2b57cfa162ebab6cea59a7cb2a5c48bbbd7bd1c0c927ca142dea784057663dfe4fb39dae13a443439cf
|
data/README.md
CHANGED
@@ -192,6 +192,44 @@ The Form Select Box partial includes the HTML select tags for Rails Form Builder
|
|
192
192
|
<%= bootstrap_form_select_box model: model, form: f, name: :country_id, choices: @countries.select('id, name').map { |country| [ country.name, country.id ] }, options: { prompt: '请选择国家' } %>
|
193
193
|
```
|
194
194
|
|
195
|
+
### Render the Form Check Box
|
196
|
+
|
197
|
+
The Form Check Box partial includes the HTML select tags for Rails Form Builder and Bootstrap.
|
198
|
+
```ruby
|
199
|
+
<%= render partial: 'repres/bootstrap/form_check_box',
|
200
|
+
locals: {
|
201
|
+
options: {
|
202
|
+
model: model,
|
203
|
+
form: f,
|
204
|
+
name: :country_id,
|
205
|
+
choices: @countries.select('id, name').map { |country| [ country.name, country.id ] },
|
206
|
+
options: {}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
%>
|
210
|
+
<!-- or the following line works identically -->
|
211
|
+
<%= bootstrap_form_check_box model: model, form: f, name: :country_id, choices: @countries.select('id, name').map { |country| [ country.name, country.id ] }, options: {} %>
|
212
|
+
```
|
213
|
+
|
214
|
+
### Render the Form Radio Box
|
215
|
+
|
216
|
+
The Form Check Box partial includes the HTML select tags for Rails Form Builder and Bootstrap.
|
217
|
+
```ruby
|
218
|
+
<%= render partial: 'repres/bootstrap/form_radio_box',
|
219
|
+
locals: {
|
220
|
+
options: {
|
221
|
+
model: model,
|
222
|
+
form: f,
|
223
|
+
name: :country_id,
|
224
|
+
choices: @countries.select('id, name').map { |country| [ country.name, country.id ] },
|
225
|
+
options: {}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
%>
|
229
|
+
<!-- or the following line works identically -->
|
230
|
+
<%= bootstrap_form_radio_box model: model, form: f, name: :country_id, choices: @countries.select('id, name').map { |country| [ country.name, country.id ] }, options: {} %>
|
231
|
+
```
|
232
|
+
|
195
233
|
The 4 options are required: model, form, name, and type.
|
196
234
|
Here are more options:
|
197
235
|
- label_text: The customized label text.
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Repres::Bootstrap::ApplicationHelper
|
2
2
|
|
3
|
-
#extend Repres::Bootstrap::FormHelper
|
4
|
-
|
5
3
|
def bootstrap_form_field(options = {})
|
6
4
|
warn 'Repres::Bootstrap::ApplicationHelper#bootstrap_form_field is deprecated and will be removed in the future, please use Repres::Bootstrap::FormHelper#bootstrap_form_field instead.'
|
7
5
|
#super options
|
@@ -8,4 +8,12 @@ module Repres::Bootstrap::FormHelper
|
|
8
8
|
render partial: 'repres/bootstrap/form_select_box', locals: { options: options }
|
9
9
|
end
|
10
10
|
|
11
|
+
def bootstrap_form_check_box(options = {})
|
12
|
+
render partial: 'repres/bootstrap/form_check_box', locals: { options: options }
|
13
|
+
end
|
14
|
+
|
15
|
+
def bootstrap_form_radio_box(options = {})
|
16
|
+
render partial: 'repres/bootstrap/form_radio_box', locals: { options: options }
|
17
|
+
end
|
18
|
+
|
11
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repres-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|