record_collection 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/record_collection/multi_select.js.coffee +0 -1
- data/app/assets/javascripts/record_collection/optionals.js.coffee +1 -1
- data/config/spring.rb +1 -0
- data/lib/record_collection/rails/form_options_helper.rb +8 -2
- data/lib/record_collection/version.rb +1 -1
- data/record_collection.gemspec +3 -0
- data/spec/dummy/app/views/employees/_form.html.erb +1 -1
- data/spec/features/multi_select_spec.rb +1 -0
- data/spec/features/optional_text_field_with_normal_resource_spec.rb +16 -0
- data/spec/features/optionals_with_one_record_spec.rb +16 -0
- metadata +49 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3fe45579a3c799ef4243d149102f0a79bb47378
|
4
|
+
data.tar.gz: ba95029f191c2412f2a0489418acd0d8735c974c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6234774ce4b5adfe5fc245e11f7331aa2c48ed38cc6e7e5ab21b6f38898754f22691a82ccba789c70ae4f09b58a73617be460b1ac47b425b8768549b892ee443
|
7
|
+
data.tar.gz: 0e72b14a8c8b3cb8ec56872cb2ce0b856220678dd63d37a9797652e030120fbbb8dc9a4c467365d283b5c71f6d251fd88efc00d49fd5847aea6caf24562a6454
|
data/config/spring.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Spring.application_root = './spec/dummy'
|
@@ -42,7 +42,8 @@ class ActionView::Helpers::FormBuilder
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def get_data_attributes(attr, options = {})
|
45
|
-
one =
|
45
|
+
one = true
|
46
|
+
one = object.one? if object.is_a? RecordCollection::Base
|
46
47
|
{attribute: attr, one: one}
|
47
48
|
end
|
48
49
|
|
@@ -56,7 +57,12 @@ class ActionView::Helpers::FormBuilder
|
|
56
57
|
active = true unless object.public_send(attr).nil? # Activate if collection attribute is not nil
|
57
58
|
classes = [options[:base_class] || 'optional-input', 'optional-attribute-container', attr]
|
58
59
|
classes << (active ? 'active' : 'inactive')
|
59
|
-
|
60
|
+
if object.is_a? RecordCollection::Base
|
61
|
+
classes << 'one' if object.one?
|
62
|
+
else
|
63
|
+
# Assume normal record, this always behaves like one
|
64
|
+
classes << 'one'
|
65
|
+
end
|
60
66
|
classes << 'error' if object.errors[attr].present?
|
61
67
|
classes
|
62
68
|
end
|
data/record_collection.gemspec
CHANGED
@@ -32,10 +32,13 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency "jquery-rails"
|
33
33
|
spec.add_development_dependency "js-routes"
|
34
34
|
spec.add_development_dependency "capybara"
|
35
|
+
spec.add_development_dependency "capybara-screenshot"
|
35
36
|
spec.add_development_dependency "poltergeist"
|
36
37
|
spec.add_development_dependency "launchy"
|
37
38
|
spec.add_development_dependency "database_cleaner"
|
38
39
|
spec.add_development_dependency "spring"
|
40
|
+
spec.add_development_dependency "spring-commands-rspec"
|
41
|
+
spec.add_development_dependency "quiet_assets"
|
39
42
|
|
40
43
|
|
41
44
|
spec.add_runtime_dependency 'active_attr', '~> 0.8'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.feature "Optional text_field with normal record", type: :feature do
|
4
|
+
scenario "Selecting all", js: true do
|
5
|
+
employee = Employee.create name: 'E1', admin: true, vegan: false
|
6
|
+
visit edit_employee_path(employee.id)
|
7
|
+
|
8
|
+
find('#employee_section').set 'SEC' # this is an optional
|
9
|
+
find('[name="commit"]').click
|
10
|
+
|
11
|
+
employee.reload
|
12
|
+
|
13
|
+
employee.section.should == 'SEC'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.feature "Optionals with one record", type: :feature do
|
4
|
+
scenario "Selecting all", js: true do
|
5
|
+
employee = Employee.create name: 'E1', admin: true, vegan: false
|
6
|
+
visit collection_edit_employees_path(ids: [employee.id])
|
7
|
+
|
8
|
+
find('#collection_section').set 'SEC'
|
9
|
+
find('[name="commit"]').click
|
10
|
+
|
11
|
+
employee.reload
|
12
|
+
|
13
|
+
employee.section.should == 'SEC'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin ter Kuile
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,6 +192,20 @@ dependencies:
|
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: capybara-screenshot
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: poltergeist
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +262,34 @@ dependencies:
|
|
248
262
|
- - ">="
|
249
263
|
- !ruby/object:Gem::Version
|
250
264
|
version: '0'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: spring-commands-rspec
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0'
|
272
|
+
type: :development
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: quiet_assets
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
251
293
|
- !ruby/object:Gem::Dependency
|
252
294
|
name: active_attr
|
253
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -314,6 +356,7 @@ files:
|
|
314
356
|
- app/controllers/record_collection/application_controller.rb
|
315
357
|
- app/helpers/record_collection/application_helper.rb
|
316
358
|
- app/views/layouts/record_collection/application.html.erb
|
359
|
+
- config/spring.rb
|
317
360
|
- lib/generators/collection_scaffold/collection_scaffold_generator.rb
|
318
361
|
- lib/generators/collection_scaffold/templates/_form.html.haml
|
319
362
|
- lib/generators/collection_scaffold/templates/_form.html.slim
|
@@ -408,6 +451,8 @@ files:
|
|
408
451
|
- spec/dummy/public/500.html
|
409
452
|
- spec/dummy/public/favicon.ico
|
410
453
|
- spec/features/multi_select_spec.rb
|
454
|
+
- spec/features/optional_text_field_with_normal_resource_spec.rb
|
455
|
+
- spec/features/optionals_with_one_record_spec.rb
|
411
456
|
- spec/features/translations_spec.rb
|
412
457
|
- spec/fixtures/collections.rb
|
413
458
|
- spec/rails/form_builder_spec.rb
|
@@ -507,6 +552,8 @@ test_files:
|
|
507
552
|
- spec/dummy/public/500.html
|
508
553
|
- spec/dummy/public/favicon.ico
|
509
554
|
- spec/features/multi_select_spec.rb
|
555
|
+
- spec/features/optional_text_field_with_normal_resource_spec.rb
|
556
|
+
- spec/features/optionals_with_one_record_spec.rb
|
510
557
|
- spec/features/translations_spec.rb
|
511
558
|
- spec/fixtures/collections.rb
|
512
559
|
- spec/rails/form_builder_spec.rb
|