dugway 0.5.8 → 0.5.9

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
  SHA1:
3
- metadata.gz: 6f099f817529d66f6c897e1dbe324ba22504e6c2
4
- data.tar.gz: 492282f622f2e037fedd35adb918ca0daf6a81fb
3
+ metadata.gz: 4aa4d00f294e385c239b2ca19ac986ab92d7343e
4
+ data.tar.gz: 339a42084c991bfd813c67ea32ef849bb7a140f3
5
5
  SHA512:
6
- metadata.gz: 8e1fa93b84b030e97db5e17df116a684acad3b13a7b12c08c144b07da996006ae9e03023ea15e45581862a562126446e18e7e8547bd7f76d34032eea825115ff
7
- data.tar.gz: 9e33c4385b035813b3a6a00e8f4909d77cf72de867dd255cdf6fbc7ff0d0a96af39361304b308c9ebedff7e49dfe80abc1b7925254868f93df903bdcb0e181da
6
+ metadata.gz: d835a5519e9758ab24d58ef2599f82a9d998f561fc054fd7b87d818016a025b2c0cea4927bb2dd188924cab8f9e951197cb3671b2bf7be856706eb2ffe51bb0b
7
+ data.tar.gz: ea7107d656188add5161e929886940cdfb2b15169ddd82723430d2138cb24502a348500b66c610e0e04fc9874ec3f5efa66ee2e56311c494a642bb1c34cfb7c5
data/README.md CHANGED
@@ -76,9 +76,11 @@ All CSS for your theme is handled by the **styles.css** file, and all JavaScript
76
76
  //= require javascripts/example_1
77
77
  //= require javascripts/example_2
78
78
 
79
- #### Using Sass, LESS, and CoffeeScript
79
+ #### Using Sass, Compass, LESS, and CoffeeScript
80
80
 
