formnestic 1.0.4 → 1.0.5

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: 6fe34a72c80fe5243ea010b0cbf1906ab1903347
4
- data.tar.gz: c20344551068116aaae80c769ccb8678ae8e596a
3
+ metadata.gz: 69b0d6f68e1b135b126faaacd6ced20cbab57b9f
4
+ data.tar.gz: 117f5a3be1093b5ff640f6be282ba74c63587cae
5
5
  SHA512:
6
- metadata.gz: 0bb4341210e19682515f090db2db210451fcaf2eb06539e5e91d8e482203ab634f63a09899ff9671c0dbe2ea51046bb4d8bf5776e3e86f0e986b6db58bd92f5f
7
- data.tar.gz: fbba1a933e7874a6794f58bcd6a050292aaf80e3610959c789e51b8729f92714be26421f1a6583a15e3137119ae3e12ea5f753a54491ef1ecbb41b76d79c0ea7
6
+ metadata.gz: d2725b9b9d03361fafb090f2a9e15021f8bcf94f843b7c7aa1218145fe5091425edeeedd78a3c289d80d88386efde533a9046fcd3d74484caf0f3aa92441859e
7
+ data.tar.gz: 6eff0749a7f4afa31d66f682b70793bf904dff64277bbe5c7bd8da6a82dd365b8d5bb8dd27c6d390cf5c912543588c277a65e94d2f6d66ec77f53897a76b51ec
data/formnestic.gemspec CHANGED
@@ -4,112 +4,111 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "formnestic"
8
- s.version = "1.0.4"
7
+ s.name = 'formnestic'
8
+ s.version = '1.0.5'
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["James"]
12
- s.date = "2018-04-12"
13
- s.description = "An extension of famous Formtastic Form Builder to make building nested and association form with nested model addable and removable ability extremely easy and simple"
14
- s.email = "james@rubify.com"
10
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
11
+ s.authors = ['James']
12
+ s.date = '2018-04-12'
13
+ s.description = 'An extension of famous Formtastic Form Builder to make building nested and association form with nested model addable and removable ability extremely easy and simple'
14
+ s.email = 'james@rubify.com'
15
15
  s.extra_rdoc_files = [
16
- "README.markdown"
16
+ 'README.markdown'
17
17
  ]
18
18
  s.files = [
19
- ".document",
20
- ".rspec",
21
- ".travis.yml",
22
- ".watchr",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "MIT-LICENSE",
26
- "README.markdown",
27
- "Rakefile",
28
- "VERSION",
29
- "app/assets/.DS_Store",
30
- "app/assets/javascripts/formnestic/formnestic.js",
31
- "app/assets/stylesheets/formnestic/entypo.css.scss",
32
- "app/assets/stylesheets/formnestic/entypo.eot",
33
- "app/assets/stylesheets/formnestic/entypo.svg",
34
- "app/assets/stylesheets/formnestic/entypo.ttf",
35
- "app/assets/stylesheets/formnestic/entypo.woff",
36
- "app/assets/stylesheets/formnestic/formnestic.css.scss",
37
- "config/locales/formnestic.en.yml",
38
- "formnestic.gemspec",
39
- "lib/formnestic.rb",
40
- "lib/formnestic/form_builder.rb",
41
- "lib/formnestic/form_builder/base_builder.rb",
42
- "lib/formnestic/form_builder/list_form_builder.rb",
43
- "lib/formnestic/form_builder/table_form_builder.rb",
44
- "lib/formnestic/helpers.rb",
45
- "lib/formnestic/helpers/inputs_helper.rb",
46
- "lib/formnestic/inputs.rb",
47
- "lib/formnestic/inputs/base.rb",
48
- "lib/formnestic/inputs/base/labelling.rb",
49
- "lib/formnestic/inputs/base/wrapping.rb",
50
- "lib/generators/formnestic/install_generator.rb",
51
- "log/development.log",
52
- "rwatchr",
53
- "screenshots/list_form.png",
54
- "screenshots/table_form.png",
55
- "spec/helpers/nested_model_helper_spec.rb",
56
- "spec/helpers/nested_model_list_helper_spec.rb",
57
- "spec/inputs/boolean_input_spec.rb",
58
- "spec/spec_helper.rb",
59
- "spec/support/custom_macros.rb",
60
- "spec/support/deferred_garbage_collection.rb",
61
- "spec/support/deprecation.rb",
62
- "spec/support/test_environment.rb"
19
+ '.document',
20
+ '.rspec',
21
+ '.travis.yml',
22
+ '.watchr',
23
+ 'Gemfile',
24
+ 'Gemfile.lock',
25
+ 'MIT-LICENSE',
26
+ 'README.markdown',
27
+ 'Rakefile',
28
+ 'VERSION',
29
+ 'app/assets/.DS_Store',
30
+ 'app/assets/javascripts/formnestic/formnestic.js',
31
+ 'app/assets/stylesheets/formnestic/entypo.css.scss',
32
+ 'app/assets/stylesheets/formnestic/entypo.eot',
33
+ 'app/assets/stylesheets/formnestic/entypo.svg',
34
+ 'app/assets/stylesheets/formnestic/entypo.ttf',
35
+ 'app/assets/stylesheets/formnestic/entypo.woff',
36
+ 'app/assets/stylesheets/formnestic/formnestic.css.scss',
37
+ 'config/locales/formnestic.en.yml',
38
+ 'formnestic.gemspec',
39
+ 'lib/formnestic.rb',
40
+ 'lib/formnestic/form_builder.rb',
41
+ 'lib/formnestic/form_builder/base_builder.rb',
42
+ 'lib/formnestic/form_builder/list_form_builder.rb',
43
+ 'lib/formnestic/form_builder/table_form_builder.rb',
44
+ 'lib/formnestic/helpers.rb',
45
+ 'lib/formnestic/engine.rb',
46
+ 'lib/formnestic/formtastic_extensions.rb',
47
+ 'lib/formnestic/helpers/inputs_helper.rb',
48
+ 'lib/formnestic/inputs.rb',
49
+ 'lib/formnestic/inputs/base.rb',
50
+ 'lib/formnestic/inputs/base/labelling.rb',
51
+ 'lib/formnestic/inputs/base/wrapping.rb',
52
+ 'lib/generators/formnestic/install_generator.rb',
53
+ 'rwatchr',
54
+ 'screenshots/list_form.png',
55
+ 'screenshots/table_form.png',
56
+ 'spec/helpers/nested_model_helper_spec.rb',
57
+ 'spec/helpers/nested_model_list_helper_spec.rb',
58
+ 'spec/inputs/boolean_input_spec.rb',
59
+ 'spec/spec_helper.rb',
60
+ 'spec/support/custom_macros.rb',
61
+ 'spec/support/deferred_garbage_collection.rb',
62
+ 'spec/support/deprecation.rb',
63
+ 'spec/support/test_environment.rb'
63
64
  ]
64
- s.homepage = "http://github.com/jameshuynh/formnestic"
65
- s.licenses = ["MIT"]
66
- s.require_paths = ["lib"]
67
- s.rubygems_version = "1.8.23"
68
- s.summary = "An extension of formtastic form builder gem"
65
+ s.homepage = 'http://github.com/jameshuynh/formnestic'
66
+ s.licenses = ['MIT']
67
+ s.require_paths = ['lib']
68
+ s.rubygems_version = '1.8.23'
69
+ s.summary = 'An extension of formtastic form builder gem'
69
70
 
70
- if s.respond_to? :specification_version then
71
+ if s.respond_to? :specification_version
71
72
  s.specification_version = 3
72
73
 
73
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
- s.add_runtime_dependency(%q<actionpack>, [">= 3.2.13"])
75
- s.add_runtime_dependency(%q<formtastic>, [">= 2.2.1"])
76
- s.add_runtime_dependency(%q<coveralls>, [">= 0"])
77
- s.add_development_dependency(%q<shoulda>, [">= 0"])
78
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
79
- s.add_development_dependency(%q<rdoc>, ["~> 3.4"])
80
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
81
- s.add_development_dependency(%q<rspec-rails>, ["~> 2.14.0"])
82
- s.add_development_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
83
- s.add_development_dependency(%q<tzinfo>, [">= 0"])
84
- s.add_development_dependency(%q<spork>, [">= 0"])
85
- s.add_development_dependency(%q<watchr>, [">= 0"])
74
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0')
75
+ s.add_runtime_dependency('actionpack', ['>= 3.2.13'])
76
+ s.add_runtime_dependency('coveralls', ['>= 0'])
77
+ s.add_runtime_dependency('formtastic', ['>= 2.2.1'])
78
+ s.add_development_dependency('bundler', ['~> 1.0'])
79
+ s.add_development_dependency('jeweler', ['~> 2.0.1'])
80
+ s.add_development_dependency('rdoc', ['~> 3.4'])
81
+ s.add_development_dependency('rspec-rails', ['~> 2.14.0'])
82
+ s.add_development_dependency('rspec_tag_matchers', ['>= 1.0.0'])
83
+ s.add_development_dependency('shoulda', ['>= 0'])
84
+ s.add_development_dependency('spork', ['>= 0'])
85
+ s.add_development_dependency('tzinfo', ['>= 0'])
86
86
  else
87
- s.add_dependency(%q<actionpack>, [">= 3.2.13"])
88
- s.add_dependency(%q<formtastic>, [">= 2.2.1"])
89
- s.add_dependency(%q<coveralls>, [">= 0"])
90
- s.add_dependency(%q<shoulda>, [">= 0"])
91
- s.add_dependency(%q<bundler>, ["~> 1.0"])
92
- s.add_dependency(%q<rdoc>, ["~> 3.4"])
93
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
94
- s.add_dependency(%q<rspec-rails>, ["~> 2.14.0"])
95
- s.add_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
96
- s.add_dependency(%q<tzinfo>, [">= 0"])
97
- s.add_dependency(%q<spork>, [">= 0"])
98
- s.add_dependency(%q<watchr>, [">= 0"])
87
+ s.add_dependency('actionpack', ['>= 3.2.13'])
88
+ s.add_dependency('bundler', ['~> 1.0'])
89
+ s.add_dependency('coveralls', ['>= 0'])
90
+ s.add_dependency('rdoc', ['~> 3.4'])
91
+ s.add_dependency('rdoc', ['~> 3.4'])
92
+ s.add_dependency('rdoc', ['~> 3.4'])
93
+ s.add_dependency('rspec-rails', ['~> 2.14.0'])
94
+ s.add_dependency('rspec_tag_matchers', ['>= 1.0.0'])
95
+ s.add_dependency('shoulda', ['>= 0'])
96
+ s.add_dependency('spork', ['>= 0'])
97
+ s.add_dependency('tzinfo', ['>= 0'])
98
+ s.add_dependency('watchr', ['>= 0'])
99
99
  end
100
100
  else
101
- s.add_dependency(%q<actionpack>, [">= 3.2.13"])
102
- s.add_dependency(%q<formtastic>, [">= 2.2.1"])
103
- s.add_dependency(%q<coveralls>, [">= 0"])
104
- s.add_dependency(%q<shoulda>, [">= 0"])
105
- s.add_dependency(%q<bundler>, ["~> 1.0"])
106
- s.add_dependency(%q<rdoc>, ["~> 3.4"])
107
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
108
- s.add_dependency(%q<rspec-rails>, ["~> 2.14.0"])
109
- s.add_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
110
- s.add_dependency(%q<tzinfo>, [">= 0"])
111
- s.add_dependency(%q<spork>, [">= 0"])
112
- s.add_dependency(%q<watchr>, [">= 0"])
101
+ s.add_dependency('formtastic', ['>= 2.2.1'])
102
+ s.add_dependency('formtastic', ['>= 2.2.1'])
103
+ s.add_dependency('formtastic', ['>= 2.2.1'])
104
+ s.add_dependency('jeweler', ['~> 2.0.1'])
105
+ s.add_dependency('shoulda', ['>= 0'])
106
+ s.add_dependency('shoulda', ['>= 0'])
107
+ s.add_development_dependency('watchr', ['>= 0'])
108
+ s.add_dependency('rspec-rails', ['~> 2.14.0'])
109
+ s.add_dependency('rspec_tag_matchers', ['>= 1.0.0'])
110
+ s.add_dependency('tzinfo', ['>= 0'])
111
+ s.add_dependency('tzinfo', ['>= 0'])
112
+ s.add_dependency('watchr', ['>= 0'])
113
113
  end
114
114
  end
115
-
@@ -0,0 +1,4 @@
1
+ module Formnestic
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,98 @@
1
+ module Formnestic
2
+ module FormtasticExtensions
3
+ def extend_form_builder
4
+ Formtastic::FormBuilder.send(
5
+ :alias_method,
6
+ :formtastic_semantic_fields_for,
7
+ :semantic_fields_for
8
+ )
9
+ Formtastic::FormBuilder.send(:include, Formnestic::FormBuilder)
10
+ Formtastic::FormBuilder.class_eval do
11
+ def semantic_fields_for(record_or_name_or_array, *args, &block)
12
+ options = args.dup.extract_options!
13
+ if options[:display_type] == 'table'
14
+ formnestic_table_semantic_fields_for(
15
+ record_or_name_or_array,
16
+ *args,
17
+ &block
18
+ )
19
+ elsif options[:row_removable].present? ||
20
+ options[:row_addable].present?
21
+ formnestic_list_semantic_fields_for(
22
+ record_or_name_or_array,
23
+ *args,
24
+ &block
25
+ )
26
+ else
27
+ formtastic_semantic_fields_for(
28
+ record_or_name_or_array,
29
+ *args,
30
+ &block
31
+ )
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ def extend_form_inputs
38
+ Formtastic::Inputs::Base.send(
39
+ :alias_method,
40
+ :formtastic_input_wrapping,
41
+ :input_wrapping
42
+ )
43
+ Formtastic::Inputs::Base.send(
44
+ :alias_method,
45
+ :formtastic_render_label?,
46
+ :render_label?
47
+ )
48
+ # Formtastic::Inputs::BooleanInput.send(
49
+ # :alias_method,
50
+ # :formtastic_label_text_with_embedded_checkbox,
51
+ # :label_text_with_embedded_checkbox
52
+ # )
53
+ Formtastic::Inputs::Base.send(
54
+ :include, Formnestic::Inputs::Base::Wrapping
55
+ )
56
+ Formtastic::Inputs::Base.send(
57
+ :include, Formnestic::Inputs::Base::Labelling
58
+ )
59
+ end
60
+
61
+ def extend_datetime_related_inputs
62
+ [
63
+ 'Formtastic::Inputs::DateSelectInput',
64
+ 'Formtastic::Inputs::DatetimeSelectInput',
65
+ 'Formtastic::Inputs::TimeSelectInput'
66
+ ].each do |date_related_subclass_str|
67
+ next unless defined?(date_related_subclass_str)
68
+ date_related_subclass = date_related_subclass_str.constantize
69
+ date_related_subclass.send(
70
+ :alias_method,
71
+ :formtastic_fragment_label_html,
72
+ :fragment_label_html
73
+ )
74
+ date_related_subclass.class_eval do
75
+ def fragment_label_html(fragment)
76
+ if builder.options[:display_type] == 'table'
77
+ ''.html_safe
78
+ else
79
+ formtastic_fragment_label_html(fragment)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ def extend_boolean_input
87
+ Formtastic::Inputs::BooleanInput.class_eval do
88
+ def label_text_with_embedded_checkbox
89
+ if builder.options[:display_type] == 'table'
90
+ check_box_html
91
+ else
92
+ formtastic_label_text_with_embedded_checkbox
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formnestic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.13
27
- - !ruby/object:Gem::Dependency
28
- name: formtastic
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 2.2.1
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 2.2.1
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: coveralls
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +39,19 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: shoulda
42
+ name: formtastic
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
47
+ version: 2.2.1
48
+ type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: 2.2.1
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: bundler
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -81,33 +67,33 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '1.0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: rdoc
70
+ name: jeweler
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '3.4'
75
+ version: 2.0.1
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '3.4'
82
+ version: 2.0.1
97
83
  - !ruby/object:Gem::Dependency
98
- name: jeweler
84
+ name: rdoc
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: 2.0.1
89
+ version: '3.4'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: 2.0.1
96
+ version: '3.4'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec-rails
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: 1.0.0
139
125
  - !ruby/object:Gem::Dependency
140
- name: tzinfo
126
+ name: shoulda
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
@@ -165,7 +151,7 @@ dependencies:
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
153
  - !ruby/object:Gem::Dependency
168
- name: watchr
154
+ name: tzinfo
169
155
  requirement: !ruby/object:Gem::Requirement
170
156
  requirements:
171
157
  - - ">="
@@ -208,10 +194,12 @@ files:
208
194
  - config/locales/formnestic.en.yml
209
195
  - formnestic.gemspec
210
196
  - lib/formnestic.rb
197
+ - lib/formnestic/engine.rb
211
198
  - lib/formnestic/form_builder.rb
212
199
  - lib/formnestic/form_builder/base_builder.rb
213
200
  - lib/formnestic/form_builder/list_form_builder.rb
214
201
  - lib/formnestic/form_builder/table_form_builder.rb
202
+ - lib/formnestic/formtastic_extensions.rb
215
203
  - lib/formnestic/helpers.rb
216
204
  - lib/formnestic/helpers/inputs_helper.rb
217
205
  - lib/formnestic/inputs.rb
@@ -219,7 +207,6 @@ files:
219
207
  - lib/formnestic/inputs/base/labelling.rb
220
208
  - lib/formnestic/inputs/base/wrapping.rb
221
209
  - lib/generators/formnestic/install_generator.rb
222
- - log/development.log
223
210
  - rwatchr
224
211
  - screenshots/list_form.png
225
212
  - screenshots/table_form.png
data/log/development.log DELETED
File without changes