material 0.2.19 → 0.2.20

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
  SHA256:
3
- metadata.gz: cc011f11790c4395ee4dedf125b9ae64493a83381e67ce160b71fe13e3b0004d
4
- data.tar.gz: 941a9be1d46eabc029020f8a6aa9ea98ed90bde382e4832e2045c0d37e29ab9e
3
+ metadata.gz: 2a4791e4e4d226abbbecb0820ee50ef195cc11eefb7eed6574e82d00672f60f0
4
+ data.tar.gz: 837bdee1cfa4e8ad7c24f97434ffe908d8139951eee655deaec63eb9c1ea9011
5
5
  SHA512:
6
- metadata.gz: 57ff00f49fde41c883e4138477ee88ee829afcdc6d9998b7aa84d201e134e278262070852b141825e5bbfaf9e78a7b8580513cc96dcdb0bb486189b4c8db6df5
7
- data.tar.gz: 474fb3c570303d8a58b855ceabc29ef03ca7dfc068c7f62195ea0f708cde224083aebb07251a93566521c7a4a66135121cb7346cd300970c4349557ededa1600
6
+ metadata.gz: 86c5271b33081010631cbc08138353a5ec112ea5f81eb2aad680edcf635008869c9481e7b071406fedfd60b49281f9eefc885c092c9965282337611930510db5
7
+ data.tar.gz: be8ba2fa048adf65af6c78e30539da5c162a1ff562df03b4d636967eee0199928f3c38b7e39c017afe1762843e36d969855880cb545204f753682e07ec10285a
@@ -61,7 +61,8 @@ module Material
61
61
  end
62
62
 
63
63
  def value_for(object)
64
- object.instance_eval(&@value).dup if @value.respond_to?(:call)
64
+ value = object.instance_eval(&@value) if @value.respond_to?(:call)
65
+ value.is_a?(Class) ? value : value.dup if value.present?
65
66
  end
66
67
 
67
68
  def configure(**opts, &block)
@@ -5,7 +5,7 @@ module Material
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- register_component :parent
8
+ register_component(:parent) { default_parent }
9
9
  register_component :filter
10
10
  register_component :filter_default
11
11
  register_path_component(:path, :singular_route_key)
@@ -27,5 +27,9 @@ module Material
27
27
  end
28
28
  end
29
29
  end
30
+
31
+ def default_parent
32
+ nil
33
+ end
30
34
  end
31
35
  end
data/lib/material/list.rb CHANGED
@@ -19,6 +19,14 @@ module Material
19
19
  end
20
20
  end
21
21
 
22
+ def contextualize(parent)
23
+ @context_parent = parent
24
+ end
25
+
26
+ def default_parent
27
+ @context_parent
28
+ end
29
+
22
30
  def default_title
23
31
  (item_class.try(:model_name)&.human || item_class&.name).pluralize || self.class.name
24
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Material
4
- VERSION = "0.2.19"
4
+ VERSION = "0.2.20"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-13 00:00:00.000000000 Z
11
+ date: 2019-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport