simple_form_awesome 2.3.0 → 2.4.0

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/README.md CHANGED
@@ -9,7 +9,7 @@ https://docs.atlassian.com/aui/latest . Enjoy it!
9
9
 
10
10
  Add it to your Gemfile:
11
11
 
12
- `gem 'simple_form_awesome'`
12
+ `gem 'simple_form_awesome', '~> 2.4.0'`
13
13
 
14
14
  Run the following command to install it:
15
15
 
@@ -20,6 +20,23 @@ Run the generator to install with AUI:
20
20
  `rails generate simple_form:install --aui`
21
21
 
22
22
 
23
+ Inside your views, please add fieldset tag, and wrapper your submit or cancel
24
+ under a div that class is field_group.
25
+
26
+ NOTE: please use :as => :text_area instead of :as => :text when you want to use aui style.
27
+ as the following:
28
+
29
+ ```erb
30
+ = simple_form_for @user do |form|
31
+ %fieldset
32
+ = f.input :name
33
+ = f.input :description, :as => :text_area
34
+
35
+ .field_group
36
+ = f.submit :class => "aui-button aui-button-primary"
37
+ = link_to "Cancel", "", :class => "aui-button aui-button-link"
38
+ ```
39
+
23
40
  ## License
24
41
 
25
42
  MIT License. Copyright 2012 Plataformatec.
@@ -9,7 +9,7 @@
9
9
 
10
10
  = simple_form_for @user do |form|
11
11
  %fieldset
12
- = f.input :name, :as => :aui_string
12
+ = f.input :name
13
13
  = f.input :description, :as => :text_area
14
14
 
15
15
  .field_group
@@ -23,4 +23,4 @@ module SimpleForm
23
23
  end
24
24
  end
25
25
  end
26
- end
26
+ end
@@ -2,7 +2,7 @@ require 'simple_form/core_ext/hash'
2
2
 
3
3
  module SimpleForm
4
4
  class FormBuilder < ActionView::Helpers::FormBuilder
5
- attr_reader :template, :object_name, :object, :wrapper
5
+ attr_reader :template, :object_name, :object, :wrapper, :wrapper_name
6
6
 
7
7
  # When action is create or update, we still should use new and edit
8
8
  ACTIONS = {
@@ -26,8 +26,7 @@ module SimpleForm
26
26
  map_type :date, :time, :datetime, :to => SimpleForm::Inputs::DateTimeInput
27
27
  map_type :country, :time_zone, :to => SimpleForm::Inputs::PriorityInput
28
28
  map_type :boolean, :to => SimpleForm::Inputs::BooleanInput
29
- map_type :text_area, to: SimpleForm::Inputs::TextAreaInput
30
- map_type :aui_string, to: SimpleForm::Inputs::AuiStringInput
29
+ map_type :text_area, :to => SimpleForm::Inputs::TextAreaInput
31
30
 
32
31
 
33
32
  def self.discovery_cache
@@ -37,7 +36,8 @@ module SimpleForm
37
36
  def initialize(*) #:nodoc:
38
37
  super
39
38
  @defaults = options[:defaults]
40
- @wrapper = SimpleForm.wrapper(options[:wrapper] || SimpleForm.default_wrapper)
39
+ @wrapper_name = options[:wrapper] || SimpleForm.default_wrapper
40
+ @wrapper = SimpleForm.wrapper(@wrapper_name)
41
41
  end
42
42
 
43
43
  # Basic input helper, combines all components in the stack to generate
@@ -18,6 +18,5 @@ module SimpleForm
18
18
  autoload :StringInput, 'simple_form/inputs/string_input'
19
19
  autoload :TextInput, 'simple_form/inputs/text_input'
20
20
  autoload :TextAreaInput, 'simple_form/inputs/text_area_input'
21
- autoload :AuiStringInput, 'simple_form/inputs/aui_string_input'
22
21
  end
23
22
  end
@@ -87,6 +87,9 @@ module SimpleForm
87
87
  end
88
88
 
89
89
  private
90
+ def aui?
91
+ :aui == @builder.wrapper_name
92
+ end
90
93
 
91
94
  def add_size!
92
95
  input_html_options[:size] ||= [limit, SimpleForm.default_input_size].compact.min
@@ -9,6 +9,8 @@ module SimpleForm
9
9
  input_html_options[:type] ||= input_type if html5?
10
10
  end
11
11
 
12
+ input_html_classes.unshift("text") if aui?
13
+
12
14
  add_size!
13
15
  @builder.text_field(attribute_name, input_html_options)
14
16
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleForm
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_awesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-05-31 00:00:00.000000000 Z
15
+ date: 2013-06-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activemodel
@@ -78,7 +78,6 @@ files:
78
78
  - lib/simple_form/inputs/collection_check_boxes_input.rb
79
79
  - lib/simple_form/inputs/text_area_input.rb
80
80
  - lib/simple_form/inputs/password_input.rb
81
- - lib/simple_form/inputs/aui_string_input.rb
82
81
  - lib/simple_form/inputs/text_input.rb
83
82
  - lib/simple_form/inputs/numeric_input.rb
84
83
  - lib/simple_form/inputs/range_input.rb
@@ -1,10 +0,0 @@
1
- module SimpleForm
2
- module Inputs
3
- class AuiStringInput < StringInput
4
- def input
5
- input_html_classes.append("text")
6
- super
7
- end
8
- end
9
- end
10
- end