repres-bootstrap 1.0.3 → 1.1

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: 84c577a93db306d094856b1789d9f4037a1962ac
4
- data.tar.gz: 1bc771cc7b90da989a224fa34d9f47a220f087d8
3
+ metadata.gz: 009f026957d47d559302d2f8808d85247d581af4
4
+ data.tar.gz: 69e13e0bafc68b16dd7d16f6b74fa9ebdd83efd3
5
5
  SHA512:
6
- metadata.gz: b8d0b7c3e9c7274e16844ffb61c4feebc1ab56a86213f756321dcab25467a4249e89edc577be2f02b02e3b9355b3a9098a352949c098e84eee900dee31ea2f1c
7
- data.tar.gz: 3adc7b1a81c41c880fdcbb2ffa1699c6be96424eb4047c6912f4397ec9db8a3a57b7267057a2ee19f64a7417efdf6487212cbb1c66f17a33b2fe6d251b231076
6
+ metadata.gz: 262509153624c6369b6bb388677222c1d46dd261b6367ea30fa53986b7d62319046ab293add1c0b671ba8c38936bbec28c814013e4d2b9ed613a91741a264c21
7
+ data.tar.gz: c9a78694fe944c60338f260e75df372d2c19dfd31d67124c87dbba4521a0e6f709e0dc79c1f1b6bcb10d2f0c18edda8946193579662a3925a066f358ca0a0edc
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
4
  [![Gem Version](https://badge.fury.io/rb/repres-bootstrap.svg)](https://badge.fury.io/rb/repres-bootstrap)
5
5
 
6
- Repres (REsource REPResentation) is a series of resource presentation engines. The Bootstrap resource presentation engine includes Bootstrap-based resource presentation templates & snippets.
6
+ Repres (REsource PRESentation) is a series of resource presentation engines. The Bootstrap resource presentation engine includes Bootstrap-based resource presentation templates & snippets.
7
7
  Repres (资源表现)是一系列的资源表现引擎。Bootstrap 资源表现引擎包括基于Bootstrap的资源表现模版和片段。
8
8
 
9
9
 
@@ -21,22 +21,42 @@ gem 'repres-bootstrap'
21
21
 
22
22
 
23
23
 
24
+ ## Include the Helper in your Application Controller before Render the Style or Script with the helper methods
25
+ ```ruby
26
+ include Repres::Bootstrap::ApplicationHelper
27
+ ```
28
+
29
+
30
+
24
31
  ## Render the Pre-defined Partials
25
32
  ```erb
26
33
  <html>
27
34
 
28
35
  <head>
29
36
  <%= render partial: 'repres/bootstrap/style', locals: { options: { bootstrap: true } } %>
37
+ <!-- or the following line works identically -->
38
+ <%= bootstrap_style bootstrap: true %>
30
39
  </head>
31
40
 
32
41
  <body>
33
42
  <div class='container'>
34
43
  <%= form_for @person do |f| %>
44
+
35
45
  <%= render partial: 'repres/bootstrap/form_field', locals: { options: { model: model, form: f, name: :phone_number, type: :telephone_field } } %>
46
+ <!-- or the following line works identically -->
47
+ <%= bootstrap_form_field model: model, form: f, name: :phone_number, type: :telephone_field %>
48
+
36
49
  <%= render partial: 'repres/bootstrap/form_select_box', locals: { options: { model: model, form: f, name: :gender, choices: { 'Male' => '1', 'Female' => '2' }, options: { include_blank: 'Please Select...' } } } %>
50
+ <!-- or the following line works identically -->
51
+ <%= bootstrap_form_select_box model: model, form: f, name: :gender, choices: { 'Male' => '1', 'Female' => '2' }, options: { include_blank: 'Please Select...' } %>
52
+
37
53
  <% end %>
38
54
  </div>
55
+
39
56
  <%= render partial: 'repres/bootstrap/script', locals: { options: { bootstrap: true } } %>
57
+ <!-- or the following line works identically -->
58
+ <%= bootstrap_script bootstrap: true %>
59
+
40
60
  </body>
41
61
 
42
62
  </html>
@@ -50,17 +70,23 @@ The Script partial includes the HTML script tags for Bootstrap and its extension
50
70
  The following code snippet does __not__ load any JavaScript library.
51
71
  ```erb
52
72
  <%= render partial: 'repres/bootstrap/script' %>
73
+ <!-- or the following line works identically -->
74
+ <%= bootstrap_script %>
53
75
  ```
54
76
 
55
77
  The following code snippet loads the latest Bootstrap JavaScript library.
56
78
  ```erb
57
79
  <%= render partial: 'repres/bootstrap/script', locals: { options: { bootstrap: true } } %>
80
+ <!-- or the following line works identically -->
81
+ <%= bootstrap_script bootstrap: true %>
58
82
  ```
59
83
 
60
84
  The following code snippet loads the Bootstrap JavaScript library with the given version.
61
85
  ```erb
62
86
  <%= render partial: 'repres/bootstrap/script', locals: { options: { bootstrap: { version: '3.3.5' } } }
63
87
  %>
88
+ <!-- or the following line works identically -->
89
+ <%= bootstrap_script bootstrap: { version: '3.3.5' } %>
64
90
  ```
65
91
 
66
92
  The following JavaScript libraries are switchable, and the version can be configurable:
@@ -78,16 +104,22 @@ The Style partial includes the HTML style tags for Bootstrap and its extensions.
78
104
  The following code snippet does __not__ load any CSS library.
79
105
  ```erb
80
106
  <%= render partial: 'repres/bootstrap/style' %>
107
+ <!-- or the following line works identically -->
108
+ <%= bootstrap_style %>
81
109
  ```
82
110
 
83
111
  The following code snippet loads the latest Bootstrap CSS library.
84
112
  ```erb
85
113
  <%= render partial: 'repres/bootstrap/style', locals: { options: { bootstrap: true } } %>
114
+ <!-- or the following line works identically -->
115
+ <%= bootstrap_style bootstrap: true %>
86
116
  ```
87
117
 
88
118
  The following code snippet loads the Bootstrap CSS library with the given version.
89
119
  ```erb
90
120
  <%= render partial: 'repres/bootstrap/style', locals: { options: { bootstrap: { version: '3.3.5' } } } %>
121
+ <!-- or the following line works identically -->
122
+ <%= bootstrap_style bootstrap: { version: '3.3.5' } %>
91
123
  ```
92
124
 
93
125
  The following CSS libraries are switchable, and the version can be configurable:
@@ -113,6 +145,9 @@ The Form Field partial includes the HTML form field tags for Rails Form Builder
113
145
  }
114
146
  }
115
147
  %>
148
+ <!-- or the following line works identically -->
149
+ <%= bootstrap_form_field model: model, form: f, name: :phone_number, type: :telephone_field %>
150
+
116
151
  <%= render partial: 'repres/bootstrap/form_field',
117
152
  locals: {
118
153
  options: {
@@ -124,6 +159,8 @@ The Form Field partial includes the HTML form field tags for Rails Form Builder
124
159
  }
125
160
  }
126
161
  %>
162
+ <!-- or the following line works identically -->
163
+ <%= bootstrap_form_field model: model, form: f, name: :photo, type: :file_field, input_accept: 'image/*' %>
127
164
  ```
128
165
 
129
166
 
@@ -131,7 +168,7 @@ The Form Field partial includes the HTML form field tags for Rails Form Builder
131
168
  ### Render the Form Select Box
132
169
  The Form Select Box partial includes the HTML select tags for Rails Form Builder and Bootstrap.
133
170
  ```ruby
134
- <%= render partial: 'repres/bootstrap/form_field',
171
+ <%= render partial: 'repres/bootstrap/form_select_box',
135
172
  locals: {
136
173
  options: {
137
174
  model: model,
@@ -142,6 +179,8 @@ The Form Select Box partial includes the HTML select tags for Rails Form Builder
142
179
  }
143
180
  }
144
181
  %>
182
+ <!-- or the following line works identically -->
183
+ <%= bootstrap_form_select_box model: model, form: f, name: :country_id, choices: @countries.select('id, name').map { |country| [ country.name, country.id ] }, options: { prompt: '请选择国家' } %>
145
184
  ```
146
185
 
147
186
 
@@ -1,2 +1,19 @@
1
1
  module Repres::Bootstrap::ApplicationHelper
2
+
3
+ def bootstrap_form_field(options = {})
4
+ render partial: 'repres/bootstrap/form_field', locals: { options: options }
5
+ end
6
+
7
+ def bootstrap_form_select_box(options = {})
8
+ render partial: 'repres/bootstrap/form_select_box', locals: { options: options }
9
+ end
10
+
11
+ def bootstrap_script(options = {})
12
+ render partial: 'repres/bootstrap/script', locals: { options: options }
13
+ end
14
+
15
+ def bootstrap_style(options = {})
16
+ render partial: 'repres/bootstrap/style', locals: { options: options }
17
+ end
18
+
2
19
  end
@@ -11,6 +11,6 @@
11
11
  <% end %>
12
12
 
13
13
  <% if library_enabled?(:'bootstrap-fileinput', options) %>
14
- <%= javascript_include_tag "//cdn.bootcss.com/bootstrap-fileinput/#{library_version(:'bootstrap-fileinput', '4.3.3', options)}/js/fileinput.min.js" %>
15
- <%= javascript_include_tag "//cdn.bootcss.com/bootstrap-fileinput/#{library_version(:'bootstrap-fileinput', '4.3.3', options)}/js/fileinput_locale_zh.min.js", charset: 'UTF-8' %>
14
+ <%= javascript_include_tag "//cdn.bootcss.com/bootstrap-fileinput/#{library_version(:'bootstrap-fileinput', '4.3.4', options)}/js/fileinput.min.js" %>
15
+ <%= javascript_include_tag "//cdn.bootcss.com/bootstrap-fileinput/#{library_version(:'bootstrap-fileinput', '4.3.4', options)}/js/locales/zh.min.js", charset: 'UTF-8' %>
16
16
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module Repres
2
2
  module Bootstrap
3
- VERSION = '1.0.3'.freeze
3
+ VERSION = '1.1'.freeze
4
4
  end
5
5
  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.0.3
4
+ version: '1.1'
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-08-12 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails