unirer-bootstrap 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/app/views/unirer/bootstrap/_form_field.html.erb +14 -7
- data/lib/unirer/bootstrap/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9762acf8c9b1dcc44d3ad1503076a8ed13ac100d
|
4
|
+
data.tar.gz: d0f8f84587f77f1d56db70872236ebece7af63a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3db195c9629a8d8b1380c25fb21f9d898d1fcad1498370d1f1625f906c52d8029d1a7e1c51f9e4e82f6efd61b40dc8b6e9202ea1f951519185c657baee846827
|
7
|
+
data.tar.gz: 92f619c6c3ecd26915c532d4eb577d637d507727d5ad77fcaca1685cb9fe9a616e2814fe84e70e697606f96edce1cd4a8a13be7f534286a62816820ba7594082
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Unirer Bootstrap
|
1
|
+
# Unirer Bootstrap Bootstrap资源表现引擎
|
2
2
|
|
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/unirer-bootstrap.svg)](https://badge.fury.io/rb/unirer-bootstrap)
|
@@ -6,12 +6,12 @@
|
|
6
6
|
Unirer (UNIfied Resource Representation) is a series of resource representation engines. The Bootstrap resource representation engine includes Bootstrap-based resource representation templates & snippets.
|
7
7
|
Unirer (统一资源表现)是一系列的资源表现引擎。Bootstrap 资源表现引擎包括基于Bootstrap的资源表现模版和片段。
|
8
8
|
|
9
|
-
## Usage in Gemfile
|
9
|
+
## Usage in Gemfile
|
10
10
|
```ruby
|
11
11
|
gem 'unirer-bootstrap'
|
12
12
|
```
|
13
13
|
|
14
|
-
## Render the Pre-defined Partials
|
14
|
+
## Render the Pre-defined Partials
|
15
15
|
```erb
|
16
16
|
<%= render partial: 'unirer/bootstrap/meta' %>
|
17
17
|
<%= render partial: 'unirer/bootstrap/script' %>
|
@@ -70,7 +70,7 @@ The source codes of the Style partial:
|
|
70
70
|
### Render the Form Field
|
71
71
|
The Form Field partial includes the HTML form field tags for Rails Form Builder and Bootstrap.
|
72
72
|
```erb
|
73
|
-
<%= render partial: 'unirer/bootstrap/form_field', locals: { model: model, form: f, name: :phone_number, type: :tel_field } %>
|
73
|
+
<%= render partial: 'unirer/bootstrap/form_field', locals: { options: { model: model, form: f, name: :phone_number, type: :tel_field } } %>
|
74
74
|
```
|
75
75
|
|
76
76
|
The 4 options are required: model, form, name, and type.
|
@@ -4,13 +4,20 @@
|
|
4
4
|
name = options[:name]
|
5
5
|
type = options[:type]||:text_field
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
group_class_list = [ 'form-group', options[:group_class] ]
|
8
|
+
label_class_list = [ 'control-label', options[:label_class]||'col-xs-2' ]
|
9
|
+
field_class_list = [ 'input-group', options[:field_class]||'col-xs-10' ]
|
10
|
+
error_class_list = [ 'text-danger', options[:error_class]||'col-xs-offset-2 col-xs-10' ]
|
11
|
+
group_class_list << 'has-error' if model.errors[name].present?
|
12
|
+
|
13
|
+
group_class = group_class_list.flatten.join ' '
|
14
|
+
label_class = label_class_list.flatten.join ' '
|
15
|
+
field_class = field_class_list.flatten.join ' '
|
16
|
+
error_class = error_class_list.flatten.join ' '
|
17
|
+
|
18
|
+
label_text = options[:label]
|
19
|
+
prefix = options[:prefix]
|
20
|
+
suffix = options[:suffix]
|
14
21
|
|
15
22
|
field_options = {
|
16
23
|
disabled: options[:disabled],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unirer-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
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-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -73,6 +73,5 @@ rubyforge_project:
|
|
73
73
|
rubygems_version: 2.4.5.1
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
|
-
summary:
|
77
|
-
resource representation templates & snippets.
|
76
|
+
summary: Unirer Bootstrap Resource Representation Engine Bootstrap资源表现引擎
|
78
77
|
test_files: []
|