dato-rails 0.7.0 → 0.7.3

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
  SHA256:
3
- metadata.gz: 749f20170663bb4bccf768abb34aa420530affa26573f9b5f86fe3b6aa69d169
4
- data.tar.gz: d6125ac3828889b22f0c4434b765f5a2570c5200fa3e2aec8e44440bab2aa866
3
+ metadata.gz: e08eaabd558518c83178db908c5d4c0e7829f5d28241b05a9eb3c9ea3449d84d
4
+ data.tar.gz: 22173dc5421c8c1fbd2fc3b844eebdfcc1876dbfd04f9c04c573878ca1694efe
5
5
  SHA512:
6
- metadata.gz: 15760b48a1ca878ac2ca1bedea696d2d55d6c144f1fa1ac614000806d4da9e5c45825252e6f8be074d9b4ae813ac67b3feb5a87c47ef9dfb91aba90ee38a5e4b
7
- data.tar.gz: fcf53744435481c917eb80bdc8cddf5e6bc3fa507e1049b457dad62cda150405c8abbdc40d1e8656d89baeb2273b871f3442b1290809d7fbcf3994dc7d6e22c5
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/client.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  module Dato
2
2
  class Client
3
- delegate :live!, to: :@gql_client
4
- delegate :execute!, to: :@gql_client
5
- attr_reader :items
3
+ delegate :live!, :execute!, :execute, to: :@gql
4
+ attr_reader :items, :gql
6
5
 
7
6
  def initialize(api_token = Dato::Config.api_token, validate_query: false, preview: false, live: false)
8
7
  @api_token = api_token
9
- @gql_client = Dato::Gql.new(api_token, validate_query, preview, live)
8
+ @gql = Dato::Gql.new(api_token, validate_query, preview, live)
10
9
  @items = Dato::Items.new(api_token)
11
10
  end
12
11
  end
data/lib/dato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dato
2
- VERSION = "0.7.0"
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.0
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-04-26 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.