middleman-cta 0.0.1 → 0.1.0

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: 43aacba735c49bff1a1ea2c8bd11fed95dd1687b
4
- data.tar.gz: 17fbd341da86f1cfcb872fda91d97120bc984e40
3
+ metadata.gz: d57a9384348648ec7c2af974a14a5ce71cca7bad
4
+ data.tar.gz: b0d5182897898087548c3f9877821ed76baf9eaf
5
5
  SHA512:
6
- metadata.gz: 8bcc4b6a4ce83b9c63922a5eaad40a001cae5782498f82ef37c5271c74566cbe6c571797572bc69b1e182df6f18a5e735ebd39e14f4c6d7999a296faec01fe68
7
- data.tar.gz: 0f79ae47d426e781a73951c6d276c4308dc28c174a2398c7a9639b5b9ff37b42570e56b56c35092d1834a2a93566b39f775619f003991e1a272b5a5db370c525
6
+ metadata.gz: 4090e3fc8f741419f6916b606fc6a734fd3607a5f4f08492517c5c6d0d87a89073f9ae520ee17e4443b3ff6b72131f1dd0b26244eb503a71afd6c352bee8c490
7
+ data.tar.gz: 5b09e0f424772683077c64098265097d19080d6c28c183ffbf0afb3746d369bb567e479392a2c1a3321a2697b57df5fc53792417443e5bba818fae3ae9ee2206
data/README.md CHANGED
@@ -27,6 +27,18 @@ In your `data/cta.yml` (or JSON):
27
27
  url: "http://absolute.url"
28
28
  ```
29
29
 
30
+ If you prefer, you can link using a sitemap descriptor instead - meaning any item defined in your middelman site.
31
+
32
+ ```json
33
+ [
34
+ {
35
+ "id": "great-cta",
36
+ "image": "name-of-file-in-cta-image-dir.jpg",
37
+ "url": "/my/great/page/index.html"
38
+ }
39
+ ]
40
+ ```
41
+
30
42
  ## Configuration
31
43
  You can configure the name of the data file, as well as the directory in which the images are stored.
32
44
 
data/lib/cta/extension.rb CHANGED
@@ -37,7 +37,7 @@ module CTA
37
37
 
38
38
  options[:class] ||= 'cta-image'
39
39
 
40
- link_to result.url, class: 'cta-link' do
40
+ link_to result.url_for(sitemap), class: 'cta-link' do
41
41
  image_tag(File.join(cta_controller.options.cta_directory, result.image), options)
42
42
  end
43
43
  end
data/lib/cta/instance.rb CHANGED
@@ -7,5 +7,12 @@ module CTA
7
7
  self.public_send("#{ key }=", value)
8
8
  end
9
9
  end
10
+
11
+ def url_for(sitemap)
12
+ uri = URI(url)
13
+ return url if uri.absolute?
14
+
15
+ sitemap.find_resource_by_path(url)
16
+ end
10
17
  end
11
18
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "middleman-cta"
6
- s.version = "0.0.1"
6
+ s.version = "0.1.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Matt Millsaps-Brewer"]
9
9
  s.email = ["matt@madebylotus.com"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-cta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Millsaps-Brewer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core