dugway 1.0.10 → 1.0.13

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: 35b25d6267e8587b0d523fd8edf159a89b2f06990e9dd65d6997ff03588b208e
4
- data.tar.gz: f389c8591877e2c149a09457d0b6706c1ba09379e6e99551891b7de4a636b2c9
3
+ metadata.gz: c3efe750c07138767b6b491f5fd375df42560fa0dd77fd18e3f0bd10578667f5
4
+ data.tar.gz: 90ab41b88afa8995d7890612ecdd262f0cb2146dfea7c7b1eced3d99bd78744d
5
5
  SHA512:
6
- metadata.gz: 1f8838351d64308b7c4faa1b8532f736b7f12a8eb901473d4497350177b065d09dbe7fc31f64a08fa03cc96ffb3248d3046c93204e3fc6dedc6cc09d1771ed97
7
- data.tar.gz: 26c85d0eb999c2b7478f1c44ffb0b52900e06e5bad03f4846f82e27308af51d91ba5cfbfb47426ae695b81336da873dbd3619fc1d61282e5b7b67447e2094a3d
6
+ metadata.gz: 922ee155123b7f98a421bdf5039b707b48defa71a55296ecad5ac96185c587775885b78e4d3534462a52a35f86af23d69094e65df2bbbf58e217f06cbcfd00d6
7
+ data.tar.gz: 419a042a3b9fffb5d8951b27c06b300d996a95407bf634d988fced33eb3bb8af380eee29e2f157d87d19c045a60e13d3037f196980fb9b0a5c2be535cf14f230
data/README.md CHANGED
@@ -238,6 +238,6 @@ we use the **default** values from your **settings.json** file.
238
238
  },
239
239
  "background_color": "#CCCCCC",
240
240
  "show_search": true,
241
- "twitter_username": "bigcartel"
241
+ "instagram_username": "https://instagram.com/bigcartel"
242
242
  }
243
243
  ```
@@ -5,6 +5,16 @@ module Dugway
5
5
  class Build < Thor::Group
6
6
  include Thor::Actions
7
7
 
8
+ class_option 'skip-color-validation',
9
+ type: :boolean,
10
+ default: false,
11
+ desc: "Skip color settings validation"
12
+
13
+ class_option 'skip-layout-attribute-validation',
14
+ type: :boolean,
15
+ default: false,
16
+ desc: "Skip layout file data attribute validation"
17
+
8
18
  def self.source_root
9
19
  File.join(Dir.pwd, 'source')
10
20
  end
@@ -14,9 +24,10 @@ module Dugway
14
24
  end
15
25
 
16
26
  def validate
17
- unless theme.valid?
27
+ unless theme.valid?(validate_colors: !options['skip-color-validation'], validate_layout_attributes: !options['skip-layout-attribute-validation'])
18
28
  theme.errors.each { |error| say(error, :red) }
19
- raise "Theme is invalid"
29
+ say("\nTheme is invalid", :red)
30
+ exit(1)
20
31
  end
21
32
  end
22
33
 
@@ -22,6 +22,6 @@
22
22
  // },
23
23
  // "background_color": "#CCCCCC",
24
24
  // "show_search": true,
25
- // "twitter_username": "bigcartel"
25
+ // "instagram_url": "https://instagram.com/bigcartel"
26
26
  // }
27
27
  }
@@ -94,8 +94,8 @@
94
94
  </div>
95
95
 
96
96
  <footer>
97
- {% if theme.twitter_username != blank %}
98
- <p><a href="http://twitter/{{ theme.twitter_username }}">Follow @{{ theme.twitter_username }}</a></p>
97
+ {% if theme.instagram_url != blank %}
98
+ <p><a href="{{ theme.instagram_url }}">Follow us on Instagram</a></p>
99
99
  {% endif %}
100
100
  </footer>
101
101
  </body>
@@ -37,6 +37,53 @@
37
37
  "default": "Helvetica"
38
38
  }
39
39
  ],
40
+ "preset_styles": {
41
+ "preview": {
42
+ "title_font": "header_font",
43
+ "body_font": "text_font",
44
+ "text_color": "primary_text_color",
45
+ "background_color": "background_color"
46
+ },
47
+ "presets": [
48
+ {
49
+ "group_name": "Classic",
50
+ "styles": [
51
+ {
52
+ "style_name": "Classic #1",
53
+ "fonts": {
54
+ "header_font": "DM Sans",
55
+ "text_font": "DM Sans"
56
+ },
57
+ "colors": {
58
+ "background_color": "#FFFFFF",
59
+ "primary_text_color": "#000000",
60
+ "link_text_color": "#000000",
61
+ "link_hover_color": "#BF0101",
62
+ "button_background_color": "#000000",
63
+ "button_text_color": "#FFFFFF",
64
+ "button_hover_background_color": "#BF0101"
65
+ }
66
+ },
67
+ {
68
+ "style_name": "Classic #2",
69
+ "fonts": {
70
+ "header_font": "Lora",
71
+ "text_font": "Roboto"
72
+ },
73
+ "colors": {
74
+ "background_color": "#F7F7F7",
75
+ "primary_text_color": "#222222",
76
+ "link_text_color": "#222222",
77
+ "link_hover_color": "#014ABF",
78
+ "button_background_color": "#222222",
79
+ "button_text_color": "#FFFFFF",
80
+ "button_hover_background_color": "#014ABF"
81
+ }
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ },
40
87
  "colors": [
41
88
  {
42
89
  "variable": "background_color",
@@ -44,9 +91,34 @@
44
91
  "default": "#FAFAFA"
45
92
  },
46
93
  {
47
- "variable": "text_color",
94
+ "variable": "primary_text_color",
95
+ "label": "Text Color",
96
+ "default": "#222222"
97
+ },
98
+ {
99
+ "variable": "link_text_color",
100
+ "label": "Text Color",
101
+ "default": "#222222"
102
+ },
103
+ {
104
+ "variable": "link_hover_color",
105
+ "label": "Text Color",
106
+ "default": "#014ABF"
107
+ },
108
+ {
109
+ "variable": "button_background_color",
48
110
  "label": "Text Color",
49
111
  "default": "#222222"
112
+ },
113
+ {
114
+ "variable": "button_text_color",
115
+ "label": "Text Color",
116
+ "default": "#FFFFFF"
117
+ },
118
+ {
119
+ "variable": "button_hover_background_color",
120
+ "label": "Text Color",
121
+ "default": "#014ABF"
50
122
  }
51
123
  ],
52
124
  "options": [
@@ -74,10 +146,10 @@
74
146
  "description": "The number of products shown per page"
75
147
  },
76
148
  {
77
- "variable": "twitter_username",
78
- "label": "Twitter username",
149
+ "variable": "instagram_url",
150
+ "label": "Instagram URL",
79
151
  "type": "text",
80
- "description": "Ex: @bigcartel"
152
+ "description": "Ex: https://instagram.com/bigcartel"
81
153
  }
82
154
  ]
83
155
  }
@@ -1,2 +1,13 @@
1
- $marginSize: 30px
1
+ $margin-size: 30px
2
2
  $border: dashed 1px #ddd
3
+
4
+ $text-font: #{"{{ theme.text_font | font_family }}"}
5
+ $header-font: #{"{{ theme.header_font | font_family }}"}
6
+
7
+ $background-color: #{"{{ theme.background_color }}"}
8
+ $primary-text-color: #{"{{ theme.primary_text_color }}"}
9
+ $link-text-color: #{"{{ theme.link_text_color }}"}
10
+ $link-hover-color: #{"{{ theme.link_hover_color }}"}
11
+ $button-background-color: #{"{{ theme.button_background_color }}"}
12
+ $button-text-color: #{"{{ theme.button_text_color }}"}
13
+ $button-hover-background-color: #{"{{ theme.button_hover_background_color }}"}
@@ -34,7 +34,7 @@ body#cart
34
34
 
35
35
  a.remove
36
36
  display: inline-block
37
- background: #ddd + 20
37
+ background: lighten(#ddd, 20%)
38
38
  border-radius: 20px
39
39
  height: 20px
40
40
  line-height: 18px
@@ -1,17 +1,17 @@
1
1
  @import 'config'
2
2
 
3
3
  body
4
- background: #{"{{ theme.background_color }}"}
5
- color: #{"{{ theme.text_color }}"}
6
- font: 14px/1.4 normal #{"{{ theme.text_font | font_family }}"}
4
+ background: $background-color
5
+ color: $primary-text-color
6
+ font: 14px/1.4 normal $text-font
7
7
  margin: 100px
8
8
 
9
9
  a
10
- color: #72C29B
10
+ color: $link-text-color
11
11
  text-decoration: none
12
12
 
13
13
  &:hover
14
- color: #60AA85
14
+ color: $link-hover-color
15
15
 
16
16
  ul
17
17
  list-style-type: disc
@@ -20,7 +20,7 @@ ol
20
20
  list-style-type: decimal
21
21
 
22
22
  ul, ol
23
- margin-left: $marginSize
23
+ margin-left: $margin-size
24
24
 
25
25
  ul.unstyled,
26
26
  ol.unstyled
@@ -30,20 +30,20 @@ ol.unstyled
30
30
 
31
31
  header
32
32
  border-bottom: $border
33
- font-family: #{"{{ theme.header_font | font_family }}"}
34
- margin-bottom: $marginSize
35
- padding-bottom: $marginSize
33
+ font-family: $header-font
34
+ margin-bottom: $margin-size
35
+ padding-bottom: $margin-size
36
36
  text-align: center
37
37
 
38
38
  a
39
- color: #666
39
+ color: $link-text-color
40
40
  font-size: 2.5em
41
41
 
42
42
  &:hover
43
- color: #333
43
+ color: $link-hover-color
44
44
 
45
45
  h1, h2, h3, h4, h5
46
- font-family: #{"{{ theme.header_font | font_family }}"}
46
+ font-family: $header-font
47
47
 
48
48
  div.wrap
49
49
  display: table
@@ -52,7 +52,7 @@ div.wrap
52
52
  aside
53
53
  border-right: $border
54
54
  display: table-cell
55
- padding-right: $marginSize
55
+ padding-right: $margin-size
56
56
  width: 20%
57
57
 
58
58
  section
@@ -66,15 +66,15 @@ aside
66
66
  margin-bottom: .3em
67
67
 
68
68
  a
69
- color: #999
69
+ color: $link-text-color
70
70
  font-size: .9em
71
71
 
72
72
  &:hover
73
- color: #333
73
+ color: $link-hover-color
74
74
 
75
75
  section.content
76
76
  display: table-cell
77
- padding-left: $marginSize
77
+ padding-left: $margin-size
78
78
  width: 80%
79
79
 
80
80
  form
@@ -9,8 +9,8 @@ body#home, body#products
9
9
  li.product
10
10
  box-sizing: border-box
11
11
  float: left
12
- padding-bottom: $marginSize
13
- padding-right: $marginSize
12
+ padding-bottom: $margin-size
13
+ padding-right: $margin-size
14
14
  max-width: 30%
15
15
 
16
16
  &:nth-child(3n+1)
@@ -18,7 +18,7 @@ body#home, body#products
18
18
 
19
19
  img
20
20
  display: block
21
- margin-bottom: $marginSize / 2
21
+ margin-bottom: $margin-size / 2
22
22
  max-width: 100%
23
23
 
24
24
  div.pagination
@@ -0,0 +1,32 @@
1
+ module Dugway
2
+ module Cli
3
+ class Validate < Thor::Group
4
+ include Thor::Actions
5
+
6
+ class_option 'skip-color-validation',
7
+ type: :boolean,
8
+ default: false,
9
+ desc: "Skip color settings validation"
10
+
11
+ class_option 'skip-layout-attribute-validation',
12
+ type: :boolean,
13
+ default: false,
14
+ desc: "Skip layout file data attribute validation"
15
+
16
+ def validate
17
+ unless theme.valid?(validate_colors: !options['skip-color-validation'], validate_layout_attributes: !options['skip-layout-attribute-validation'])
18
+ theme.errors.each { |error| say(error, :red) }
19
+ say("\nTheme is invalid", :red)
20
+ exit(1)
21
+ end
22
+ say("Theme is valid!", :green)
23
+ end
24
+
25
+ private
26
+
27
+ def theme
28
+ @theme ||= Dugway.theme
29
+ end
30
+ end
31
+ end
32
+ end
data/lib/dugway/cli.rb CHANGED
@@ -5,6 +5,7 @@ require 'dugway'
5
5
  require 'dugway/cli/build'
6
6
  require 'dugway/cli/create'
7
7
  require 'dugway/cli/server'
8
+ require 'dugway/cli/validate'
8
9
 
9
10
  module Dugway
10
11
  module Cli
@@ -12,7 +13,8 @@ module Dugway
12
13
  register Create, 'create', 'create', 'Create a new Big Cartel theme'
13
14
  register Build, 'build', 'build', 'Build your Big Cartel theme for use'
14
15
  register Server, 'server', 'server', 'Run your Big Cartel theme in the browser'
15
-
16
+ register Validate, 'validate', 'validate', 'Validate your Big Cartel theme'
17
+
16
18
  desc 'version', 'Show version of Dugway'
17
19
  def version
18
20
  say "Dugway #{ Dugway::VERSION }"
@@ -0,0 +1,98 @@
1
+ # Color attributes we require for each theme, which is important for the ThemeColorDrop in
2
+ # Storefront repo which we expose to sellers and 3rd party developers
3
+ required_color_attributes:
4
+ - background_color
5
+ - primary_text_color
6
+ - link_text_color
7
+ - link_hover_color
8
+ - button_background_color
9
+ - button_text_color
10
+ - button_hover_background_color
11
+
12
+ # Specify overrides when a theme does not use the standard color attributes
13
+ # Indicate when an attribute is not used by setting it to ~
14
+ Cosmos:
15
+ primary_text_color: text_color
16
+
17
+ Foundry:
18
+ link_text_color: primary_text_color
19
+
20
+ Good Vibes:
21
+ link_text_color: primary_text_color
22
+ link_hover_color: secondary_text_color
23
+ button_background_color: background_color
24
+ button_text_color: primary_text_color
25
+ button_hover_background_color: background_color
26
+
27
+ Hopscotch:
28
+ primary_text_color: text_color
29
+ link_text_color: text_color
30
+ link_hover_color: secondary_text_color
31
+ button_background_color: background_color
32
+ button_text_color: text_color
33
+ button_hover_background_color: ~
34
+
35
+ Luna:
36
+ link_text_color: primary_text_color
37
+ link_hover_color: link_rollover_color
38
+ button_hover_background_color: button_rollover_color
39
+
40
+ Lunch Break:
41
+ primary_text_color: text_color
42
+ link_text_color: text_color
43
+ button_hover_background_color: button_background_hover_color
44
+
45
+ Netizen:
46
+ primary_text_color: text_color
47
+ link_text_color: text_color
48
+ link_hover_color: ~
49
+ button_text_color: text_color
50
+ button_hover_background_color: ~
51
+
52
+ Nova:
53
+ button_background_color: background_color
54
+ button_text_color: primary_text_color
55
+ button_hover_background_color: background_color
56
+
57
+ PickleJuice:
58
+ primary_text_color: text_color
59
+ link_text_color: link_color
60
+
61
+ Ranger:
62
+ link_text_color: primary_text_color
63
+ button_hover_background_color: ~
64
+
65
+ Roadie:
66
+ primary_text_color: text_color
67
+ link_text_color: primary_text_color
68
+
69
+ Sidecar:
70
+ primary_text_color: body_text_color
71
+ link_text_color: link_color
72
+ button_hover_background_color: button_background_hover_color
73
+
74
+ Snacks:
75
+ primary_text_color: text_color
76
+ link_text_color: text_color
77
+ link_hover_color: ~
78
+ button_background_color: accent_background_color
79
+ button_text_color: accent_text_color
80
+ button_hover_background_color: ~
81
+
82
+ Snakebite:
83
+ primary_text_color: primary_color
84
+ link_text_color: primary_color
85
+ link_hover_color: primary_color
86
+ button_background_color: primary_color
87
+ button_text_color: primary_color
88
+ button_hover_background_color: primary_color
89
+
90
+ Sunscreen:
91
+ link_text_color: primary_text_color
92
+
93
+ Trace:
94
+ link_text_color: primary_text_color
95
+ link_hover_color: secondary_text_color
96
+ button_background_color: primary_text_color
97
+ button_text_color: background_color
98
+ button_hover_background_color: primary_text_color
data/lib/dugway/theme.rb CHANGED
@@ -9,6 +9,10 @@ module Dugway
9
9
  class Theme
10
10
  REQUIRED_FILES = %w( cart.html contact.html home.html layout.html maintenance.html product.html products.html screenshot.jpg settings.json theme.css theme.js )
11
11
 
12
+ THEME_COLOR_ATTRIBUTE_MAPPINGS = YAML.load_file(
13
+ File.join(__dir__, 'config', 'theme_color_attribute_mappings.yml')
14
+ ).freeze
15
+
12
16
  attr_reader :errors
13
17
 
14
18
  def initialize(overridden_customization={})
@@ -89,7 +93,7 @@ module Dugway
89
93
  end
90
94
  end
91
95
 
92
- def valid?
96
+ def valid?(validate_colors: true, validate_layout_attributes: true)
93
97
  @errors = []
94
98
 
95
99
  REQUIRED_FILES.each do |file|
@@ -111,9 +115,45 @@ module Dugway
111
115
  end
112
116
  end
113
117
 
118
+ validate_required_color_settings if validate_colors
119
+ validate_required_layout_attributes if validate_layout_attributes
120
+
114
121
  @errors.empty?
115
122
  end
116
123
 
124
+ def validate_required_color_settings
125
+ required_colors_attribute_names = THEME_COLOR_ATTRIBUTE_MAPPINGS['required_color_attributes']
126
+
127
+ theme_colors = settings['colors'].map { |c| c['variable'] }
128
+ mappings = THEME_COLOR_ATTRIBUTE_MAPPINGS[name] || {}
129
+
130
+ missing_colors = required_colors_attribute_names.reject do |color|
131
+ theme_colors.include?(color) ||
132
+ (mappings.key?(color) && (mappings[color].nil? || theme_colors.include?(mappings[color])))
133
+ end
134
+
135
+ unless missing_colors.empty?
136
+ @errors << "Missing required color settings: #{missing_colors.join(', ')}"
137
+ end
138
+ end
139
+
140
+ # Validate that the Layout file has expected attributes for:
141
+ # - data-bc-page-type on the body tag
142
+ # - one data-bc-hook="header" and one data-bc-hook="footer" somewhere
143
+ def validate_required_layout_attributes
144
+ layout_content = read_source_file('layout.html')
145
+
146
+ unless layout_content =~ /<body.*?\bdata-bc-page-type\b/
147
+ @errors << "layout.html missing `data-bc-page-type` attribute on body tag"
148
+ end
149
+
150
+ header_hooks = layout_content.scan(/data-bc-hook=(?:"|')header(?:"|')/).size
151
+ footer_hooks = layout_content.scan(/data-bc-hook=(?:"|')footer(?:"|')/).size
152
+
153
+ @errors << "layout.html must have exactly one `data-bc-hook=\"header\"`" if header_hooks != 1
154
+ @errors << "layout.html must have exactly one `data-bc-hook=\"footer\"`" if footer_hooks != 1
155
+ end
156
+
117
157
  private
118
158
 
119
159
  def validate_preview
@@ -128,30 +168,32 @@ module Dugway
128
168
  end
129
169
 
130
170
  def validate_preset_styles(preset)
131
- @errors << 'Preset is missing group_name' unless preset['group_name'].is_a?(String)
171
+ @errors << 'Preset is missing group_name' if preset['group_name'].to_s.strip.empty?
132
172
  @errors << 'Preset is missing styles' unless preset['styles'].is_a?(Array)
133
173
 
134
174
  preset['styles'].each do |style|
135
- @errors << 'Style is missing style_name' unless style['style_name'].is_a?(String)
175
+ @errors << "Style in group '#{preset['group_name']}' - Missing style_name" if style['style_name'].to_s.strip.empty?
136
176
 
137
177
  if style['fonts'].is_a?(Hash) && !style['fonts'].empty?
138
178
  style['fonts'].each_value do |font|
139
- @errors << 'Font value should be a string' unless font.is_a?(String)
179
+ @errors << "Style '#{style['style_name']} - Contains an invalid font name" if font.to_s.strip.empty?
140
180
  end
141
181
  else
142
- @errors << 'Style is missing fonts'
182
+ @errors << "Style '#{style['style_name']}' - Missing fonts"
143
183
  end
144
184
 
145
185
  if style['colors'].is_a?(Hash) && !style['colors'].empty?
146
186
  style['colors'].each do |key, color|
147
- @errors << 'Invalid color format' unless color =~ /^#[0-9A-Fa-f]{6}$/
187
+ unless color =~ /^#[0-9A-Fa-f]{6}$/
188
+ @errors << "Style '#{style['style_name']}' - Invalid color value '#{color}' for color '#{key}''"
189
+ end
148
190
  end
149
191
  else
150
- @errors << 'Style is missing colors'
192
+ @errors << "Style '#{style['style_name']}' - Missing required color settings"
151
193
  end
152
194
  end
153
195
 
154
- @errors << 'Style names should be unique' unless preset['styles'].map { |style| style['style_name'] }.uniq.length == preset['styles'].length
196
+ validate_style_name_uniqueness(preset['styles'])
155
197
  end
156
198
 
157
199
  def validate_style_references(preset)
@@ -169,11 +211,20 @@ module Dugway
169
211
  extra_keys = style_keys - variables
170
212
  missing_keys = variables - style_keys
171
213
 
172
- @errors << "Extra #{key_type} keys: #{extra_keys.join(', ')}" unless extra_keys.empty?
173
- @errors << "Missing #{key_type} keys: #{missing_keys.join(', ')}" unless missing_keys.empty?
214
+ @errors << "Style '#{style['style_name']}' - Extra #{key_type} keys: #{extra_keys.join(', ')}" unless extra_keys.empty?
215
+ @errors << "Style '#{style['style_name']}' - Missing #{key_type} keys: #{missing_keys.join(', ')}" unless missing_keys.empty?
174
216
  end
175
217
  end
176
218
 
219
+ def validate_style_name_uniqueness(styles)
220
+ duplicates = styles
221
+ .group_by { |s| s['style_name'] }
222
+ .select { |_, group| group.size > 1 }
223
+ .keys
224
+
225
+ @errors << "Duplicate style names found: #{duplicates.join(', ')}" if duplicates.any?
226
+ end
227
+
177
228
  def source_dir
178
229
  Dugway.source_dir
179
230
  end
@@ -1,3 +1,3 @@
1
1
  module Dugway
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.13"
3
3
  end
@@ -11,8 +11,8 @@
11
11
  {{ head_content }}
12
12
  </head>
13
13
 
14
- <body id="{{ page.permalink }}" class="{{ page.category }}">
15
- <header>
14
+ <body id="{{ page.permalink }}" class="{{ page.category }}" data-bc-page-type="{% if page.category == 'custom' %}custom{% else %}{{ page.permalink }}{% endif %}">
15
+ <header data-bc-hook="header">
16
16
  <a href="/" title="{{ store.name | escape }}">{{ store.name }}</a>
17
17
  </header>
18
18
 
@@ -78,7 +78,7 @@
78
78
  {% endif %}
79
79
  </section>
80
80
 
81
- <footer>
81
+ <footer data-bc-hook="footer">
82
82
  <div>{{ powered_by_big_cartel }}</div>
83
83
  </footer>
84
84
  </body>
@@ -40,7 +40,7 @@
40
40
  "default": "Helvetica"
41
41
  },
42
42
  {
43
- "variable": "font",
43
+ "variable": "text_font",
44
44
  "label": "Font",
45
45
  "default": "Georgia"
46
46
  }
@@ -48,8 +48,8 @@
48
48
  "preset_styles": {
49
49
  "preview": {
50
50
  "title_font": "header_font",
51
- "body_font": "font",
52
- "text_color": "link_color",
51
+ "body_font": "text_font",
52
+ "text_color": "primary_text_color",
53
53
  "background_color": "background_color"
54
54
  },
55
55
  "presets": [
@@ -60,22 +60,32 @@
60
60
  "style_name": "Classic #1",
61
61
  "fonts": {
62
62
  "header_font": "DM Sans",
63
- "font": "DM Sans"
63
+ "text_font": "DM Sans"
64
64
  },
65
65
  "colors": {
66
66
  "background_color": "#FFFFFF",
67
- "link_color": "#111111"
67
+ "primary_text_color": "#000000",
68
+ "link_text_color": "#000000",
69
+ "link_hover_color": "#BF0101",
70
+ "button_background_color": "#000000",
71
+ "button_text_color": "#FFFFFF",
72
+ "button_hover_background_color": "#BF0101"
68
73
  }
69
74
  },
70
75
  {
71
76
  "style_name": "Classic #2",
72
77
  "fonts": {
73
78
  "header_font": "Lora",
74
- "font": "Roboto"
79
+ "text_font": "Roboto"
75
80
  },
76
81
  "colors": {
77
82
  "background_color": "#F7F7F7",
78
- "link_color": "#222222"
83
+ "primary_text_color": "#222222",
84
+ "link_text_color": "#222222",
85
+ "link_hover_color": "#014ABF",
86
+ "button_background_color": "#222222",
87
+ "button_text_color": "#FFFFFF",
88
+ "button_hover_background_color": "#014ABF"
79
89
  }
80
90
  }
81
91
  ]
@@ -86,11 +96,36 @@
86
96
  {
87
97
  "variable": "background_color",
88
98
  "label": "Background",
89
- "default": "#222222"
99
+ "default": "white"
90
100
  },
91
101
  {
92
- "variable": "link_color",
93
- "label": "Link Color",
102
+ "variable": "primary_text_color",
103
+ "label": "Text",
104
+ "default": "black"
105
+ },
106
+ {
107
+ "variable": "link_text_color",
108
+ "label": "Link text",
109
+ "default": "red"
110
+ },
111
+ {
112
+ "variable": "link_hover_color",
113
+ "label": "Link hover",
114
+ "default": "black"
115
+ },
116
+ {
117
+ "variable": "button_background_color",
118
+ "label": "Button background",
119
+ "default": "black"
120
+ },
121
+ {
122
+ "variable": "button_text_color",
123
+ "label": "Button text",
124
+ "default": "white"
125
+ },
126
+ {
127
+ "variable": "button_hover_background_color",
128
+ "label": "Button hover background",
94
129
  "default": "red"
95
130
  }
96
131
  ],
@@ -1 +1 @@
1
- $color: #0f0;
1
+ $background_color: #0f0;
@@ -1,3 +1,3 @@
1
1
  html, body {
2
2
  height: 100%;
3
- }
3
+ }
@@ -1,7 +1,7 @@
1
1
  @import 'partial'
2
2
 
3
- $link_color: #{"{{ theme.link_color }}"}
3
+ $link_text_color: #{"{{ theme.link_text_color }}"}
4
4
 
5
5
  a
6
- background: $color
7
- color: $link_color
6
+ background: $background_color
7
+ color: $link_text_color
@@ -73,19 +73,25 @@ describe Dugway::Drops::ThemeDrop do
73
73
 
74
74
  describe "#font" do
75
75
  it "should return the theme's font" do
76
- theme.font.should == 'Georgia'
76
+ theme.text_font.should == 'Georgia'
77
77
  end
78
78
  end
79
79
 
80
80
  describe "#background_color" do
81
81
  it "should return the theme's background_color" do
82
- theme.background_color.should == '#222222'
82
+ theme.background_color.should == 'white'
83
83
  end
84
84
  end
85
85
 
86
- describe "#link_color" do
87
- it "should return the theme's link_color" do
88
- theme.link_color.should == 'red'
86
+ describe "#link_text_color" do
87
+ it "should return the theme's link_text_color" do
88
+ theme.link_text_color.should == 'red'
89
+ end
90
+ end
91
+
92
+ describe "#link_hover_color" do
93
+ it "should return the theme's link_hover_color" do
94
+ theme.link_hover_color.should == 'black'
89
95
  end
90
96
  end
91
97
 
@@ -18,7 +18,7 @@ describe Dugway::Theme do
18
18
  describe "#fonts" do
19
19
  it "should return a hash of font settings values" do
20
20
  theme.fonts.should == {
21
- 'font' => 'Georgia',
21
+ 'text_font' => 'Georgia',
22
22
  'header_font' => 'Helvetica'
23
23
  }
24
24
  end
@@ -49,11 +49,16 @@ describe Dugway::Theme do
49
49
  describe "#customization" do
50
50
  it "should return a hash of font, color, option, images and image sets settings values" do
51
51
  theme.customization.should == {
52
- 'background_color' => '#222222',
52
+ 'background_color' => 'white',
53
53
  'fixed_sidebar' => true,
54
- 'font' => 'Georgia',
54
+ 'text_font' => 'Georgia',
55
55
  'header_font' => 'Helvetica',
56
- 'link_color' => 'red',
56
+ 'primary_text_color' => 'black',
57
+ 'link_text_color' => 'red',
58
+ 'link_hover_color' => 'black',
59
+ 'button_background_color' => 'black',
60
+ 'button_text_color' => 'white',
61
+ 'button_hover_background_color' => 'red',
57
62
  'show_search' => false,
58
63
  'logo' => { :url => 'images/logo_bc.png', :width => 1, :height => 1 },
59
64
  'slideshow_images' => [
@@ -69,17 +74,22 @@ describe Dugway::Theme do
69
74
  describe "when there are overridden customization" do
70
75
  before(:each) do
71
76
  Dugway.stub(:theme) {
72
- Dugway::Theme.new(:fixed_sidebar => false, :link_color => 'blue')
77
+ Dugway::Theme.new(:fixed_sidebar => false, :link_text_color => 'blue')
73
78
  }
74
79
  end
75
80
 
76
81
  it "should merge those values into the defaults" do
77
82
  theme.customization.should == {
78
- 'background_color' => '#222222',
83
+ 'background_color' => 'white',
79
84
  'fixed_sidebar' => false,
80
- 'font' => 'Georgia',
85
+ 'text_font' => 'Georgia',
81
86
  'header_font' => 'Helvetica',
82
- 'link_color' => 'blue',
87
+ 'primary_text_color' => 'black',
88
+ 'link_text_color' => 'blue',
89
+ 'link_hover_color' => 'black',
90
+ 'button_background_color' => 'black',
91
+ 'button_text_color' => 'white',
92
+ 'button_hover_background_color' => 'red',
83
93
  'show_search' => false,
84
94
  'logo' => { :url => 'images/logo_bc.png', :width => 1, :height => 1 },
85
95
  'slideshow_images' => [
@@ -134,7 +144,7 @@ describe Dugway::Theme do
134
144
  end
135
145
 
136
146
  it "should sprocketize and not liquify theme.css" do
137
- theme.build_file('theme.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:#0f0;color:{{theme.link_color}};}/**/}
147
+ theme.build_file('theme.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:#0f0;color:{{theme.link_text_color}};}/**/}
138
148
  end
139
149
  end
140
150
 
@@ -227,4 +237,3 @@ describe Dugway::Theme do
227
237
  File.read(File.join(Dugway.source_dir, file_name))
228
238
  end
229
239
  end
230
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dugway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Big Cartel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-18 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -466,6 +466,8 @@ files:
466
466
  - lib/dugway/cli/templates/source/stylesheets/vendor/normalize.css
467
467
  - lib/dugway/cli/templates/source/theme.css
468
468
  - lib/dugway/cli/templates/source/theme.js
469
+ - lib/dugway/cli/validate.rb
470
+ - lib/dugway/config/theme_color_attribute_mappings.yml
469
471
  - lib/dugway/contact_form_validator.rb
470
472
  - lib/dugway/controller.rb
471
473
  - lib/dugway/extensions/time.rb