volt-fields 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +7 -0
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/app/fields/config/dependencies.rb +1 -0
- data/app/fields/config/routes.rb +1 -0
- data/app/fields/controllers/text_controller.rb +27 -0
- data/app/fields/controllers/textarea_controller.rb +4 -0
- data/app/fields/views/text/index.html +10 -0
- data/app/fields/views/textarea/index.html +10 -0
- data/lib/volt/fields.rb +7 -0
- data/volt-fields.gemspec +24 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ebe01b50a127981d693d023a7f823e8878a96c3b
|
4
|
+
data.tar.gz: 67c3d026037ff596e7d0db88b571da0d8e99f926
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 217ede7dcb352689e22a2d04cc4d721b338ebff9708cc11b1f9b0e52c59c99ca3a10bfbe3e1a58fa64c2aa52f198f3afd6669130bf3cd8d6e374371ec069f996
|
7
|
+
data.tar.gz: b9b4832fe681300e2abd4d5795dd69c5b60d5503adc6cb4a4a5c8ee15dd188b88955ddc2d58be01a0ccdc61baabe61b63709362568a6c1c7ede45f107b81b454
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1 @@
|
|
1
|
+
# Component dependencies
|
@@ -0,0 +1 @@
|
|
1
|
+
# Component routes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fields
|
2
|
+
class TextController < ModelController
|
3
|
+
def index
|
4
|
+
# Default to text fields
|
5
|
+
@type ||= 'text'
|
6
|
+
@label ||= nil
|
7
|
+
|
8
|
+
# Get the reactive manager for the value passed in
|
9
|
+
manager = @value.reactive_manager
|
10
|
+
|
11
|
+
# Find the parent reactive value that produced the value
|
12
|
+
# (usually just model._field)
|
13
|
+
@model = manager.parents[0].reactive_value
|
14
|
+
|
15
|
+
# Get the name of the field by looking at the method scope
|
16
|
+
@field_name = manager.scope[0]
|
17
|
+
|
18
|
+
# Find the errors for this field
|
19
|
+
@errors = @model.marked_errors[@field_name]
|
20
|
+
end
|
21
|
+
|
22
|
+
# When a field goes out of focus, then we want to start checking a field
|
23
|
+
def blurred
|
24
|
+
@model.mark_field!(@field_name)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<:Body>
|
2
|
+
<div class="form-group {#if @errors}has-error{/}">
|
3
|
+
{#if @label}
|
4
|
+
<label class="control-label">{@label}</label>
|
5
|
+
{/}
|
6
|
+
<input type="{@type}" value="{@value}" e-focusout="blurred" class="form-control" />
|
7
|
+
{#if @errors}
|
8
|
+
<span class="control-label errors">{@errors.or([]).join(', ')}</span>
|
9
|
+
{/}
|
10
|
+
</p>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<:Body>
|
2
|
+
<p class="form-group {#if @errors}has-error{/}">
|
3
|
+
{#if @label}
|
4
|
+
<label class="control-label">{@label}</label>
|
5
|
+
{/}
|
6
|
+
<textarea e-focusout="blurred" class="form-control">{@value}</textarea>
|
7
|
+
{#if @errors}
|
8
|
+
<span class="control-label errors">{@errors.or([]).join(', ')}</span>
|
9
|
+
{/}
|
10
|
+
</p>
|
data/lib/volt/fields.rb
ADDED
data/volt-fields.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
6
|
+
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "volt-fields"
|
10
|
+
spec.version = version
|
11
|
+
spec.authors = ["Ryan Stout"]
|
12
|
+
spec.email = ["ryan@agileproductions.com"]
|
13
|
+
spec.summary = %q{Provides controls for text and textarea fields with built in error reporting and bootstrap formatting}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "volt", "~> 0.7.0"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: volt-fields
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Stout
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: volt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- ryan@agileproductions.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- VERSION
|
53
|
+
- app/fields/config/dependencies.rb
|
54
|
+
- app/fields/config/routes.rb
|
55
|
+
- app/fields/controllers/text_controller.rb
|
56
|
+
- app/fields/controllers/textarea_controller.rb
|
57
|
+
- app/fields/views/text/index.html
|
58
|
+
- app/fields/views/textarea/index.html
|
59
|
+
- lib/volt/fields.rb
|
60
|
+
- volt-fields.gemspec
|
61
|
+
homepage: ''
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.2.0
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Provides controls for text and textarea fields with built in error reporting
|
85
|
+
and bootstrap formatting
|
86
|
+
test_files: []
|