Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding range input type #308

Closed
wants to merge 2 commits into from

3 participants

@adamyonk

No description provided.

@rafaelfranca
Collaborator

Hi mate. We had a lot of duplication here. I think that is a better idea add a new mapping to NumericInput instead of create a new class.

Could your try it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 25, 2011
  1. Adding RangeInput class

    Adam Jahnke authored
Commits on Sep 1, 2011
  1. Mapping range to Numeric class

    Adam Jahnke authored
This page is out of date. Refresh to see the latest.
View
2  lib/simple_form/form_builder.rb
@@ -7,7 +7,7 @@ class FormBuilder < ActionView::Helpers::FormBuilder
map_type :text, :file, :to => SimpleForm::Inputs::MappingInput
map_type :string, :password, :email, :search, :tel, :url, :to => SimpleForm::Inputs::StringInput
- map_type :integer, :decimal, :float, :to => SimpleForm::Inputs::NumericInput
+ map_type :integer, :decimal, :float, :range, :to => SimpleForm::Inputs::NumericInput
map_type :select, :radio, :check_boxes, :to => SimpleForm::Inputs::CollectionInput
map_type :date, :time, :datetime, :to => SimpleForm::Inputs::DateTimeInput
map_type :country, :time_zone, :to => SimpleForm::Inputs::PriorityInput
View
3  lib/simple_form/inputs.rb
@@ -9,6 +9,7 @@ module Inputs
autoload :MappingInput, 'simple_form/inputs/mapping_input'
autoload :NumericInput, 'simple_form/inputs/numeric_input'
autoload :PriorityInput, 'simple_form/inputs/priority_input'
+ #autoload :RangeInput, 'simple_form/inputs/range_input'
autoload :StringInput, 'simple_form/inputs/string_input'
end
-end
+end
View
4 test/form_builder_test.rb
@@ -217,6 +217,10 @@ def with_association_for(object, *args)
with_form_for @user, :born_at, :as => :string
assert_no_select 'form select'
assert_select 'form input#user_born_at.string'
+
+ with_form_for @user, :age, :as => :range
+ assert_no_select 'form .input.integer'
+ assert_select 'form input#user_age.range'
end
# COMMON OPTIONS
Something went wrong with that request. Please try again.