storefront 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/storefront/helpers/request_helper.rb +3 -2
- data/lib/storefront/helpers/widget_helper.rb +1 -27
- metadata +2 -2
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
|
|
5
5
|
spec = Gem::Specification.new do |s|
|
6
6
|
s.name = "storefront"
|
7
7
|
s.authors = ["Lance Pollard"]
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.8"
|
9
9
|
s.description = "Semantic HTML5 for Rails"
|
10
10
|
s.summary = "Semantic HTML5 for Rails"
|
11
11
|
s.homepage = "http://github.com/viatropos/storefront"
|
@@ -51,9 +51,10 @@ module Storefront
|
|
51
51
|
def with_subdomain(subdomain)
|
52
52
|
subdomain = (subdomain || "")
|
53
53
|
subdomain += "." unless subdomain.empty?
|
54
|
-
|
54
|
+
# needs to be dynamic!
|
55
|
+
[subdomain, request.domain, request.port_string].join
|
55
56
|
end
|
56
|
-
|
57
|
+
|
57
58
|
def url_for(options = {})
|
58
59
|
if options.kind_of?(Hash) && options.has_key?(:subdomain)
|
59
60
|
options[:host] = with_subdomain(options.delete(:subdomain))
|
@@ -1,14 +1,10 @@
|
|
1
1
|
module Storefront
|
2
2
|
module WidgetHelper
|
3
|
-
WIDGETS = {} unless defined?(WIDGETS)
|
4
|
-
|
5
3
|
def widget(*args, &block)
|
6
4
|
options = args.extract_options!
|
7
5
|
name = args.shift
|
8
6
|
|
9
|
-
if
|
10
|
-
widget_partial(name, options, &block)
|
11
|
-
elsif self.respond_to?("#{name}_widget")
|
7
|
+
if self.respond_to?("#{name}_widget")
|
12
8
|
send("#{name}_widget", name, options, &block)
|
13
9
|
else
|
14
10
|
raise "Please either define a helper method '#{name}_widget' or create a partial such as 'shared/widgets/#{name}.haml'"
|
@@ -111,28 +107,6 @@ module Storefront
|
|
111
107
|
end
|
112
108
|
|
113
109
|
protected
|
114
|
-
def widget_partial(name, options = {}, &block)
|
115
|
-
options.merge!(:yielded_content => block_given? ? capture(&block) : nil)
|
116
|
-
dir = name.is_a?(::Symbol) ? ::File.join(storefront_config.widgets_path, name.to_s) : name.to_s
|
117
|
-
render(:partial => dir, :locals => options)
|
118
|
-
end
|
119
|
-
|
120
|
-
def widget_partial?(name)
|
121
|
-
return WIDGETS[name] if WIDGETS.has_key?(name)
|
122
|
-
|
123
|
-
dir = name.is_a?(::Symbol) ? ::File.join(storefront_config.widgets_path, name.to_s) : name.to_s
|
124
|
-
|
125
|
-
path = "#{Rails.root}/app/views/#{dir}"
|
126
|
-
|
127
|
-
template = "_#{File.basename(path, File.extname(path))}"
|
128
|
-
|
129
|
-
WIDGETS[name] = Dir.entries(File.dirname(path))[2..-1].detect do |file|
|
130
|
-
template == File.basename(file, File.extname(file))
|
131
|
-
end.present?
|
132
|
-
|
133
|
-
WIDGETS[name]
|
134
|
-
end
|
135
|
-
|
136
110
|
def widget_options(type, *args)
|
137
111
|
options = args.extract_options!
|
138
112
|
key = args.shift
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: storefront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Lance Pollard
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-06 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Semantic HTML5 for Rails
|