angular_rails_seo 1.0.6 → 1.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b6ef66e28473ee46f95eb848316c3a7b19dcca1
|
4
|
+
data.tar.gz: 42be14f0827ea58796788122fea5d98e86facf88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b064d5da97630dd942c915db3e769fdf18a94880a358356f7763c034db9ff3e30b0404fe0979efed76ff67ce4522d5365b8a0926cc76c9df82980709757753b
|
7
|
+
data.tar.gz: cb8c6e37088dfc990a8e4138fc3e5aea1d98f096d435dd7db00af1276e21c5bbb8621c2d4489ec98224ca8357bc8a10ca36cd31a7b4b17054c5c3df4d5fb7be0
|
@@ -2,21 +2,51 @@ module AngularRailsSeo
|
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
4
|
##
|
5
|
-
# Returns SEO data as defined in
|
5
|
+
# Returns SEO data as defined in in seo.json
|
6
6
|
def seo_data
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
if @seo_data.nil?
|
8
|
+
Rails.configuration.seo.each do |key, value|
|
9
|
+
regex = Regexp.new(value["regex"]).match(request.path)
|
10
|
+
|
11
|
+
unless regex.nil?
|
12
|
+
data = Rails.configuration.seo[key]
|
13
|
+
fallback = data["parent"].blank? ? seo_default : seo_default.merge(Rails.configuration.seo[data["parent"]])
|
14
|
+
|
15
|
+
unless data["model"].blank?
|
16
|
+
response = seo_dynamic(data["model"])
|
17
|
+
data = response.nil? ? {} : response
|
18
|
+
end
|
19
|
+
|
20
|
+
@seo_data = fallback.merge(data)
|
21
|
+
end
|
10
22
|
end
|
11
23
|
end
|
12
24
|
|
13
|
-
seo_default
|
25
|
+
@seo_data ||= seo_default
|
14
26
|
end
|
15
27
|
|
16
28
|
def seo_default
|
17
29
|
Rails.configuration.seo["default"]
|
18
30
|
end
|
19
31
|
|
32
|
+
def seo_dynamic(class_name)
|
33
|
+
begin
|
34
|
+
klass = class_name.constantize
|
35
|
+
rescue
|
36
|
+
logger.warn "SEO: unable to retrieve SEO data for #{class_name}"
|
37
|
+
return nil
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
response = klass.send_method(:seo_match, regex[1..(regex.size - 1)])
|
42
|
+
rescue
|
43
|
+
logger.warn "SEO: couldn't call seo_match method of #{class_name}"
|
44
|
+
return nil
|
45
|
+
end
|
46
|
+
|
47
|
+
return response
|
48
|
+
end
|
49
|
+
|
20
50
|
##
|
21
51
|
# Author meta tags
|
22
52
|
def seo_meta_author
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angular_rails_seo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Ellis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rails
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|