inferred_crumpets 0.1.2 → 0.2.0
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 +18 -0
- data/lib/inferred_crumpets/builder.rb +5 -3
- data/lib/inferred_crumpets/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 721a182a6b0d426b2ef9d043d8463a07d893aa0c
|
|
4
|
+
data.tar.gz: 6b28fbdeb2a8db15ca0b881738e02b8282be6651
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d381a2f21bfdf5c2131dc3ce155ee3b44464cbda59f197960416c3aeea4e096e5adc0043a2f4b4f5ebd7f7cf4409cd9a4c01bec378cf83a5bd9186ffde1e226
|
|
7
|
+
data.tar.gz: 8a5817999bd0e1ac16371197697ab613a0c83293603ba4cfc592840ce1b22fe2d88c0a4c7393c6bb6fc99566016d85e8a3f677e85cd68adace027dca40e8be46
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# InferredCrumpets
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
* Fix: shallow routes no longer cause a routing error
|
|
6
|
+
* Change: collection crumb not shown if a parent is set and the collection is shallow routed
|
|
7
|
+
|
|
8
|
+
## 0.1.2
|
|
9
|
+
|
|
10
|
+
* Fix: non-index collection actions now work
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
* Update: works with Crumpet 0.3.0
|
|
15
|
+
|
|
16
|
+
## 0.1.0
|
|
17
|
+
|
|
18
|
+
* Initial release
|
|
@@ -42,6 +42,8 @@ module InferredCrumpets
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def build_crumb_for_collection!
|
|
45
|
+
return if parents.present? && shallow?
|
|
46
|
+
|
|
45
47
|
if subject.is_a?(ActiveRecord::Relation)
|
|
46
48
|
view_context.crumbs.add_crumb subject_name.pluralize.titleize
|
|
47
49
|
elsif subject.is_a?(ActiveRecord::Base)
|
|
@@ -69,13 +71,13 @@ module InferredCrumpets
|
|
|
69
71
|
|
|
70
72
|
def url_for_subject
|
|
71
73
|
return unless can_route?(:show, id: subject.id)
|
|
72
|
-
view_context.url_for(shallow? ?
|
|
74
|
+
view_context.url_for(shallow? ? transformed_subject : subject_with_parents)
|
|
73
75
|
end
|
|
74
76
|
|
|
75
77
|
def url_for_collection
|
|
76
78
|
return view_context.objects_path if view_context.objects_path.present?
|
|
77
79
|
return unless can_route?(:index)
|
|
78
|
-
view_context.url_for(class_with_parents)
|
|
80
|
+
view_context.url_for(shallow? ? transformed_subject.class : class_with_parents)
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
def subject_requires_transformation?
|
|
@@ -89,7 +91,7 @@ module InferredCrumpets
|
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
def shallow?
|
|
92
|
-
view_context.url_for(
|
|
94
|
+
view_context.url_for(transformed_subject)
|
|
93
95
|
rescue NoMethodError
|
|
94
96
|
false
|
|
95
97
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inferred_crumpets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Grant Colegate
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -90,6 +90,7 @@ files:
|
|
|
90
90
|
- ".gitignore"
|
|
91
91
|
- ".rspec"
|
|
92
92
|
- ".travis.yml"
|
|
93
|
+
- CHANGELOG.md
|
|
93
94
|
- CODE_OF_CONDUCT.md
|
|
94
95
|
- Gemfile
|
|
95
96
|
- LICENSE.txt
|