dugway 1.0.13 → 1.0.14

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: c3efe750c07138767b6b491f5fd375df42560fa0dd77fd18e3f0bd10578667f5
4
- data.tar.gz: 90ab41b88afa8995d7890612ecdd262f0cb2146dfea7c7b1eced3d99bd78744d
3
+ metadata.gz: 7eae3c870ceda8207acc698d61c2aeb008b1f315e4e8bf4347578b90e10e365e
4
+ data.tar.gz: 0a2f33a7f2d6be0402e95c23385703ce8bef02f6b6825b0c2b17bc8e7d24198f
5
5
  SHA512:
6
- metadata.gz: 922ee155123b7f98a421bdf5039b707b48defa71a55296ecad5ac96185c587775885b78e4d3534462a52a35f86af23d69094e65df2bbbf58e217f06cbcfd00d6
7
- data.tar.gz: 419a042a3b9fffb5d8951b27c06b300d996a95407bf634d988fced33eb3bb8af380eee29e2f157d87d19c045a60e13d3037f196980fb9b0a5c2be535cf14f230
6
+ metadata.gz: 14f7065a90a40eeff514d2816326af0cbc3341e0608a39e22c4059db4924557120b06de94ee11f1601a883707ef905b3ae26ae651490b6931a4c1f604d498d43
7
+ data.tar.gz: 1877a14d06d370d659a1c747f1d9f52642c6e6696942aa3d0a01d1fad9fa719d7bc373cf10538eb9b86a1a9aa37c27cad4cb26d462f2544084f99c43ddc07079
@@ -74,7 +74,7 @@ module Dugway
74
74
  'artists' => Drops::ArtistsDrop.new(store.artists.map { |a| Drops::ArtistDrop.new(a) }),
75
75
  'products' => Drops::ProductsDrop.new(store.products.map { |p| Drops::ProductDrop.new(p) }),
76
76
  'contact' => Drops::ContactDrop.new,
77
- 'head_content' => head_content,
77
+ 'head_content' => [window_bigcartel_script, head_content].join,
78
78
  'bigcartel_credit' => bigcartel_credit,
79
79
  'powered_by_big_cartel' => powered_by_big_cartel,
80
80
  }
@@ -100,6 +100,15 @@ module Dugway
100
100
  content
101
101
  end
102
102
 
103
+ def window_bigcartel_script
104
+ product = @request.params[:product] ? store.product(@request.params[:product]) : nil
105
+
106
+ script = "window.bigcartel = window.bigcartel || {};"
107
+ script << "\nwindow.bigcartel.product = #{product.to_json};" if product
108
+
109
+ "<script>#{script}</script>"
110
+ end
111
+
103
112
  def bigcartel_credit
104
113
  '<a href="http://bigcartel.com/" title="Start your own store at Big Cartel now">Online Store by Big Cartel</a>'
105
114
  end
data/lib/dugway/theme.rb CHANGED
@@ -185,7 +185,7 @@ module Dugway
185
185
  if style['colors'].is_a?(Hash) && !style['colors'].empty?
186
186
  style['colors'].each do |key, color|
187
187
  unless color =~ /^#[0-9A-Fa-f]{6}$/
188
- @errors << "Style '#{style['style_name']}' - Invalid color value '#{color}' for color '#{key}''"
188
+ @errors << "Style '#{style['style_name']}' - Invalid color value '#{color}' for color '#{key}'"
189
189
  end
190
190
  end
191
191
  else
@@ -1,3 +1,3 @@
1
1
  module Dugway
2
- VERSION = "1.0.13"
2
+ VERSION = "1.0.14"
3
3
  end
@@ -231,6 +231,68 @@ describe Dugway::Theme do
231
231
  theme.errors.size.should == 2
232
232
  end
233
233
  end
234
+
235
+ describe "when preset styles are invalid" do
236
+ let(:valid_settings) do
237
+ {
238
+ 'fonts' => [{'variable' => 'font'}],
239
+ 'colors' => [
240
+ {'variable' => 'background_color'},
241
+ {'variable' => 'primary_text_color'},
242
+ {'variable' => 'link_text_color'},
243
+ {'variable' => 'link_hover_color'},
244
+ {'variable' => 'button_background_color'},
245
+ {'variable' => 'button_text_color'},
246
+ {'variable' => 'button_hover_background_color'}
247
+ ],
248
+ 'preset_styles' => {
249
+ 'preview' => {
250
+ 'title_font' => 'font',
251
+ 'body_font' => 'font',
252
+ 'text_color' => '#000000',
253
+ 'background_color' => '#FFFFFF'
254
+ },
255
+ 'presets' => [{
256
+ 'group_name' => 'Classic',
257
+ 'styles' => [{
258
+ 'style_name' => 'Style 1',
259
+ 'fonts' => {'font' => 'Arial'},
260
+ 'colors' => {
261
+ 'background_color' => '#FFFFFF',
262
+ 'primary_text_color' => '#000000',
263
+ 'link_text_color' => '#000000',
264
+ 'link_hover_color' => '#000000',
265
+ 'button_background_color' => '#000000',
266
+ 'button_text_color' => '#FFFFFF',
267
+ 'button_hover_background_color' => '#000000'
268
+ }
269
+ }]
270
+ }]
271
+ }
272
+ }
273
+ end
274
+
275
+ before(:each) do
276
+ allow(theme).to receive(:name) { "Test Theme" }
277
+ allow(theme).to receive(:version) { "1.2.3" }
278
+ end
279
+
280
+ it "requires non-empty group_name" do
281
+ settings = valid_settings
282
+ settings['preset_styles']['presets'].first['group_name'] = ' '
283
+ theme.stub(:settings) { settings }
284
+ theme.valid?.should be(false)
285
+ theme.errors.should include('Preset is missing group_name')
286
+ end
287
+
288
+ it "requires non-empty style_name" do
289
+ settings = valid_settings
290
+ settings['preset_styles']['presets'].first['styles'].first['style_name'] = ' '
291
+ theme.stub(:settings) { settings }
292
+ theme.valid?.should be(false)
293
+ theme.errors.should include('Style in group \'Classic\' - Missing style_name')
294
+ end
295
+ end
234
296
  end
235
297
 
236
298
  def read_file(file_name)
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.13
4
+ version: 1.0.14
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-12-12 00:00:00.000000000 Z
11
+ date: 2025-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler