Permalink
Browse files

template context is a bit more data-driven

  • Loading branch information...
1 parent 5454b0d commit a167b3916869f52867a40881fbacdbc9022aeca8 @lachie lachie committed Aug 14, 2010
Showing with 16 additions and 11 deletions.
  1. +6 −6 dev/stylesheets/whereuat.css.mustache
  2. +10 −5 lib/whereuat/assets/context.rb
@@ -30,7 +30,7 @@
height: 125px;
font-size: 0.001em;
text-indent: -2000em;
- background: #212121 url({{bg_url}}) no-repeat -4px -10px;
+ background: #212121 url({{bg_uri}}) no-repeat -4px -10px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
-moz-border-radius-topright: 10px;
@@ -99,7 +99,7 @@
display:block;
width: 25px;
height: 28px;
- background: url({{bg_url}}) no-repeat -9px -204px;
+ background: url({{bg_uri}}) no-repeat -9px -204px;
font-size: 0.001em;
text-indent: -20000em;
}
@@ -115,7 +115,7 @@
display:block;
width: 25px;
height: 30px;
- background: url({{bg_url}}) no-repeat -9px -136px;
+ background: url({{bg_uri}}) no-repeat -9px -136px;
font-size: 0.001em;
text-indent: -20000em;
}
@@ -131,7 +131,7 @@
display:block;
width: 25px;
height: 30px;
- background: url({{bg_url}}) no-repeat -9px -301px;
+ background: url({{bg_uri}}) no-repeat -9px -301px;
font-size: 0.001em;
text-indent: -20000em;
}
@@ -147,7 +147,7 @@
display:block;
width: 60px;
height: 25px;
- background: url({{bg_url}}) no-repeat -1px -275px;
+ background: url({{bg_uri}}) no-repeat -1px -275px;
font-size: 0.001em;
text-indent: -20000em;
border:none;
@@ -162,5 +162,5 @@
left: 13px;
top: 54px;
- background: url({{spinner_url}}) no-repeat;
+ background: url({{spinner_uri}}) no-repeat;
}
@@ -1,14 +1,19 @@
module Whereuat
module Assets
class Context
- def bg_url
- Image.new(images_root+'uat-bg.png')
- end
- def spinner_url
- Image.new(images_root+'spinner.gif')
+ # bg becomes bg_uri. bg_uri yields a data uri of the image.
+ ImageMap = {
+ :bg => 'uat-bg.png',
+ :spinner => 'spinner.gif'
+ }
+
+ ImageMap.each do |k,v|
+ define_method("#{k}_uri") { Image.new( images_root + v ) }
end
+ protected
+
def images_root
@images_root ||= Whereuat.dev_root+'images'
end

0 comments on commit a167b39

Please sign in to comment.