storefront 0.3.1 → 0.3.2
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/definition_list_helper.rb +23 -10
- 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.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
s.description = "Semantic HTML5 for Rails"
|
10
10
|
s.summary = "A simple and semantic FormBuilder, TableBuilder, Locale Interpolator, and Widget API for Rails 3"
|
11
11
|
s.homepage = "http://github.com/viatropos/storefront"
|
@@ -8,7 +8,7 @@ module Storefront
|
|
8
8
|
@separator = options.has_key?(:separator) ? options[:separator] : storefront_config.term_separator
|
9
9
|
header = header_widget(options)
|
10
10
|
haml_concat header.gsub(/\n$/, "") if header.present?
|
11
|
-
|
11
|
+
|
12
12
|
haml_tag options[:tag], options[:content_html], &block
|
13
13
|
|
14
14
|
if options[:footer_html].present?
|
@@ -32,12 +32,15 @@ module Storefront
|
|
32
32
|
options
|
33
33
|
end
|
34
34
|
|
35
|
-
def definition(
|
35
|
+
def definition(*args, &block)
|
36
|
+
options = args.extract_options!
|
37
|
+
key = args.shift
|
38
|
+
value = args.shift || block
|
36
39
|
locale_options = options.delete(:locale_options) || {}
|
37
|
-
label
|
40
|
+
label = t?(key, locale_options.reverse_merge(:scope => :"terms.labels"))
|
38
41
|
|
39
|
-
key_html
|
40
|
-
value_html
|
42
|
+
key_html = options.delete(:key_html) || {}
|
43
|
+
value_html = options.delete(:value_html) || {}
|
41
44
|
|
42
45
|
key_html.reverse_merge! clone_attributes(options)
|
43
46
|
value_html.reverse_merge! clone_attributes(options)
|
@@ -45,12 +48,12 @@ module Storefront
|
|
45
48
|
merge_class! key_html, storefront_config.term_key_class
|
46
49
|
merge_class! value_html, storefront_config.term_value_class
|
47
50
|
|
48
|
-
id_base
|
51
|
+
id_base = label.underscore.strip.gsub(/[\s|_]+/, storefront_config.separator).squeeze(storefront_config.separator)
|
49
52
|
|
50
53
|
key_html[:id] ||= "#{id_base}-key"
|
51
54
|
value_html[:id] ||= "#{id_base}-value"
|
52
55
|
|
53
|
-
separator
|
56
|
+
separator = options[:separator] || @separator
|
54
57
|
|
55
58
|
label.gsub!(/#{separator}?$/, separator) if separator.present?
|
56
59
|
|
@@ -68,11 +71,13 @@ module Storefront
|
|
68
71
|
end
|
69
72
|
alias term definition
|
70
73
|
|
71
|
-
def definition_list(&block)
|
74
|
+
def definition_list(options = {}, &block)
|
75
|
+
@separator = options.has_key?(:separator) ? options[:separator] : storefront_config.term_separator
|
72
76
|
capture_haml do
|
73
77
|
haml_tag storefront_config.terms_tag do
|
74
78
|
yield
|
75
79
|
end
|
80
|
+
@separator = nil
|
76
81
|
end
|
77
82
|
end
|
78
83
|
alias terms definition_list
|
@@ -81,7 +86,11 @@ module Storefront
|
|
81
86
|
def _definiton_list_term(label, value, key_html, value_html)
|
82
87
|
capture_haml do
|
83
88
|
haml_tag :dt, label, key_html
|
84
|
-
|
89
|
+
if value.is_a?(::Proc)
|
90
|
+
haml_tag :dd, value_html, &value
|
91
|
+
else
|
92
|
+
haml_tag :dd, value, value_html
|
93
|
+
end
|
85
94
|
end
|
86
95
|
end
|
87
96
|
|
@@ -89,7 +98,11 @@ module Storefront
|
|
89
98
|
capture_haml do
|
90
99
|
haml_tag :tr, :class => storefront_config.term_class do
|
91
100
|
haml_tag :td, label, key_html
|
92
|
-
|
101
|
+
if value.is_a?(::Proc)
|
102
|
+
haml_tag :td, value_html, &value
|
103
|
+
else
|
104
|
+
haml_tag :td, value, value_html
|
105
|
+
end
|
93
106
|
end
|
94
107
|
end
|
95
108
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: storefront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.2
|
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-10 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Semantic HTML5 for Rails
|