record_collection 0.10.1 → 0.10.2
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -1
- data/app/assets/javascripts/record_collection/optionals.js.coffee +2 -0
- data/lib/record_collection/rails/form_builder.rb +1 -0
- data/lib/record_collection/version.rb +1 -1
- data/spec/dummy/app/views/projects/collection_edit.html.slim +1 -1
- data/spec/features/{optional_boolean_hint_spec.rb → optional_boolean_hint_and_append_text_spec.rb} +1 -0
- 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: fcab48b2d629719112ad1018b7db7ae7af101fdc
|
4
|
+
data.tar.gz: 08acdff4c80ebd73341af33e17906a50ed9fff6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56ca6b536b3dd12d31e34f1f647815180e871e9a1890e1c67d1c7b4d186378ee060d29a0d445adcaa14ca8c4ae77609abeeba8f62a3d79b2993e8d865c0b3ba6
|
7
|
+
data.tar.gz: a90ba75c5683a66f1294ad818df6485091df90a45fe8658d02aa9e470177b0d7b2ab9e8402337c2713b92bb58fb2689a57973bf47d5c4952554ae2cafbab1bf0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -154,7 +154,11 @@ class EmployeesController < ApplicationController
|
|
154
154
|
|
155
155
|
# GET /employees/collection_edit?ids[]=1&ids[]=3&...
|
156
156
|
def collection_edit
|
157
|
-
|
157
|
+
if params[:batch_id].present? # This is for feature demo, not for controller code practice
|
158
|
+
@collection = Employee::Collection.joins(:project).where(projects: {batch_id: params[:batch_id]})
|
159
|
+
else
|
160
|
+
@collection = Employee::Collection.find(params[:ids])
|
161
|
+
end
|
158
162
|
redirect_to employees_path, alert: 'No employees selected' if @collection.empty?
|
159
163
|
end
|
160
164
|
|
@@ -18,6 +18,7 @@ class Optionals
|
|
18
18
|
field_name = check_box.attr('name')
|
19
19
|
one = container.data('one')
|
20
20
|
hint_field = container.find('.optional-attribute-hint')
|
21
|
+
append_text_field = container.find('.optional-attribute-append')
|
21
22
|
|
22
23
|
label_text = container.find('label').text()
|
23
24
|
|
@@ -64,6 +65,7 @@ class Optionals
|
|
64
65
|
container.append value_toggle
|
65
66
|
container.append value_field
|
66
67
|
container.append hint_field if hint_field.length
|
68
|
+
container.append append_text_field if append_text_field.length
|
67
69
|
activator_toggle.hide() if one
|
68
70
|
|
69
71
|
prependActivator: (container)->
|
@@ -52,6 +52,7 @@ ActionView::Helpers::FormBuilder.class_eval do
|
|
52
52
|
# Hint tag is empty to make it easy to implement using js. Adding it as text is a better option than hiding the text.
|
53
53
|
# Graceful Degradation is not an option anyway
|
54
54
|
content += @template.content_tag(:span, nil, class: 'optional-attribute-hint', data: {hint: options[:hint]}) if options[:hint].present?
|
55
|
+
content += @template.content_tag(:span, options[:append_text], class: 'optional-attribute-append') if options[:append_text].present?
|
55
56
|
add_collection_ids @template.content_tag(:div, content, class: classes, data: get_data_attributes(attr, options))
|
56
57
|
end
|
57
58
|
|
@@ -2,7 +2,7 @@ h1 Edit multiple projects
|
|
2
2
|
= simple_form_for @collection, url: [:collection_update, @collection] do |f|
|
3
3
|
= render 'form_errors', target: @collection
|
4
4
|
.form-inputs= f.optional_boolean :finished, disabled: true
|
5
|
-
.form-inputs= f.optional_boolean :hint_visible, hint: "Check this one if the hint is visible. Hint testing"
|
5
|
+
.form-inputs= f.optional_boolean :hint_visible, hint: "Check this one if the hint is visible. Hint testing", append_text: "Just appending text must also be visible"
|
6
6
|
.form-inputs= f.optional_input :start_date
|
7
7
|
.form-inputs= f.optional_input :description, hint: "Hint normal display for other attributes, use .optional-attribute-hint with data-hint='abc' in your simple_form config to use the record_collection styling"
|
8
8
|
.form-actions= f.submit
|
data/spec/features/{optional_boolean_hint_spec.rb → optional_boolean_hint_and_append_text_spec.rb}
RENAMED
@@ -6,6 +6,7 @@ RSpec.feature "Hint with optional boolean", type: :feature do
|
|
6
6
|
visit collection_edit_projects_path(ids: [project.id])
|
7
7
|
|
8
8
|
page.should have_selector '.optional-attribute-container.hint_visible .optional-attribute-hint'
|
9
|
+
page.should have_selector '.optional-attribute-container.hint_visible .optional-attribute-append'
|
9
10
|
end
|
10
11
|
|
11
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin ter Kuile
|
@@ -514,7 +514,7 @@ files:
|
|
514
514
|
- spec/dummy/public/favicon.ico
|
515
515
|
- spec/features/disabled_boolean_spec.rb
|
516
516
|
- spec/features/multi_select_spec.rb
|
517
|
-
- spec/features/
|
517
|
+
- spec/features/optional_boolean_hint_and_append_text_spec.rb
|
518
518
|
- spec/features/optional_boolean_with_normal_resource_spec.rb
|
519
519
|
- spec/features/optional_date_field_all_nil_spec.rb
|
520
520
|
- spec/features/optional_text_field_with_normal_resource_spec.rb
|
@@ -639,7 +639,7 @@ test_files:
|
|
639
639
|
- spec/dummy/public/favicon.ico
|
640
640
|
- spec/features/disabled_boolean_spec.rb
|
641
641
|
- spec/features/multi_select_spec.rb
|
642
|
-
- spec/features/
|
642
|
+
- spec/features/optional_boolean_hint_and_append_text_spec.rb
|
643
643
|
- spec/features/optional_boolean_with_normal_resource_spec.rb
|
644
644
|
- spec/features/optional_date_field_all_nil_spec.rb
|
645
645
|
- spec/features/optional_text_field_with_normal_resource_spec.rb
|