dato 0.5.0 → 0.5.1

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: 8d26b49c17a15d3cf199eb8f61d41ff39ca047171c948fe3e9a8c399b333be9f
4
- data.tar.gz: c106df7971a5a76deb4757f12dec298292d0d4210fa133dde8996fc2bc018f35
3
+ metadata.gz: a9b90a79945cd778861e44a0d09bfffad27a606d4f51e448cf3a83c85ef98b5a
4
+ data.tar.gz: 9dfa1d22880392d377e0fd15d2f72302c7acbc242d58d954ebfe7fa4242e1a26
5
5
  SHA512:
6
- metadata.gz: b79aa89dfa3390ed806c67dd1c22b8294b80087c482b68e0b041bf4e0d560dd515e72f87875bb81a9193a039d7420819f1a87eae29565d10d73c4da17d186f92
7
- data.tar.gz: af030722407d485affdf563b368dd3963cad1c2e34a58f9f04574e32d12989db47122ad61d34e50ec19581ddc4d7e0346a7af0617a01b63eda5c37ed926a7ebd
6
+ metadata.gz: 29413d8c200bcc4c648151409d6be67889edb172325fc78e8b9d81d4042eae7c6a880aef623c505a2c697ec727577d393b4cdff861f8f2369ce63ec1cf20485d
7
+ data.tar.gz: 46b2fb45112a58f7942deeda7143d2493976ae4957f2a6996b75b06c56cdb892a142355da83f09cbed705bacf249f9c7249f2ba652eb64b6199dccfed16bb7b8
@@ -7,7 +7,7 @@ module Dato
7
7
  class Gallery < Array
8
8
  def self.parse(value, repo)
9
9
  images = if value
10
- value.map { |image| FieldType::Image.parse(image, repo) }
10
+ value.map { |image| FieldType::File.parse(image, repo) }
11
11
  else
12
12
  []
13
13
  end
@@ -0,0 +1,43 @@
1
+ module Dato
2
+ module Local
3
+ module FieldType
4
+ class Theme
5
+ attr_reader :primary_color, :dark_color, :light_color, :accent_color
6
+
7
+ def self.parse(value, repo)
8
+ value && new(
9
+ value[:logo],
10
+ value[:primary_color],
11
+ value[:dark_color],
12
+ value[:light_color],
13
+ value[:accent_color],
14
+ repo
15
+ )
16
+ end
17
+
18
+ def initialize(logo, primary_color, dark_color, light_color, accent_color, repo)
19
+ @logo = logo
20
+ @primary_color = primary_color
21
+ @dark_color = dark_color
22
+ @light_color = light_color
23
+ @accent_color = accent_color
24
+ @repo = repo
25
+ end
26
+
27
+ def logo
28
+ @logo && File.parse(@logo, @repo)
29
+ end
30
+
31
+ def to_hash(*args)
32
+ {
33
+ primary_color: primary_color,
34
+ dark_color: dark_color,
35
+ light_color: light_color,
36
+ accent_color: accent_color,
37
+ logo: logo && logo.to_hash(*args)
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -10,7 +10,7 @@ module Dato
10
10
  extend Forwardable
11
11
 
12
12
  attr_reader :entity
13
- def_delegators :entity, :id, :name, :locales, :theme, :domain,
13
+ def_delegators :entity, :id, :name, :locales, :domain,
14
14
  :internal_domain, :no_index, :frontend_url
15
15
 
16
16
  def initialize(entity, items_repo)
@@ -22,6 +22,10 @@ module Dato
22
22
  read_attribute(:global_seo, FieldType::GlobalSeo, locales.size > 1)
23
23
  end
24
24
 
25
+ def theme
26
+ read_attribute(:theme, FieldType::Theme, false)
27
+ end
28
+
25
29
  def favicon
26
30
  read_attribute(:favicon, FieldType::File, false)
27
31
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dato
3
- VERSION = '0.5.0'
3
+ VERSION = '0.5.1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -413,6 +413,7 @@ files:
413
413
  - lib/dato/local/field_type/slug.rb
414
414
  - lib/dato/local/field_type/string.rb
415
415
  - lib/dato/local/field_type/text.rb
416
+ - lib/dato/local/field_type/theme.rb
416
417
  - lib/dato/local/field_type/video.rb
417
418
  - lib/dato/local/item.rb
418
419
  - lib/dato/local/items_repo.rb