cortex-snippets-client 1.0.1 → 1.0.2
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 +4 -4
- data/CHANGELOG.md +1 -0
- data/lib/cortex/snippets/client.rb +6 -4
- data/lib/cortex/snippets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a5c0a4eeb33d9d9e45f84b15985558557348f5
|
4
|
+
data.tar.gz: bbc4d7895bc5ef3db28aef653a255368b1f0a6f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7ad501e402f2f287d4912862a606d147556fd5a2eceec565587bde938b4f3d82456e74f60a5206c5477759c3ce1dc26901855360c654e5734af9ab9c2a028b7
|
7
|
+
data.tar.gz: f4a505eeed0eb49cc7e5835a0626313500323787cd4d3ce5458f808672e6cf91a8a03eadd4e8a12ab57d84f541f9540c5df04b5179dbecd3991afc7f57303270
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@ Version History
|
|
3
3
|
* All Version bumps are required to update this file as well!!
|
4
4
|
----
|
5
5
|
|
6
|
+
* 1.0.2 - Add TranslationHelper for content_tag and remove capture concern
|
6
7
|
* 1.0.1 - Fix namespacing bug for Cortex::Snippets::Client
|
7
8
|
* 1.0.0 - Multi-tenancy Rebuild, now takes in Cortex Client
|
8
9
|
* 0.8.1 - Dependency upgrades, etc
|
@@ -4,22 +4,24 @@ require 'addressable/uri'
|
|
4
4
|
module Cortex
|
5
5
|
module Snippets
|
6
6
|
class Client
|
7
|
+
include ActionView::Helpers::TranslationHelper
|
8
|
+
|
7
9
|
def initialize(cortex_client)
|
8
10
|
@cortex_client = cortex_client
|
9
11
|
end
|
10
12
|
|
11
|
-
def snippet(options = {},
|
12
|
-
snippets = current_webpage.snippets || []
|
13
|
+
def snippet(request, options = {}, block)
|
14
|
+
snippets = current_webpage(request).snippets || []
|
13
15
|
snippet = snippets.find { |snippet| snippet[:document][:name] == options[:id] }
|
14
16
|
|
15
17
|
if snippet.nil? || snippet[:document][:body].nil? || snippet[:document][:body].empty?
|
16
|
-
content_tag(:snippet,
|
18
|
+
content_tag(:snippet, block, options)
|
17
19
|
else
|
18
20
|
content_tag(:snippet, snippet[:document][:body].html_safe, options)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
def current_webpage
|
24
|
+
def current_webpage(request)
|
23
25
|
if defined?(Rails)
|
24
26
|
url = sanitized_webpage_url(request.original_url)
|
25
27
|
Rails.cache.fetch("webpages/#{@cortex_client.access_token.client.id}/#{url}", race_condition_ttl: 10) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cortex-snippets-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CareerBuilder Employer Site & Content Products
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cortex-client
|