dato-rails 0.7.1 → 0.7.3

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
  SHA256:
3
- metadata.gz: 7753883f681ceec3735a3ada67751e4ef59256775f99ddc4916c469e42119d83
4
- data.tar.gz: 721f2b1c13b67796a74626bb9844b9d07aa6b0911f068e926fa1154cb4a76960
3
+ metadata.gz: e08eaabd558518c83178db908c5d4c0e7829f5d28241b05a9eb3c9ea3449d84d
4
+ data.tar.gz: 22173dc5421c8c1fbd2fc3b844eebdfcc1876dbfd04f9c04c573878ca1694efe
5
5
  SHA512:
6
- metadata.gz: 24b79eac4a15ca805d42151faa392f4174cdb53ccd5a9f253021d6f37c80736ace8a14ce04331e22acdaeb855abe39d99a7b3702fee140d49c6d586448d10791
7
- data.tar.gz: fcf8912566cc3a242290a53b82e8337fe3306a7d6aea2073caba9ed8027923424ab173048974abdbd799f5843bb095711ada2ab415f6956e80a54ab479105e26
6
+ metadata.gz: e0109bd3b767231c28917403f0ca96e9a207dbc9fb593cb6a41c83dc853c33ef58018a5a8cd643382c38ed7f85c8c5a817d3f4cb6d73570f1434fd5ec49fdcaa
7
+ data.tar.gz: 5c6b4b06e93b9a79379c7e70fecb578518090047aeb8afa869e08c39275842f158503ff4ed4906d06cccdf144947168d0310d28247b4f626bc4bcadc019ad315
data/README.md CHANGED
@@ -232,7 +232,7 @@ You can take advantage of the publish mechanism of Dato CMS to expire the cache.
232
232
 
233
233
  ## Development
234
234
 
235
- After checking out the repo, run `bin/setup` to install dependencies.
235
+ After checking out the repo, run `bundle install` to install dependencies.
236
236
 
237
237
  You can now clone the dato-rails project
238
238
 
@@ -245,7 +245,7 @@ to consume data from your project.
245
245
 
246
246
  Then, run `bundle exec rspec` to run the tests.
247
247
 
248
- You can also run `bin/console` for an interactive prompt that will allow you to experiment.
248
+ You can also run `rails console` for an interactive prompt that will allow you to experiment.
249
249
 
250
250
  To install this gem onto your local machine, run `bundle exec rake install`.
251
251
  To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/setup"
2
2
 
3
- APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
4
  load "rails/tasks/engine.rake"
5
5
 
6
6
  load "rails/tasks/statistics.rake"
@@ -1,9 +1,11 @@
1
- <%= content_tag generated_tag, class: "dato-cms-#{@node.type}" do %>
2
- <% @node.children&.each do |node| %>
3
- <%= render_node(node) %>
1
+ <figure class="dato-cms-figure">
2
+ <%= content_tag generated_tag, class: "dato-cms-#{@node.type}" do %>
3
+ <% @node.children&.each do |node| %>
4
+ <%= render_node(node) %>
5
+ <% end %>
4
6
  <% end %>
5
- <% end %>
6
7
 
7
- <p class="dato-cms-attribution">
8
- <%= @node.attribution %>
9
- </p>
8
+ <figcaption class="dato-cms-attribution">
9
+ <%= @node.attribution %>
10
+ </figcaption>
11
+ </figure>
@@ -1,6 +1,6 @@
1
- <%= content_tag generated_tag, class: "dato-cms-#{@node.type}" do %>
2
- <%= @node.value %>
3
- <% @node.children&.each do |node| %>
4
- <%= render_node(node) %>
5
- <% end %>
6
- <% end %>
1
+ <%= content_tag generated_tag, class: "dato-cms-#{@node.type}" do -%>
2
+ <%= @node.value -%>
3
+ <% @node.children&.each do |node| -%>
4
+ <%= render_node(node) -%>
5
+ <% end -%>
6
+ <% end -%>
@@ -1,5 +1,5 @@
1
- <a href="<%=@node.url %>" class="dato-cms-<%=@node.type %>">
2
- <% @node.children&.each do |node| %>
3
- <%= render_node(node) %>
4
- <% end %>
5
- </a>
1
+ <%= tag.a(**link_attributes) do -%>
2
+ <% @node.children&.each do |node| -%>
3
+ <%= render_node(node) -%>
4
+ <% end -%>
5
+ <% end -%>
@@ -8,4 +8,19 @@ class Dato::Link < Dato::DastNode
8
8
  def generated_tag
9
9
  "a"
10
10
  end
11
+
12
+ def link_attributes
13
+ attr = {
14
+ "href" => @node.url,
15
+ "class" => "dato-cms-#{@node.type}",
16
+ }
17
+ %w[rel target].each { |type| attr[type] = extract_meta(type) }
18
+ attr
19
+ end
20
+
21
+ private
22
+
23
+ def extract_meta(type)
24
+ @node.meta&.find { |m| m.id == type }&.value
25
+ end
11
26
  end
@@ -1,5 +1,5 @@
1
- <%= conditional_tag 'code', code_span?, class: "dato-cms-span-wrapper" do %>
2
- <%= content_tag 'span', class: "dato-cms-span", style: styles do %>
3
- <%= @node.value %>
4
- <% end %>
5
- <% end %>
1
+ <%= conditional_tag 'code', code_span?, class: "dato-cms-span-wrapper" do -%>
2
+ <%= content_tag 'span', class: "dato-cms-span", style: styles do -%>
3
+ <%= @node.value -%>
4
+ <% end -%>
5
+ <% end -%>
data/lib/dato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dato
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-02 00:00:00.000000000 Z
11
+ date: 2023-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  - !ruby/object:Gem::Version
240
240
  version: '0'
241
241
  requirements: []
242
- rubygems_version: 3.4.1
242
+ rubygems_version: 3.4.10
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: Use Dato CMS in your Rails application.