easy_form_for 0.0.1.alpha → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -9
- data/Rakefile +0 -4
- data/app/models/my_model.rb +3 -0
- data/easy_form_for.gemspec +3 -2
- data/lib/easy_form_for.rb +1 -1
- data/lib/easy_form_for/version.rb +1 -1
- data/spec/helpers/form_spec.rb +13 -0
- data/spec/spec_helper.rb +9 -20
- metadata +24 -31
- data/spec/easy_form_for_spec.rb +0 -28
data/README
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
TODO:
|
2
|
-
- Create real README
|
3
|
-
- Create Docs
|
4
|
-
- Refactor
|
5
|
-
- Refactor
|
6
|
-
- Refactor
|
7
|
-
- yield block in multiple places from block (possible?)
|
8
|
-
- put tests in this project (right now they are at https://github.com/bookis/easy_form_for_specs)
|
9
|
-
|
10
1
|
Working on a rails form generator. As easy as:
|
11
2
|
|
12
3
|
<%= easy_form_for(@user) %>
|
data/Rakefile
CHANGED
data/easy_form_for.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
|
22
|
-
s.add_development_dependency "
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
23
24
|
end
|
data/lib/easy_form_for.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'easy_form_for'
|
3
|
+
# require 'app/models/my_model'
|
4
|
+
|
5
|
+
describe EasyFormFor::ViewHelpers do
|
6
|
+
before(:each) do
|
7
|
+
puts MyModel.inspect
|
8
|
+
@result = helper.easy_form_for(MyModel.new)
|
9
|
+
end
|
10
|
+
it "should return" do
|
11
|
+
@result.should have_content "name"
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,22 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require 'action_view'
|
6
|
-
require 'action_view/template'
|
7
|
-
include ActionView::Helpers
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rails/all'
|
4
|
+
require 'sqlite3'
|
8
5
|
|
9
|
-
module
|
10
|
-
class
|
11
|
-
|
12
|
-
def blog_path(*args)
|
13
|
-
"/blogs"
|
14
|
-
end
|
15
|
-
def output_buffer=(*args)
|
16
|
-
""
|
17
|
-
end
|
18
|
-
def output_buffer(*args)
|
19
|
-
""
|
20
|
-
end
|
6
|
+
module SpecApp
|
7
|
+
class Application < ::Rails::Application
|
21
8
|
end
|
22
|
-
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'rspec/rails'
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_form_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Bookis Smuin
|
@@ -10,30 +15,10 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-12-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
prerelease: false
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
type: :development
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: supermodel
|
28
|
-
prerelease: false
|
29
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: "0"
|
35
|
-
type: :development
|
36
|
-
version_requirements: *id002
|
18
|
+
date: 2011-12-23 00:00:00 -10:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
37
22
|
description: Just use easy_form_for(MyModel) to generate a form for an object
|
38
23
|
email:
|
39
24
|
- vegan.bookis@gmail.com
|
@@ -48,14 +33,16 @@ files:
|
|
48
33
|
- Gemfile
|
49
34
|
- README
|
50
35
|
- Rakefile
|
36
|
+
- app/models/my_model.rb
|
51
37
|
- config/database.yml
|
52
38
|
- easy_form_for.gemspec
|
53
39
|
- lib/easy_form_for.rb
|
54
40
|
- lib/easy_form_for/railtie.rb
|
55
41
|
- lib/easy_form_for/version.rb
|
56
42
|
- lib/easy_form_for/view_helpers.rb
|
57
|
-
- spec/
|
43
|
+
- spec/helpers/form_spec.rb
|
58
44
|
- spec/spec_helper.rb
|
45
|
+
has_rdoc: true
|
59
46
|
homepage: https://github.com/bookis/Easy-Form-For
|
60
47
|
licenses: []
|
61
48
|
|
@@ -69,20 +56,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
56
|
requirements:
|
70
57
|
- - ">="
|
71
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
72
62
|
version: "0"
|
73
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
64
|
none: false
|
75
65
|
requirements:
|
76
|
-
- - "
|
66
|
+
- - ">="
|
77
67
|
- !ruby/object:Gem::Version
|
78
|
-
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
79
72
|
requirements: []
|
80
73
|
|
81
74
|
rubyforge_project: easy_form_for
|
82
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.6.2
|
83
76
|
signing_key:
|
84
77
|
specification_version: 3
|
85
78
|
summary: Easy Rails form generation
|
86
79
|
test_files:
|
87
|
-
- spec/
|
80
|
+
- spec/helpers/form_spec.rb
|
88
81
|
- spec/spec_helper.rb
|
data/spec/easy_form_for_spec.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class Country < SuperModel::Base
|
4
|
-
attributes :name, :abbreviation
|
5
|
-
end
|
6
|
-
class Blog < SuperModel::Base
|
7
|
-
attributes :name, :tagline, :theme, :body, :country_id, :published, :published_at
|
8
|
-
end
|
9
|
-
|
10
|
-
describe EasyFormFor do
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
Country.create(:name => "new zealand", :abbreviation => "NZ")
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "except" do
|
17
|
-
before(:each) do
|
18
|
-
@result = EasyFormFor::ViewHelpers.new.easy_form_for(Blog.new(:name => "test"), :except => :tagline, :sort_by => [:theme]) do |f|
|
19
|
-
f.label :temp_field
|
20
|
-
f.text_field :temp_field
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should have a name" do
|
25
|
-
@result.should include 'id="blog_name"'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|