autoforme 1.0.0 → 1.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/lib/autoforme/frameworks/roda.rb +1 -1
- data/lib/autoforme/table.rb +3 -1
- data/lib/autoforme/version.rb +1 -1
- data/spec/basic_spec.rb +27 -4
- data/spec/sequel_spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdba8a6d624942582b3ca471ea9843bbb52cfc12
|
4
|
+
data.tar.gz: 8d01c8751490a15de34459e41b0ebf5440ee9f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00fa2b89b05bde608fb09dc4dc54daadce1a8c622184e7a8ee18477eccc24a44be561ab3077b93327c060bf9f4c996b6a3cdacaa8025bc33d11e5026a4cf105c
|
7
|
+
data.tar.gz: f2d0e910488aefef9e4ffff4ec23bf9a050622b17c0f317a5d2b1ee71579dedca429b9181a25f77262c9e39fca0327d44151e038ceb28b9bb9cf9f7f3ca5a17a
|
data/CHANGELOG
CHANGED
data/lib/autoforme/table.rb
CHANGED
@@ -56,7 +56,9 @@ module AutoForme
|
|
56
56
|
objs.each do |obj|
|
57
57
|
html << "<tr>"
|
58
58
|
columns.each do |column|
|
59
|
-
|
59
|
+
val = model.column_value(type, request, obj, column)
|
60
|
+
val = val.to_s('F') if defined?(BigDecimal) && val.is_a?(BigDecimal)
|
61
|
+
html << "<td>#{h val}</td>"
|
60
62
|
end
|
61
63
|
html << "<td><a href=\"#{action.url_for("show/#{model.primary_key_value(obj)}")}\" class=\"btn btn-mini btn-info\">Show</a></td>" if show
|
62
64
|
html << "<td><a href=\"#{action.url_for("edit/#{model.primary_key_value(obj)}")}\" class=\"btn btn-mini btn-primary\">Edit</a></td>" if edit
|
data/lib/autoforme/version.rb
CHANGED
data/spec/basic_spec.rb
CHANGED
@@ -120,7 +120,7 @@ describe AutoForme do
|
|
120
120
|
Artist.count.should == 0
|
121
121
|
end
|
122
122
|
|
123
|
-
it "should custom headers and footers" do
|
123
|
+
it "should support custom headers and footers" do
|
124
124
|
app_setup(Artist) do
|
125
125
|
page_header "<a href='/Artist/new'>N</a>"
|
126
126
|
page_footer "<a href='/Artist/edit'>E</a>"
|
@@ -135,7 +135,7 @@ describe AutoForme do
|
|
135
135
|
click_button 'Edit'
|
136
136
|
end
|
137
137
|
|
138
|
-
it "should custom redirects" do
|
138
|
+
it "should support custom redirects" do
|
139
139
|
app_setup(Artist) do
|
140
140
|
redirect do |obj, type, req|
|
141
141
|
case type
|
@@ -161,7 +161,7 @@ describe AutoForme do
|
|
161
161
|
page.current_path.should == "/Artist/new"
|
162
162
|
end
|
163
163
|
|
164
|
-
it "should custom form options and attributes" do
|
164
|
+
it "should support custom form options and attributes" do
|
165
165
|
app_setup(Artist) do
|
166
166
|
form_attributes :class=>'foobar', :action=>'/create_artist'
|
167
167
|
form_options :input_defaults=>{'text'=>{:class=>'barfoo'}}
|
@@ -172,7 +172,7 @@ describe AutoForme do
|
|
172
172
|
find('form input#artist_name')[:class].should == 'barfoo'
|
173
173
|
end
|
174
174
|
|
175
|
-
it "should support specifying column options per type" do
|
175
|
+
it "should support support specifying column options per type" do
|
176
176
|
app_setup(Artist) do
|
177
177
|
column_options{|column, type, req| {:label=>"#{type.to_s.capitalize} Artist #{column.to_s.capitalize}"}}
|
178
178
|
end
|
@@ -659,3 +659,26 @@ describe AutoForme do
|
|
659
659
|
click_button 'Delete'
|
660
660
|
end
|
661
661
|
end
|
662
|
+
|
663
|
+
describe AutoForme do
|
664
|
+
before(:all) do
|
665
|
+
db_setup(:artists=>[[:num, :decimal]])
|
666
|
+
model_setup(:Artist=>[:artists])
|
667
|
+
end
|
668
|
+
after(:all) do
|
669
|
+
Object.send(:remove_const, :Artist)
|
670
|
+
end
|
671
|
+
|
672
|
+
it "should display decimals in float format in tables" do
|
673
|
+
app_setup(Artist)
|
674
|
+
visit("/Artist/new")
|
675
|
+
page.find('title').text.should == 'Artist - New'
|
676
|
+
fill_in 'Num', :with=>'1.01'
|
677
|
+
click_button 'Create'
|
678
|
+
click_link 'Artist'
|
679
|
+
all('tr td:first-child').map{|s| s.text}.should == %w'1.01'
|
680
|
+
click_link 'Search'
|
681
|
+
click_button 'Search'
|
682
|
+
all('tr td:first-child').map{|s| s.text}.should == %w'1.01'
|
683
|
+
end
|
684
|
+
end
|
data/spec/sequel_spec_helper.rb
CHANGED
@@ -19,7 +19,7 @@ RSpec.configure do |c|
|
|
19
19
|
end
|
20
20
|
|
21
21
|
module AutoFormeSpec
|
22
|
-
TYPE_MAP = {:string=>String, :integer=>Integer}
|
22
|
+
TYPE_MAP = {:string=>String, :integer=>Integer, :decimal=>Numeric}
|
23
23
|
def self.db_setup(tables)
|
24
24
|
db = Sequel.connect(ENV['DATABASE_URL'] || 'sqlite:/')
|
25
25
|
#db.loggers << Logger.new($stdout)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoforme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forme
|