autoforme 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86f7ea431b13b17ae2f2c67a5051e58ed8f6bab8
4
- data.tar.gz: 01fa45ac012900a4bebee2730aa8a415a88b0184
3
+ metadata.gz: fdba8a6d624942582b3ca471ea9843bbb52cfc12
4
+ data.tar.gz: 8d01c8751490a15de34459e41b0ebf5440ee9f59
5
5
  SHA512:
6
- metadata.gz: ad900255d457cb444dd486118f45ee7127752439c4c72292431b1d020fed40abae4cb828bd8bf22bb3199443df6df0ece873ad85a678b5822212908eb3c8a93e
7
- data.tar.gz: 2545e4f885fad140056be830b998d88be8771b5adaf8949b5e5e4ef4e9e37bbebfdd0a41cea47fc19f6c66757e21215c5804f48f138266d76988e4c644a2603a
6
+ metadata.gz: 00fa2b89b05bde608fb09dc4dc54daadce1a8c622184e7a8ee18477eccc24a44be561ab3077b93327c060bf9f4c996b6a3cdacaa8025bc33d11e5026a4cf105c
7
+ data.tar.gz: f2d0e910488aefef9e4ffff4ec23bf9a050622b17c0f317a5d2b1ee71579dedca429b9181a25f77262c9e39fca0327d44151e038ceb28b9bb9cf9f7f3ca5a17a
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.0.1 (2014-08-19)
2
+
3
+ * Display BigDecimal values in float format on browse/search pages (jeremyevans)
4
+
5
+ * Work on roda with all template frameworks, not just erb (jeremyevans)
6
+
1
7
  === 1.0.0 (2014-07-30)
2
8
 
3
9
  * Assume :sequel model type (jeremyevans)
@@ -55,7 +55,7 @@ module AutoForme
55
55
 
56
56
  r.on *current_matchers do
57
57
  @autoforme_text = @autoforme_action.handle
58
- opts = {:inline=>"<%= @autoforme_text %>"}
58
+ opts = {:content=>@autoforme_text}
59
59
  opts[:layout] = false if @autoforme_action.request.xhr?
60
60
  view opts
61
61
  end
@@ -56,7 +56,9 @@ module AutoForme
56
56
  objs.each do |obj|
57
57
  html << "<tr>"
58
58
  columns.each do |column|
59
- html << "<td>#{h model.column_value(type, request, obj, column)}</td>"
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
@@ -1,6 +1,6 @@
1
1
  module AutoForme
2
2
  # Version constant, use <tt>AutoForme.version</tt> instead.
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.0.1'.freeze
4
4
 
5
5
  # Returns the version as a frozen string (e.g. '0.1.0')
6
6
  def self.version
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
@@ -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.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-07-30 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: forme