volt-fields 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/fields/controllers/text_controller.rb +23 -9
- data/app/fields/views/text/index.html +7 -7
- data/app/fields/views/textarea/index.html +7 -7
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d751371a35882d23e3b216af354da413cae52bb
|
4
|
+
data.tar.gz: f8f750f1b649e50a8fd01b25f745e25b3e216c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6637568a7fbf764414184d8d4e0ceee5a090cb147cce66cd8b158a8f9906bbdf3013ca85c884072a7c6429baf616bae41c0bfb31fbfe4975328fcdbca4018ef3
|
7
|
+
data.tar.gz: 28baa74fff5b6782643901ae3fe5f974ffb3536ebd6ff41ed67fafeca7d105567cbdefbaa0fbe80b684e6aeac0fcb78d511752eac1d16466c96021040d33d94b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -1,23 +1,37 @@
|
|
1
1
|
module Fields
|
2
2
|
class TextController < ModelController
|
3
3
|
reactive_accessor :blurred
|
4
|
+
reactive_accessor :errors
|
4
5
|
def index
|
5
6
|
# Default to text fields
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
if attrs.respond_to?(:type)
|
8
|
+
@type = attrs.type
|
9
|
+
else
|
10
|
+
@type = 'text'
|
11
|
+
end
|
11
12
|
|
12
13
|
# Find the parent reactive value that produced the value
|
13
14
|
# (usually just model._field)
|
14
|
-
@model =
|
15
|
+
@model = attrs.value_parent
|
15
16
|
|
16
17
|
# Get the name of the field by looking at the method scope
|
17
|
-
@field_name =
|
18
|
+
@field_name = attrs.value_last_method
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def label
|
23
|
+
label = (attrs.respond_to?(:label) && attrs.label)
|
24
|
+
|
25
|
+
unless @label
|
26
|
+
label = @field_name.titleize
|
27
|
+
end
|
28
|
+
|
29
|
+
return label
|
30
|
+
end
|
18
31
|
|
19
|
-
|
20
|
-
|
32
|
+
# Find the errors for this field
|
33
|
+
def errors
|
34
|
+
@model.marked_errors[@field_name]
|
21
35
|
end
|
22
36
|
|
23
37
|
# When a field goes out of focus, then we want to start checking a field
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<:Body>
|
2
|
-
<div class="form-group {#if
|
3
|
-
{#if
|
4
|
-
<label class="control-label">{
|
2
|
+
<div class="form-group {#if errors}has-error{#elsif blurred}has-success{/} has-feedback">
|
3
|
+
{#if label}
|
4
|
+
<label class="control-label">{label}</label>
|
5
5
|
{/}
|
6
|
-
<input type="{@type}" value="{
|
7
|
-
{#if
|
6
|
+
<input type="{@type}" value="{attrs.value}" e-focusout="blur" class="form-control" />
|
7
|
+
{#if errors}
|
8
8
|
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
9
|
-
<span class="control-label errors">{
|
9
|
+
<span class="control-label errors">{errors.or([]).join(', ')}</span>
|
10
10
|
{#elsif blurred}
|
11
11
|
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
|
12
12
|
{/}
|
13
|
-
</
|
13
|
+
</div>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<:Body>
|
2
|
-
<p class="form-group {#if
|
3
|
-
{#if
|
4
|
-
<label class="control-label">{
|
2
|
+
<p class="form-group {#if errors}has-error{#elsif blurred}has-success{/} has-feedback">
|
3
|
+
{#if label}
|
4
|
+
<label class="control-label">{label}</label>
|
5
5
|
{/}
|
6
|
-
<textarea e-focusout="blur" class="form-control">{
|
7
|
-
{#if
|
6
|
+
<textarea e-focusout="blur" class="form-control">{attrs.value}</textarea>
|
7
|
+
{#if errors}
|
8
8
|
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
9
|
-
<span class="control-label errors">{
|
9
|
+
<span class="control-label errors">{errors.or([]).join(', ')}</span>
|
10
10
|
{#elsif blurred}
|
11
11
|
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
|
12
12
|
{/}
|
13
|
-
</
|
13
|
+
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt-fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Stout
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: volt
|
@@ -84,4 +84,3 @@ specification_version: 4
|
|
84
84
|
summary: Provides controls for text and textarea fields with built in error reporting
|
85
85
|
and bootstrap formatting
|
86
86
|
test_files: []
|
87
|
-
has_rdoc:
|