inferred_crumpets 0.1.2 → 0.2.0

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: c254e2775250e0edbe1538b9755690418d5d9981
4
- data.tar.gz: 960e259aa006dcdd54b8e2320f11ef7a66f9c049
3
+ metadata.gz: 721a182a6b0d426b2ef9d043d8463a07d893aa0c
4
+ data.tar.gz: 6b28fbdeb2a8db15ca0b881738e02b8282be6651
5
5
  SHA512:
6
- metadata.gz: 0f543722bafb28f88c22ce2420bf3867c6ce3669de38f31085359d002e736f2ce9b4f5caa0b389b5aab3ffd1e5c3121cb147d30d94e35ded67d1dbce63abcf94
7
- data.tar.gz: ef13a3f10da1567e1950a584c8eb7363479f6d1dfe0ee13644067534069c9d34d91ae6dc9ea6a7d9621fc344b03b772bea87d2d35d834070010cf0d70aa46334
6
+ metadata.gz: 4d381a2f21bfdf5c2131dc3ce155ee3b44464cbda59f197960416c3aeea4e096e5adc0043a2f4b4f5ebd7f7cf4409cd9a4c01bec378cf83a5bd9186ffde1e226
7
+ data.tar.gz: 8a5817999bd0e1ac16371197697ab613a0c83293603ba4cfc592840ce1b22fe2d88c0a4c7393c6bb6fc99566016d85e8a3f677e85cd68adace027dca40e8be46
@@ -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? ? subject : subject_with_parents)
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(subject)
94
+ view_context.url_for(transformed_subject)
93
95
  rescue NoMethodError
94
96
  false
95
97
  end
@@ -1,3 +1,3 @@
1
1
  module InferredCrumpets
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  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.1.2
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-05-22 00:00:00.000000000 Z
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