Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'rails_admin/config/fields/base' | ||
|
||
module RailsAdmin | ||
module Config | ||
module Fields | ||
module Types | ||
class Numeric < RailsAdmin::Config::Fields::Base | ||
# Register field type for the type loader | ||
RailsAdmin::Config::Fields::Types.register(self) | ||
|
||
register_instance_option :view_helper do | ||
:number_field | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe RailsAdmin::Config::Fields::Types::Decimal do | ||
it_behaves_like 'a generic field type', :decimal_field, :decimal | ||
it_behaves_like 'a float-like field type', :float_field | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe RailsAdmin::Config::Fields::Types::Float do | ||
it_behaves_like 'a generic field type', :float_field, :float | ||
it_behaves_like 'a float-like field type', :float_field | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe RailsAdmin::Config::Fields::Types::Numeric do | ||
it_behaves_like 'a generic field type', :integer_field, :integer | ||
|
||
subject do | ||
RailsAdmin.config('FieldTest').fields.detect do |f| | ||
f.name == :integer_field | ||
end.with(object: FieldTest.new) | ||
end | ||
|
||
describe '#view_helper' do | ||
it "uses the 'number' type input tag" do | ||
expect(subject.view_helper).to eq(:number_field) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters