storefront 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.5.0"
8
+ s.version = "0.5.1"
9
9
  s.description = "Opinionated Forms, Tables, and Widgets for Rails and Sinatra"
10
10
  s.summary = "A simple and semantic FormBuilder, TableBuilder, Locale Interpolator, and Widget API for Rails 3 and Sinatra"
11
11
  s.homepage = "http://github.com/viatropos/storefront"
@@ -3,7 +3,13 @@ module Storefront
3
3
  class DefinitionListItem < Storefront::Components::Base
4
4
  def render(&block)
5
5
  template.capture_haml do
6
- template.haml_tag :dt, options[:key], options[:key_html] unless options[:key].nil?
6
+ unless options[:key].nil?
7
+ if options[:definition] == true
8
+ template.haml_tag :dt, template.haml_tag(:dfn, options[:key]), options[:key_html]
9
+ else
10
+ template.haml_tag :dt, options[:key], options[:key_html]
11
+ end
12
+ end
7
13
 
8
14
  if block_given? # i.e. multiple definitions for a term
9
15
  template.haml_tag :dd, options[:value_html], &block
@@ -13,6 +19,7 @@ module Storefront
13
19
  end
14
20
  end
15
21
 
22
+ # @option :definition If true, wraps text in +<dfn>+.
16
23
  def extract_options!(*args)
17
24
  options = args.extract_options!
18
25
  key = args.shift || options[:key]
@@ -25,10 +32,12 @@ module Storefront
25
32
  if options[:auto_id] == true && !value.nil?
26
33
  id_base = label.underscore.strip.gsub(/[\s|_]+/, config.separator).squeeze(config.separator)
27
34
  end
28
-
35
+
29
36
  key_html = options.delete(:key_html) || {}
30
37
  merge_class! key_html, config.term_key_class
31
38
 
39
+ key_html[:lang] = options[:lang] if options[:lang]
40
+
32
41
  if id_base
33
42
  key_html[:id] ||= "#{id_base}-key"
34
43
  end
@@ -1,7 +1,6 @@
1
1
  module Storefront
2
2
  module Components
3
3
  class Table < Base
4
-
5
4
  attr_reader :content, :template, :key
6
5
 
7
6
  def initialize(template, *args)
@@ -17,8 +16,8 @@ module Storefront
17
16
  options[:class] = ["data-table", options[:class]].compact.uniq.join(" ")
18
17
  options[:role] = :grid
19
18
  data = options.delete(:data) || {}
20
- data[:url] = options[:url] || @template.controller.request.path
21
- data[:for] = options[:for] || options[:model] || @key
19
+ #data[:url] = options[:url] || @template.controller.request.path
20
+ #data[:for] = options[:for] || options[:model] || @key
22
21
  data[:total] = options[:total] if options[:total]
23
22
  data[:page] = options[:page] if options[:page]
24
23
  data[:count] = options[:count] if options[:count]
@@ -26,6 +25,7 @@ module Storefront
26
25
  aria[:"aria-multiselectable"] = false unless aria.has_key?(:"aria-multiselectable") || options[:multiselect] == true
27
26
  options[:data] = data
28
27
  options[:id] ||= "#{record_or_key.to_s}-table"
28
+ @options = options
29
29
  end
30
30
 
31
31
  def render(&block)
@@ -203,12 +203,12 @@ module Storefront
203
203
  if block_given?
204
204
  template.haml_tag :td, attributes, &block
205
205
  else
206
- template.haml_tag :td, value.to_s.strip, attributes
206
+ template.haml_tag :td, value, attributes
207
207
  end
208
208
  @cell_index += 1
209
209
  end
210
210
  end
211
-
211
+
212
212
  def record_key(record_or_key)
213
213
  if record_or_key.is_a?(String) || record_or_key.is_a?(Symbol)
214
214
  record_or_key.to_s
@@ -0,0 +1,7 @@
1
+ module Storefront
2
+ module Components
3
+ class Time < Storefront::Components::Base
4
+
5
+ end
6
+ end
7
+ end
@@ -24,6 +24,63 @@ module Storefront
24
24
  #
25
25
  # capture_haml { haml_tag :img, options }
26
26
  # end
27
+
28
+ # The +kbd+ element typically represents keyboard input, though it may also represent other input, such as voice commands.
29
+ def keyboard_tag(key, options = {})
30
+ options[:title] ||= key
31
+ value = keyboard_shortcut_map[key]
32
+ capture_haml { haml_tag :kbd, value, options }
33
+ end
34
+
35
+ def keyboard_shortcut_map
36
+ @keyboard_shortcut_map ||= t(:keyboard)
37
+ end
38
+
39
+ # keyboard_shortcut_tag(:command, :shift, :s, :title => :save)
40
+ # <kbd title='save'>
41
+ # <kbd title='command'>⌘</kbd><kbd title='shift'> ⇧</kbd><kbd>s</kbd>
42
+ # </kbd>
43
+ def keyboard_shortcut_tag(*args)
44
+ options = args.extract_options!
45
+
46
+ capture_haml do
47
+ haml_tag :kbd, options do
48
+ args.each do |key|
49
+ keyboard_tag(key)
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ def abbr_tag(key, options = {})
56
+ options[:title] ||= key
57
+ value = abbr_map[key]
58
+ capture_haml { haml_tag :abbr, value, options }
59
+ end
60
+
61
+ def abbr_map
62
+ @abbr_map ||= t(:abbr)
63
+ end
64
+
65
+ def meter_tag
66
+
67
+ end
68
+
69
+ def progress_tag
70
+
71
+ end
72
+
73
+ def unicode_entity(key)
74
+ unicode_map[key][:code]
75
+ end
76
+
77
+ def unicode_glyph(key)
78
+ unicode_map[key][:glypy]
79
+ end
80
+
81
+ def unicode_map
82
+ @unicode_map ||= t(:unicode)
83
+ end
27
84
  end
28
85
  end
29
86
  end
@@ -6,7 +6,7 @@ module Storefront
6
6
  end
7
7
 
8
8
  ActiveSupport.on_load :active_record do
9
- Object.send :include, Storefront::ModelHelper
9
+ Object.send :include, Storefront::Helpers::ModelHelper
10
10
  end
11
11
 
12
12
  ActiveSupport.on_load :action_controller do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: storefront
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
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-09-14 00:00:00 Z
13
+ date: 2011-09-20 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Opinionated Forms, Tables, and Widgets for Rails and Sinatra
@@ -60,6 +60,7 @@ files:
60
60
  - lib/storefront/components/sidebar.rb
61
61
  - lib/storefront/components/table.rb
62
62
  - lib/storefront/components/text.rb
63
+ - lib/storefront/components/time.rb
63
64
  - lib/storefront/configuration.rb
64
65
  - lib/storefront/helpers/cache_helper.rb
65
66
  - lib/storefront/helpers/component_helper.rb