storefront 0.5.1 → 0.5.2

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.
@@ -1,19 +1,21 @@
1
1
  module Storefront
2
- class Form
3
- # attributes: maxlength, placeholder, required, wrap, readonly
4
- class Textarea < Input
5
- resolves :text, :textarea, :watched
2
+ module Components
3
+ class Form
4
+ # attributes: maxlength, placeholder, required, wrap, readonly
5
+ class Textarea < Input
6
+ resolves :text, :textarea, :watched
6
7
 
7
- def initialize(options = {})
8
- super
8
+ def initialize(options = {})
9
+ super
9
10
 
10
- @value = attributes.delete(:value)
11
- end
11
+ @value = attributes.delete(:value)
12
+ end
12
13
 
13
- def textarea_input(options = {})
14
- base_input :textarea, value, options
14
+ def textarea_input(options = {})
15
+ base_input :textarea, value, options
16
+ end
17
+ alias_method :text_input, :textarea_input
15
18
  end
16
- alias_method :text_input, :textarea_input
17
19
  end
18
20
  end
19
21
  end
@@ -1,15 +1,17 @@
1
1
  module Storefront
2
- class Form
3
- class Value < Input
4
- resolves :value
2
+ module Components
3
+ class Form
4
+ class Value < Input
5
+ resolves :value
5
6
 
6
- def initialize(options = {})
7
- super
8
- @value = attributes.delete(:value)
9
- end
7
+ def initialize(options = {})
8
+ super
9
+ @value = attributes.delete(:value)
10
+ end
10
11
 
11
- def value_input
12
- base_input :output, value
12
+ def value_input
13
+ base_input :output, value
14
+ end
13
15
  end
14
16
  end
15
17
  end
@@ -1,31 +1,33 @@
1
1
  module Storefront
2
- class Form
3
- class Label < Storefront::Form::Base
4
- def initialize(options = {})
5
- super
2
+ module Components
3
+ class Form
4
+ class Label < Storefront::Components::Form::Base
5
+ def initialize(options = {})
6
+ super
6
7
 
7
- attributes.merge!(options[:label_html]) if options[:label_html]
8
- attributes.delete :label_html
9
- attributes.delete :label
8
+ attributes.merge!(options[:label_html]) if options[:label_html]
9
+ attributes.delete :label_html
10
+ attributes.delete :label
10
11
 
11
- unless options[:label] == false
12
- merge_class! attributes, config.label_class
13
- attributes[:id] ||= attribute.to_id(:type => :error, :index => index, :parent_index => parent_index) if config.id_enabled_on.include?("label")
14
- attributes[:for] ||= attribute.to_id(:type => :input, :index => index, :parent_index => parent_index) if config.id_enabled_on.include?("input")
12
+ unless options[:label] == false
13
+ merge_class! attributes, config.label_class
14
+ attributes[:id] ||= attribute.to_id(:type => :error, :index => index, :parent_index => parent_index) if config.id_enabled_on.include?("label")
15
+ attributes[:for] ||= attribute.to_id(:type => :input, :index => index, :parent_index => parent_index) if config.id_enabled_on.include?("input")
15
16
 
16
- @value = localize(:labels, attribute.name, options[:label].is_a?(::String) ? options[:label] : nil)
17
- @value = attribute.to_label if @value.blank?
17
+ @value = localize(:labels, attribute.name, options[:label].is_a?(::String) ? options[:label] : nil)
18
+ @value = attribute.to_label if @value.blank?
19
+ end
18
20
  end
19
- end
20
21
 
21
- def render(&block)
22
- template.capture_haml do
23
- template.haml_tag :label, attributes do
24
- template.haml_tag :span, value
25
- if attribute.required?
26
- template.haml_tag :abbr, config.required_abbr, :title => config.required_title, :class => config.required_class
27
- else
28
- template.haml_tag :abbr, config.optional_abbr, :title => config.optional_title, :class => config.optional_class
22
+ def render(&block)
23
+ template.capture_haml do
24
+ template.haml_tag :label, attributes do
25
+ template.haml_tag :span, value
26
+ if attribute.required?
27
+ template.haml_tag :abbr, config.required_abbr, :title => config.required_title, :class => config.required_class
28
+ else
29
+ template.haml_tag :abbr, config.optional_abbr, :title => config.optional_title, :class => config.optional_class
30
+ end
29
31
  end
30
32
  end
31
33
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: storefront
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.1
5
+ version: 0.5.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Lance Pollard