angular_rails_seo 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14e8eeba2c2a9dd8b9e751c0e003d9824389668c
4
- data.tar.gz: 1b95773ed1f5ba584c06aff6cea8a25d60a161ae
3
+ metadata.gz: 4e7ca23716b64c57e7ce96f35708c872b7339939
4
+ data.tar.gz: b25f4743146969869d577cd74bb0b750652ffcf8
5
5
  SHA512:
6
- metadata.gz: bd882cacc688e5f8250b2a20fe93db571af9576b415d0d67538768b6f8b6ccd2b8c6a124260f7092fd86a1fc62e8b25502ec5cc60b36c9660ab9ea4fa72913ec
7
- data.tar.gz: 6ba9a221b24114378ac606a36c2ffb2d1579614519d1af798fedf22dcfffd7ba6e2f31f355eb8c2d5bdd743000595f73f67098d689d8b27395c55e902a4d1b32
6
+ metadata.gz: 932f6142831f5802faeed75084baeefee5afcec7aa74ef7dd8207aaeab728fa808c5d93928b745bc51493af091b31fc07c27d791747030eac7c86e3cff66335c
7
+ data.tar.gz: 230d055a069204986a835fbc4806fa0aff49b201a64d6d39f237f5e4676274249f30a65083cb3f2d81dc66a4a159b2212dc659860ac0e7642fa1efe4aa8e3a0d
@@ -27,45 +27,52 @@ angular.module('angular-rails-seo', [])
27
27
  return paths;
28
28
  };
29
29
 
30
- // Finds the matching SEO entry for the given path, or returns default if
31
- // none is found
30
+ // Finds the matching SEO entry for the current path, or returns the default if none is found
32
31
  $seo.match = function(path) {
33
- var key, _i, _len, _ref;
34
- if (path != null) {
35
- _ref = Object.keys(paths);
36
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
37
- key = _ref[_i];
38
- if (paths[key].regex.test(path)) {
39
- return paths[key];
40
- }
32
+ var path = $location.path();
33
+ var pathKeys = Object.keys(paths);
34
+ var key, i;
35
+
36
+ if (path == null) {
37
+ return $seo.getDefaults();
38
+ }
39
+
40
+ for (var i = 0; i < pathKeys.length; i++) {
41
+ key = pathKeys[i];
42
+
43
+ if (paths[key].regex.test(path)) {
44
+ return paths[key];
41
45
  }
42
- return $seo.getDefault();
43
46
  }
47
+
48
+ return $seo.getDefault();
44
49
  };
45
50
 
46
- // Shows data as corresponds to path. If data is set to exclude, no data
47
- // will be set as it's expected that the user will do it manually
48
- $seo.setPath = function(path) {
49
- var data;
50
- data = $seo.match(path);
51
+ // If we found a matching path entry apply it, otherwise use the default
52
+ $seo.refresh = function() {
53
+ var data = $seo.match();
54
+
51
55
  if (data != null) {
52
56
  $seo.applyData(data);
53
57
  } else {
54
58
  $seo.applyData($seo.getDefault());
55
59
  }
56
- };
60
+ }
57
61
 
58
62
  // Assigns the routes as defined in seo.json
59
63
  $seo.setRoutes = function(data) {
60
- var key, _i, _len, _ref;
61
64
  paths = data;
62
- _ref = Object.keys(paths);
63
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
64
- key = _ref[_i];
65
+
66
+ var key;
67
+ var pathKeys = Object.keys(paths);
68
+
69
+ for (var i = 0; i < pathKeys.length; i++) {
70
+ key = pathKeys[i];
65
71
  paths[key].regex = new RegExp(paths[key].regex);
66
72
  }
73
+
67
74
  $rootScope.$on('$locationChangeStart', function(e, next, current) {
68
- $seo.setPath(next);
75
+ $seo.refresh();
69
76
  });
70
77
  };
71
78
 
@@ -1,3 +1,3 @@
1
1
  module AngularRailsSeo
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_rails_seo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Ellis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-27 00:00:00.000000000 Z
11
+ date: 2015-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec