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 +4 -4
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/app/components/dato/blockquote.html.erb +9 -7
- data/app/components/dato/dast_node.html.erb +6 -6
- data/app/components/dato/link.html.erb +5 -5
- data/app/components/dato/link.rb +15 -0
- data/app/components/dato/span.html.erb +5 -5
- data/lib/dato/client.rb +3 -4
- data/lib/dato/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e08eaabd558518c83178db908c5d4c0e7829f5d28241b05a9eb3c9ea3449d84d
|
4
|
+
data.tar.gz: 22173dc5421c8c1fbd2fc3b844eebdfcc1876dbfd04f9c04c573878ca1694efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 `
|
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 `
|
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,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
<
|
8
|
-
|
9
|
-
</
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
2
|
-
<% @node.children&.each do |node|
|
3
|
-
|
4
|
-
<% end
|
5
|
-
|
1
|
+
<%= tag.a(**link_attributes) do -%>
|
2
|
+
<% @node.children&.each do |node| -%>
|
3
|
+
<%= render_node(node) -%>
|
4
|
+
<% end -%>
|
5
|
+
<% end -%>
|
data/app/components/dato/link.rb
CHANGED
@@ -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
|
-
|
3
|
-
|
4
|
-
|
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: :@
|
4
|
-
|
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
|
-
@
|
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
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.
|
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-
|
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.
|
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.
|