volt-fields 0.0.5 → 0.0.6

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: a671405d5f61e593436fbd1ba82aac7dc8b20942
4
- data.tar.gz: c04d74c5d9de6d4e71af774653abd1e41ce26d40
3
+ metadata.gz: 7d751371a35882d23e3b216af354da413cae52bb
4
+ data.tar.gz: f8f750f1b649e50a8fd01b25f745e25b3e216c30
5
5
  SHA512:
6
- metadata.gz: f9a91a91b3f0dd46b3eee66572b1c4f0df2e09d18e8a3f66337be5d882a936380f26a99a54448f3072bcae413db214fe930b90b34de8631083b07696e8086186
7
- data.tar.gz: 8c9cd0db3c7cfe743010cb49bf77218cccabdcfd5e8ede04529f395b36347bf2537d267c6f4b977bf4ed03517808b42795c95e31141331c81472fc66fe996456
6
+ metadata.gz: 6637568a7fbf764414184d8d4e0ceee5a090cb147cce66cd8b158a8f9906bbdf3013ca85c884072a7c6429baf616bae41c0bfb31fbfe4975328fcdbca4018ef3
7
+ data.tar.gz: 28baa74fff5b6782643901ae3fe5f974ffb3536ebd6ff41ed67fafeca7d105567cbdefbaa0fbe80b684e6aeac0fcb78d511752eac1d16466c96021040d33d94b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
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
- @type ||= 'text'
7
- @label ||= nil
8
-
9
- # Get the reactive manager for the value passed in
10
- manager = @value.reactive_manager
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 = manager.parents[0].reactive_value
15
+ @model = attrs.value_parent
15
16
 
16
17
  # Get the name of the field by looking at the method scope
17
- @field_name = manager.scope[0]
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
- # Find the errors for this field
20
- @errors = @model.marked_errors[@field_name]
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 @errors}has-error{#elsif blurred}has-success{/} has-feedback">
3
- {#if @label}
4
- <label class="control-label">{@label}</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="{@value}" e-focusout="blur" class="form-control" />
7
- {#if @errors}
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">{@errors.or([]).join(', ')}</span>
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
- </p>
13
+ </div>
@@ -1,13 +1,13 @@
1
1
  <:Body>
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>
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">{@value}</textarea>
7
- {#if @errors}
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">{@errors.or([]).join(', ')}</span>
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
- </p>
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.5
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-09-19 00:00:00.000000000 Z
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: