material 0.2.4 → 0.2.5

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: 88f2a2d8d129924e5d46d1b4aea5c20899881bfa9cc6fef8257b72f090100d14
4
- data.tar.gz: 57e09dea4a1b3362d1c05ff555083d9ff6ea4085d88cc9eb5919913cee360c85
3
+ metadata.gz: 8279b10fccaede2aaf3ef990399617bdfabd46b213b9b9774cf6de1502338836
4
+ data.tar.gz: ee43a57b87a21111e0b47ef3ca06d2861dca397e42c3ed08d37be25da26a5fe4
5
5
  SHA512:
6
- metadata.gz: d3c7400b821bcbd761fdc9c82eff9554dbc0ef17ac84fd3940c54ca2a2d4317a029bb84620ae4efbb17ba30f1fbd8ad890f4fa8e54e7dc0a812d62746f13b580
7
- data.tar.gz: 30051f56564d0b269f85565f53d7c2017fd2942688c290bca9498724a0384b76538d90f5f568058a8f500e72448375615134b27b56050208ec132b2bd045f83f
6
+ metadata.gz: be24dda8c6754c0ef85209f36db000c8d68367cb41231f3eba7591f4bede44eff097fed9c7e209c853f51a588b9c0f4a72e38e5672e5c816db307417ff1cf749
7
+ data.tar.gz: d3656bc0374d3db9437622acc9d0142ce7737bece05e1e87c6cc98bfbf5f2f343bcee8f0f7c6f8d4b4352fc22fdc353cecda2b03abec2814aac95da14df570bf
data/lib/material/base.rb CHANGED
@@ -6,7 +6,7 @@ module Material
6
6
  include Material::Core
7
7
  include Material::Icon
8
8
  include Material::Text
9
- include Material::Page
9
+ include Material::Site
10
10
  include Material::For
11
11
 
12
12
  def self.for(object)
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Material
4
+ module Site
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ register_component :parent
9
+ register_component :filter
10
+ register_component :filter_default
11
+ register_path_component(:path, :singular_route_key)
12
+ register_path_component(:index_path, :route_key)
13
+ end
14
+
15
+ class_methods do
16
+ def register_path_component(key, route_key_method)
17
+ register_component(key) do
18
+ route_key = try(:model_name)&.public_send(route_key_method)
19
+ "#{route_key}_path".to_sym if route_key.present?
20
+ end
21
+
22
+ define_method("#{key}?") do
23
+ return false unless defined?(Rails)
24
+
25
+ Rails.application.routes.url_helpers.respond_to?(public_send("#{key}_value".to_sym))
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
data/lib/material/list.rb CHANGED
@@ -9,7 +9,7 @@ module Material
9
9
  include Material::Components
10
10
  include Material::Icon
11
11
  include Material::Text
12
- include Material::Page
12
+ include Material::Site
13
13
  include Material::For
14
14
 
15
15
  def self.for(object)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Material
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
data/lib/material.rb CHANGED
@@ -8,7 +8,7 @@ require_relative "material/concerns/components"
8
8
  require_relative "material/concerns/core"
9
9
  require_relative "material/concerns/icon"
10
10
  require_relative "material/concerns/text"
11
- require_relative "material/concerns/page"
11
+ require_relative "material/concerns/site"
12
12
  require_relative "material/concerns/for"
13
13
 
14
14
  require "material/version"
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.4
4
+ version: 0.2.5
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-08-09 00:00:00.000000000 Z
11
+ date: 2019-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -212,7 +212,7 @@ files:
212
212
  - lib/material/concerns/core.rb
213
213
  - lib/material/concerns/for.rb
214
214
  - lib/material/concerns/icon.rb
215
- - lib/material/concerns/page.rb
215
+ - lib/material/concerns/site.rb
216
216
  - lib/material/concerns/text.rb
217
217
  - lib/material/list.rb
218
218
  - lib/material/rspec/custom_matchers.rb
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Material
4
- module Page
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- register_component :parent
9
- register_component :filter
10
- register_component :filter_default
11
- end
12
- end
13
- end