hungryform-rails 0.0.3 → 0.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 +1 -1
- data/app/views/hungryform/_checkbox_field.html.erb +2 -2
- data/app/views/hungryform/_group.html.erb +1 -1
- data/app/views/hungryform/_html.html.erb +1 -1
- data/app/views/hungryform/_radio_group.html.erb +2 -2
- data/app/views/hungryform/_select_field.html.erb +2 -2
- data/app/views/hungryform/_text_area.html.erb +2 -2
- data/app/views/hungryform/_text_field.html.erb +2 -2
- data/hungryform-rails.gemspec +1 -1
- data/lib/hungryform/rails/renderable.rb +7 -2
- data/lib/hungryform/rails/version.rb +1 -1
- data/spec/views/shared_examples/rendered_active_element.rb +3 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352c2e9eab241d7cd69e2be42d84cda9961e8f10
|
4
|
+
data.tar.gz: 4c3b715e1c945e777710b4277f95a4350f1058a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f228d423f2b55ffdd7f8125516ee61d05f83d7cf37364d10ba17a603427b8c8afc598f6fea63bb19c2ed822452131e8898bcfea592e7ff4ece5ba32d43eb7d78
|
7
|
+
data.tar.gz: ab002ba6dd14ca41ef1cf1367ec0242f6d382fb121faf2a03b1576b60cbee95bb9affaa1a1ace3d0df6b52359c418c83afed93001ddceec65096e69d65cabbe8
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#Hungryform Rails [![Build Status](https://travis-ci.org/andrba/hungryform-rails.svg?branch=master)](https://travis-ci.org/andrba/hungryform-rails)
|
2
2
|
|
3
|
-
This gem is an adaptor between the HungryForm gem and Rails.
|
3
|
+
This gem is an adaptor between the [HungryForm](http://github.com/andrba/hungryform) gem and Rails.
|
4
4
|
|
5
5
|
##Installation:
|
6
6
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do
|
2
2
|
|
3
3
|
concat label_tag field.name, field.label << ("*" if field.required?).to_s
|
4
4
|
concat hidden_field_tag field.name, 0
|
5
|
-
concat check_box_tag field.name, 1, field.checked?, field.
|
5
|
+
concat check_box_tag field.name, 1, field.checked?, field.input_attributes
|
6
6
|
unless field.error.empty?
|
7
7
|
concat content_tag :span, field.error, class: 'error'
|
8
8
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do
|
2
2
|
|
3
3
|
field.elements.each do |el|
|
4
4
|
concat render partial: "#{views_prefix}/#{el.class.name.demodulize.underscore}", locals: { field: el, views_prefix: views_prefix }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do -%>
|
2
2
|
|
3
3
|
<%= field.value.html_safe %>
|
4
4
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do
|
2
2
|
|
3
3
|
concat label_tag field.name, field.label << ("*" if field.required?).to_s
|
4
4
|
field.options.each do |key, value|
|
5
|
-
concat radio_button_tag key, value, field.value == value, field.
|
5
|
+
concat radio_button_tag key, value, field.value == value, field.input_attributes
|
6
6
|
end
|
7
7
|
unless field.error.empty?
|
8
8
|
concat content_tag :span, field.error, class: 'error'
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do
|
2
2
|
|
3
3
|
concat label_tag field.name, field.label << ("*" if field.required?).to_s
|
4
|
-
concat select_tag field.name, options_for_select(field.options.invert, field.value), field.
|
4
|
+
concat select_tag field.name, options_for_select(field.options.invert, field.value), field.input_attributes
|
5
5
|
unless field.error.empty?
|
6
6
|
concat content_tag :span, field.error, class: 'error'
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do
|
2
2
|
|
3
3
|
concat label_tag field.name, field.label << ("*" if field.required?).to_s
|
4
|
-
concat text_area_tag field.name, field.value, field.
|
4
|
+
concat text_area_tag field.name, field.value, field.input_attributes
|
5
5
|
unless field.error.empty?
|
6
6
|
concat content_tag :span, field.error, class: 'error'
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.
|
1
|
+
<%= content_tag :div, id: "#{field.name}_wrapper", class: field.wrapper_class, 'data-dependency' => field.dependency_json do
|
2
2
|
|
3
3
|
concat label_tag field.name, field.label << ("*" if field.required?).to_s
|
4
|
-
concat text_field_tag field.name, field.value, field.
|
4
|
+
concat text_field_tag field.name, field.value, field.input_attributes
|
5
5
|
unless field.error.empty?
|
6
6
|
concat content_tag :span, field.error, class: 'error'
|
7
7
|
end
|
data/hungryform-rails.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.0.0'
|
23
23
|
|
24
|
-
spec.add_dependency 'hungryform', '~> 0.0', '>= 0.0.
|
24
|
+
spec.add_dependency 'hungryform', '~> 0.0', '>= 0.0.10'
|
25
25
|
spec.add_dependency 'rails', '>= 3.2.1'
|
26
26
|
|
27
27
|
spec.add_development_dependency "rspec", '~> 3.0'
|
@@ -1,13 +1,18 @@
|
|
1
1
|
module HungryForm
|
2
2
|
module Rails
|
3
3
|
module Renderable
|
4
|
-
def
|
4
|
+
def wrapper_class
|
5
5
|
classes = []
|
6
|
-
classes <<
|
6
|
+
classes << configuration[:wrapper_class] if configuration.key?(:wrapper_class)
|
7
|
+
classes << attributes[:wrapper_class] if attributes[:wrapper_class]
|
7
8
|
classes << 'hidden' unless visible?
|
8
9
|
classes << 'invalid' if self.is_a?(HungryForm::Elements::Base::ActiveElement) && self.error.present?
|
9
10
|
classes.join(' ') if classes.any?
|
10
11
|
end
|
12
|
+
|
13
|
+
def input_attributes
|
14
|
+
attributes.except(*[configuration[:input_attributes_except], :wrapper_class].flatten)
|
15
|
+
end
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
@@ -25,10 +25,9 @@ RSpec.shared_examples 'rendered active element' do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
attributes[:class] = 'my_class'
|
28
|
+
it 'has a wrapper class attribute in the div wrapper' do
|
29
|
+
attributes[:wrapper_class] = 'my_class'
|
31
30
|
render render_params
|
32
|
-
expect(rendered).
|
31
|
+
expect(rendered).to match /<div.*class="my_class"/
|
33
32
|
end
|
34
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hungryform-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Bazhutkin
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.0.
|
22
|
+
version: 0.0.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.0.
|
32
|
+
version: 0.0.10
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rails
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|