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 +4 -4
- data/lib/material/base.rb +1 -1
- data/lib/material/concerns/site.rb +30 -0
- data/lib/material/list.rb +1 -1
- data/lib/material/version.rb +1 -1
- data/lib/material.rb +1 -1
- metadata +3 -3
- data/lib/material/concerns/page.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8279b10fccaede2aaf3ef990399617bdfabd46b213b9b9774cf6de1502338836
|
4
|
+
data.tar.gz: ee43a57b87a21111e0b47ef3ca06d2861dca397e42c3ed08d37be25da26a5fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be24dda8c6754c0ef85209f36db000c8d68367cb41231f3eba7591f4bede44eff097fed9c7e209c853f51a588b9c0f4a72e38e5672e5c816db307417ff1cf749
|
7
|
+
data.tar.gz: d3656bc0374d3db9437622acc9d0142ce7737bece05e1e87c6cc98bfbf5f2f343bcee8f0f7c6f8d4b4352fc22fdc353cecda2b03abec2814aac95da14df570bf
|
data/lib/material/base.rb
CHANGED
@@ -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
data/lib/material/version.rb
CHANGED
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/
|
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
|
+
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-
|
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/
|
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
|