cookbook 0.1.5 → 0.1.6
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/VERSION +1 -1
- data/app/assets/javascript/cookbook/addFields.js +41 -0
- data/app/assets/javascript/cookbook/application.js +2 -0
- data/app/assets/javascript/cookbook/removeFields.js +36 -0
- data/app/helpers/cookbook/application_helper.rb +39 -0
- data/app/views/cookbook/_fields.html.haml +3 -3
- data/app/views/cookbook/_use_fields.html.haml +22 -0
- data/cookbook.gemspec +6 -3
- data/lib/cookbook.rb +0 -1
- data/spec/dummy/app/javascript/packs/application.js +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1788 -0
- data/spec/dummy/log/test.log +2447 -0
- data/spec/requests/how_tos_spec.rb +3 -3
- data/spec/requests/recipes_spec.rb +3 -3
- metadata +5 -2
- data/app/views/cookbook/uses/_fields.html.haml +0 -17
@@ -69,13 +69,13 @@ module Cookbook
|
|
69
69
|
let(:new_attributes) do
|
70
70
|
{
|
71
71
|
name: 'Foo',
|
72
|
-
tool_uses_attributes:
|
73
|
-
{
|
72
|
+
tool_uses_attributes: {
|
73
|
+
0 => {
|
74
74
|
use_of_id: tool.id,
|
75
75
|
use_of_type: 'Tool',
|
76
76
|
note: 'Test Note'
|
77
77
|
}
|
78
|
-
|
78
|
+
}
|
79
79
|
}
|
80
80
|
end
|
81
81
|
context 'with valid parameters' do
|
@@ -71,13 +71,13 @@ module Cookbook
|
|
71
71
|
let(:new_attributes) do
|
72
72
|
{
|
73
73
|
name: 'Foo',
|
74
|
-
ingredient_uses_attributes:
|
75
|
-
{
|
74
|
+
ingredient_uses_attributes: {
|
75
|
+
0 => {
|
76
76
|
use_of_id: ingredient.id,
|
77
77
|
use_of_type: 'Ingredient',
|
78
78
|
note: 'Test Note'
|
79
79
|
}
|
80
|
-
|
80
|
+
}
|
81
81
|
}
|
82
82
|
end
|
83
83
|
context 'with valid parameters' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Lundgren
|
@@ -339,14 +339,17 @@ files:
|
|
339
339
|
- README.md
|
340
340
|
- Rakefile
|
341
341
|
- VERSION
|
342
|
+
- app/assets/javascript/cookbook/addFields.js
|
343
|
+
- app/assets/javascript/cookbook/application.js
|
344
|
+
- app/assets/javascript/cookbook/removeFields.js
|
342
345
|
- app/assets/stylesheets/cookbook/application.scss
|
343
346
|
- app/controllers/concerns/cookbook/params.rb
|
344
347
|
- app/helpers/cookbook/application_helper.rb
|
345
348
|
- app/models/cookbook/use.rb
|
346
349
|
- app/views/cookbook/_fields.html.haml
|
350
|
+
- app/views/cookbook/_use_fields.html.haml
|
347
351
|
- app/views/cookbook/_used_in.html.haml
|
348
352
|
- app/views/cookbook/_uses_of.html.haml
|
349
|
-
- app/views/cookbook/uses/_fields.html.haml
|
350
353
|
- bin/rails
|
351
354
|
- config/initializers/simple_form.rb
|
352
355
|
- config/locales/simple_form.en.yml
|
@@ -1,17 +0,0 @@
|
|
1
|
-
:ruby
|
2
|
-
table_sym = form.object_name.gsub(/[^\[]+\[([^\]]+)_uses_attributes\].*/, "\\1").pluralize
|
3
|
-
model = table_sym.to_s.classify.constantize
|
4
|
-
collection = if Cookbook.configuration.authorize_with == :cancancan
|
5
|
-
model.accessible_by(current_ability, :select)
|
6
|
-
else
|
7
|
-
model.all
|
8
|
-
end
|
9
|
-
= form.hidden_field :use_of_type, value: model.model_name.to_s
|
10
|
-
= form.input :use_of_id, collection: collection, as: :select, label_method: model.label_method, value_method: :id, selected: form.object.use_of_id, include_blank: "Select #{model.model_name.human}"
|
11
|
-
= form.input :quantity_minimum
|
12
|
-
= form.input :quantity_maximum
|
13
|
-
= form.input :unit
|
14
|
-
= form.input :sort
|
15
|
-
= form.input :preparation, hint: 'like "crushed" or "greased"'
|
16
|
-
= form.input :note, hint: 'like "to taste"'
|
17
|
-
= link_to_remove_nested(form, link_classes: 'button button-danger')
|