81
- Sprockets also allows you to use [Sass](http://sass-lang.com) in your separate files by appending the **.sass** or **.scss** extension after **.css**. Prefer [LESS](http://lesscss.org)? No problem, just append the **.less** extension instead. For you JavaScript folks, you can use [CoffeeScript](http://coffeescript.org) in your separate files by appending the **.coffee** extension after **.js**.
81
+ Sprockets also allows you to use [Sass](http://sass-lang.com) in your separate files by appending the **.sass** or **.scss** extension after **.css**. You can even use [Compass](http://compass-style.org/) right out of the box to help author your stylesheets by utilizing its mixins for CSS3, typography, and its utilities. Prefer [LESS](http://lesscss.org)? No problem, just append the **.less** extension instead.
82
+
83
+ For you JavaScript folks, you can use [CoffeeScript](http://coffeescript.org) in your separate files by appending the **.coffee** extension after **.js**.
82
84
 
83
85
  #### Embedding CSS & JavaScript
84
86
 
@@ -18,8 +18,8 @@ module Dugway
18
18
  end
19
19
 
20
20
  def paragraphs(text)
21
- tags = '(table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|script|embed|object|param|code|center|dir|fieldset|menu|noframes|noscript|frameset|applet|button|del|iframe|ins)'
22
- text = text.to_s.gsub(/\r\n?/, "\n") # \r\n and \r -> \n
21
+ tags = '(table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|script|embed|object|param|code|center|dir|fieldset|menu|noframes|noscript|frameset|applet|button|del|iframe|ins)'
22
+ text = text.to_s.gsub(/\r\n?/, "\n") # \r\n and \r -> \n
23
23
  blocks = text.split(/\n\n+/) # split on double newlines
24
24
  blocks.inject('') do | result, block |
25
25
  block.strip!
@@ -75,10 +75,10 @@ module Dugway
75
75
  option_tags = options.inject('') { |t,o| t += option_tag((o['name'] + (o['has_custom_price'] ? " - #{ money_with_sign(o['price']) }" : '')), o['id']) }
76
76
  select_tag('cart[add][id]', option_tags, { :id => id, :class => class_name })
77
77
  end
78
-
78
+
79
79
  def options_radio(options, id = 'option', class_name = nil)
80
80
  list = ''
81
-
81
+
82
82
  for o in options
83
83
  list += '<li>'
84
84
  list += radio_button_tag('cart[add][id]', o['id'], o['default'], { :id => "option_#{o['id']}", :class => class_name })
@@ -87,7 +87,7 @@ module Dugway
87
87
  list += %{</label>}
88
88
  list += '</li>'
89
89
  end
90
-
90
+
91
91
  %{<ul id="#{id}">#{list}</ul>}
92
92
  end
93
93
 
@@ -100,13 +100,14 @@ module Dugway
100
100
  end
101
101
 
102
102
  def country_select(country, label = 'Select your country...', id = 'country', class_name = nil)
103
- found = false
104
- countries = [[label, ''], ['------------',''], [country['name'], country['id']], ['------------','']] + Country.options
105
- options = countries.inject('') do |t,c|
106
- select = !found && c[1] == cart.country_id
107
- found = true if select
108
- t += option_tag(c[0], c[1], select)
103
+ divider = '------------'
104
+ countries = [label, divider, country['name'], divider, 'Åland Islands', 'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica', 'Antigua And Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island', 'Brazil', 'British Indian Ocean Territory', 'British Virgin Islands', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo', 'Cook Islands', 'Costa Rica', 'Croatia (Hrvatska)', 'Cuba', 'Cyprus', 'Czech Republic', 'Democratic Republic of the Congo', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Falkland Islands (Malvinas)', 'Faroe Islands', 'Fiji', 'Finland', 'France', 'France, Metropolitan', 'French Guiana', 'French Polynesia', 'French Southern Territories', 'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Heard and McDonald Islands', 'Honduras', 'Hong Kong', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy', 'Jamaica', 'Japan', 'Jersey', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Kuwait', 'Kyrgyzstan (Kyrgyz Republic)', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macau', 'Macedonia', 'Madagascar', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'Netherlands', 'Netherlands Antilles', 'Neutral Zone (Saudia Arabia/Iraq)', 'New Caledonia', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'Northern Mariana Islands', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palestine', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Pitcairn', 'Poland', 'Portugal', 'Puerto Rico', 'Qatar', 'Reunion', 'Romania', 'Russian Federation', 'Rwanda', 'S. Georgia and S. Sandwich Isls.', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and The Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia (Slovak Republic)', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'South Korea', 'Soviet Union (former)', 'Spain', 'Sri Lanka', 'St. Helena', 'St. Pierre and Miquelon', 'Sudan', 'Suriname', 'Svalbard and Jan Mayen Islands', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Timore-Leste', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu', 'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States', 'United States Minor Outlying Islands', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City State (Holy See)', 'Venezuela', 'Viet Nam', 'Virgin Islands (US)', 'Wallis and Futuna Islands', 'Western Sahara', 'Yemen', 'Yugoslavia', 'Zaire', 'Zambia', 'Zimbabwe']
105
+
106
+ options = countries.inject('') do |t, c|
107
+ v = c == label || c == divider ? '' : Digest::SHA1.hexdigest(c) # give it a random ID that'll be consistent
108
+ t += option_tag(c, v)
109
109
  end
110
+
110
111
  select_tag('cart[country_id]', options, { :id => id, :class => class_name })
111
112
  end
112
113
 
@@ -134,7 +135,7 @@ module Dugway
134
135
  def contact_tab_index
135
136
  @contact_tab_index ||= 0
136
137
  @contact_tab_index += 1
137
- end
138
+ end
138
139
  end
139
140
  end
140
141
  end
@@ -14,17 +14,10 @@ Liquid::Template.register_tag(:paginate, Dugway::Tags::Paginate)
14
14
 
15
15
  module Dugway
16
16
  class Liquifier
17
- ESCAPE_CSS = {
18
- '{{' => '"<<',
19
- '}}' => '>>"',
20
- '{%' => '"<',
21
- '%}' => '">'
22
- }
23
-
24
17
  def initialize(request)
25
18
  @request = request
26
19
  end
27
-
20
+
28
21
  def render(content, variables={})
29
22
  variables.symbolize_keys!
30
23
 
@@ -44,24 +37,14 @@ module Dugway
44
37
  context = Liquid::Context.new([ assigns, shared_context ], {}, registers)
45
38
  Liquid::Template.parse(content).render!(context)
46
39
  end
47
-
40
+
48
41
  def self.render_styles(css)
49
42
  Liquid::Template.parse(css).render!(
50
- { 'theme' => Drops::ThemeDrop.new(Dugway.theme.customization) },
43
+ { 'theme' => Drops::ThemeDrop.new(Dugway.theme.customization) },
51
44
  :registers => { :settings => Dugway.theme.settings }
52
45
  )
53
46
  end
54
-
55
- def self.escape_styles(css)
56
- ESCAPE_CSS.each_pair { |k,v| css.gsub!(k,v) }
57
- css
58
- end
59
-
60
- def self.unescape_styles(css)
61
- ESCAPE_CSS.each_pair { |k,v| css.gsub!(v,k) }
62
- css
63
- end
64
-
47
+
65
48
  private
66
49
 
67
50
  def store
@@ -79,7 +62,7 @@ module Dugway
79
62
  def shared_context
80
63
  @shared_context ||= { 'errors' => [] }
81
64
  end
82
-
65
+
83
66
  def shared_assigns
84
67
  {
85
68
  'store' => Drops::AccountDrop.new(store.account),
@@ -94,7 +77,7 @@ module Dugway
94
77
  'bigcartel_credit' => bigcartel_credit
95
78
  }
96
79
  end
97
-
80
+
98
81
  def shared_registers
99
82
  {
100
83
  :request => @request,
@@ -103,18 +86,18 @@ module Dugway
103
86
  :currency => store.currency,
104
87
  :settings => theme.settings
105
88
  }
106
- end
107
-
89
+ end
90
+
108
91
  def head_content
109
92
  content = %{<meta name="generator" content="Big Cartel">}
110
-
93
+
111
94
  if google_font_url = ThemeFont.google_font_url_for_theme
112
95
  content << %{\n<link rel="stylesheet" type="text/css" href="#{ google_font_url }">}
113
96
  end
114
-
97
+
115
98
  content
116
99
  end
117
-
100
+
118
101
  def bigcartel_credit
119
102
  '<a href="http://bigcartel.com/" title="Start your own store at Big Cartel now">Online Store by Big Cartel</a>'
120
103
  end
data/lib/dugway/theme.rb CHANGED
@@ -103,23 +103,8 @@ module Dugway
103
103
 
104
104
  Sprockets::Sass.options[:line_comments] = false
105
105
 
106
- # CSS engines like Sass and LESS choke on Liquid variables, so here we render the Liquid
107
- # if we're viewing the file, or escape and unescape it if we're building the file.
108
-
109
106
  sprockets.register_preprocessor 'text/css', :liquifier do |context, data|
110
- if @building
111
- Liquifier.escape_styles(data)
112
- else
113
- Liquifier.render_styles(data)
114
- end
115
- end
116
-
117
- sprockets.register_postprocessor 'text/css', :liquifier do |context, data|
118
- if @building
119
- Liquifier.unescape_styles(data)
120
- else
121
- data
122
- end
107
+ @building ? data : Liquifier.render_styles(data)
123
108
  end
124
109
 
125
110
  sprockets
@@ -1,3 +1,3 @@
1
1
  module Dugway
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9"
3
3
  end
@@ -59,6 +59,7 @@ feature 'Page rendering' do
59
59
  visit '/styles.css'
60
60
  expect(page).to have_content('height: 100%;') # one.css
61
61
  expect(page).to have_content('color: red;') # two.css.sass
62
+ expect(page).to have_content('url(/images/bc_badge.png)') # two.css.sass
62
63
  end
63
64
 
64
65
  scenario 'scripts.js' do
@@ -1,7 +1,10 @@
1
1
  @import 'partial'
2
2
 
3
- $link_color: {{ theme.link_color }}
3
+ $link_color: #{"{{ theme.link_color }}"}
4
4
 
5
5
  a
6
6
  background: $color
7
7
  color: $link_color
8
+
9
+ footer cite a
10
+ background: url(#{"{{ 'bc_badge.png' | theme_image_url }}"}) no-repeat
@@ -80,7 +80,7 @@ describe Dugway::Theme do
80
80
  end
81
81
 
82
82
  it "should sprocketize and liquify styles.css" do
83
- theme.file_content('styles.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:lime;color:red;}/**/}
83
+ theme.file_content('styles.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:lime;color:red;}footercitea{background:url(/images/bc_badge.png)no-repeat;}/**/}
84
84
  end
85
85
  end
86
86
 
@@ -96,7 +96,7 @@ describe Dugway::Theme do
96
96
  end
97
97
 
98
98
  it "should sprocketize and not liquify styles.css" do
99
- theme.build_file('styles.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:lime;color:{{theme.link_color}};}/**/}
99
+ theme.build_file('styles.css').gsub(/\s+/, '').should == %{html,body{height:100%;}a{background:lime;color:{{theme.link_color}};}footercitea{background:url({{'bc_badge.png'|theme_image_url}})no-repeat;}/**/}
100
100
  end
101
101
  end
102
102
 
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: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Big Cartel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-05 00:00:00.000000000 Z
11
+ date: 2013-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler