autoforme 0.5.0 → 0.5.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: 6375a5b69141ffd6b2d499165407588b1e11154d
4
- data.tar.gz: 24578636cda7918d7deb38dc24ccd44d4d2c5887
3
+ metadata.gz: c90629ac93941ca426fb8db3fbb83618a367330c
4
+ data.tar.gz: 756db19ef87d030d8c4d233521f20b8a18bfbb31
5
5
  SHA512:
6
- metadata.gz: 83f29c0cf2764928f08d23c7b4e54b636a50670a1d75dee7698616e4f8828206b3c3adee93c75937cbd6d0d81b1aff4cfc2395e934429a5eb12c8b9b1a05a9bc
7
- data.tar.gz: 869465f07383c25f289f39c143dacf978502a9af1f0c8d6c0cdc5f0b271ec5aa4cc2b8190680c0fcbd7c43968437075036221d1e84a9fb51511dc9979821d226
6
+ metadata.gz: 5f879772b9cefac7eef9cc136510e7fa1e2297ba4ce6dec115b23c5acaf6f6b1835c94e092ea460ec5c5de05d855ae975b040a3771991c84e3affd072f450a39
7
+ data.tar.gz: 3509bedb63c7ee892a4e6cf077aa4ea4175a0013a27ecb8a88cc17fe0edf642b4328455a667d9b275d9a0e07196d49323a5340eab8d5e6899811eda509793501
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.5.1 (2013-12-17)
2
+
3
+ * Show header with display name for current object on mtm edit page (jeremyevans)
4
+
5
+ * Handle empty values for many_to_one associations on new/edit forms (jeremyevans)
6
+
1
7
  === 0.5.0 (2013-12-13)
2
8
 
3
9
  * Initial Public Release
data/README.rdoc CHANGED
@@ -12,10 +12,18 @@ flexible in terms of configuration.
12
12
  1. https://github.com/jeremyevans/forme
13
13
  2. https://github.com/jeremyevans/scaffolding_extensions
14
14
 
15
+ = Installation
16
+
17
+ sudo gem install autoforme
18
+
15
19
  = Demo Site
16
20
 
17
21
  A demo site is available at http://autoforme-demo.jeremyevans.net
18
22
 
23
+ = Documentation Site
24
+
25
+ RDoc Documentation is available at http://autoforme.jeremyevans.net
26
+
19
27
  = Source Code
20
28
 
21
29
  Source code is available on GitHub at https://github.com/jeremyevans/autoforme
data/Rakefile CHANGED
@@ -52,7 +52,7 @@ end
52
52
 
53
53
  ### RDoc
54
54
 
55
- RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'AutoForme: Web Adminstrative Console for Sinatra/Rails and Sequel']
55
+ RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'AutoForme: Web Administrative Console for Sinatra/Rails and Sequel']
56
56
 
57
57
  begin
58
58
  gem 'rdoc', '= 3.12.2'
@@ -428,7 +428,8 @@ module AutoForme
428
428
  obj = model.with_pk(:edit, request, request.id)
429
429
  if assoc = params_association
430
430
  page do
431
- Forme.form(obj, form_attributes(:action=>url_for("mtm_update/#{model.primary_key_value(obj)}?association=#{assoc}")), form_opts) do |f|
431
+ t = "<h2>Edit #{humanize(assoc)} for #{h model.object_display_name(type, request, obj)}</h2>"
432
+ t << Forme.form(obj, form_attributes(:action=>url_for("mtm_update/#{model.primary_key_value(obj)}?association=#{assoc}")), form_opts) do |f|
432
433
  opts = model.column_options_for(:mtm_edit, request, assoc)
433
434
  add_opts = opts[:add] ? opts.merge(opts.delete(:add)) : opts
434
435
  remove_opts = opts[:remove] ? opts.merge(opts.delete(:remove)) : opts
@@ -440,7 +441,7 @@ module AutoForme
440
441
  end
441
442
  f.input(assoc, {:name=>'remove[]', :id=>'remove', :label=>'Disassociate From', :dataset=>model.associated_mtm_objects(request, assoc, obj), :value=>[]}.merge(remove_opts))
442
443
  f.button(:value=>'Update', :class=>'btn btn-primary')
443
- end
444
+ end.to_s
444
445
  end
445
446
  else
446
447
  page do
@@ -41,7 +41,9 @@ module AutoForme
41
41
  ds = model_class.apply_filter(:association, request, ds)
42
42
  end
43
43
 
44
- if v = params[ref[:key]]
44
+ v = params[ref[:key]]
45
+ v = nil if v.to_s.strip == ''
46
+ if v
45
47
  v = ds.first!(S.qualify(ds.model.table_name, ref.primary_key)=>v)
46
48
  end
47
49
  else
@@ -1,6 +1,6 @@
1
1
  module AutoForme
2
2
  # Version constant, use <tt>AutoForme.version</tt> instead.
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.5.1'.freeze
4
4
 
5
5
  # Returns the version as a frozen string (e.g. '0.1.0')
6
6
  def self.version
@@ -26,15 +26,8 @@ describe AutoForme do
26
26
 
27
27
  visit("/Album/new")
28
28
  fill_in 'Name', :with=>'Album1'
29
- select 'Artist1'
30
29
  click_button 'Create'
31
30
 
32
- click_link 'Show'
33
- select 'Album1'
34
- click_button 'Show'
35
- page.html.should =~ /Name.+Album1/m
36
- page.html.should =~ /Artist.+Artist1/m
37
-
38
31
  click_link 'Edit'
39
32
  select 'Album1'
40
33
  click_button 'Edit'
@@ -42,6 +35,12 @@ describe AutoForme do
42
35
  select 'Artist2'
43
36
  click_button 'Update'
44
37
 
38
+ click_link 'Show'
39
+ select 'Album1'
40
+ click_button 'Show'
41
+ page.html.should =~ /Name.+Album1b/m
42
+ page.html.should =~ /Artist.+Artist2/m
43
+
45
44
  click_link 'Search'
46
45
  fill_in 'Name', :with=>'1b'
47
46
  select 'Artist2'
data/spec/mtm_spec.rb CHANGED
@@ -31,6 +31,7 @@ describe AutoForme do
31
31
  select("albums")
32
32
  click_button "Edit"
33
33
 
34
+ find('h2').text.should == 'Edit Albums for Artist1'
34
35
  all('select')[0].all('option').map{|s| s.text}.should == ["Album1", "Album2", "Album3"]
35
36
  all('select')[1].all('option').map{|s| s.text}.should == []
36
37
  select("Album1", :from=>"Associate With")
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: 0.5.0
4
+ version: 0.5.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: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2013-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: forme
@@ -105,7 +105,7 @@ rdoc_options:
105
105
  - --line-numbers
106
106
  - --inline-source
107
107
  - --title
108
- - 'AutoForme: Web Adminstrative Console for Sinatra/Rails and Sequel'
108
+ - 'AutoForme: Web Administrative Console for Sinatra/Rails and Sequel'
109
109
  - --main
110
110
  - README.rdoc
111
111
  require_paths:
@@ -122,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.0.3
125
+ rubygems_version: 2.0.14
126
126
  signing_key:
127
127
  specification_version: 4
128
- summary: Web Adminstrative Console for Sinatra/Rails and Sequel
128
+ summary: Web Administrative Console for Sinatra/Rails and Sequel
129
129
  test_files: []