robinsp-robins_html_helpers 0.2.0 → 0.2.2
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.
- data/Manifest +28 -23
- data/Rakefile +1 -1
- data/lib/robins_html_helpers/form_builder.rb +62 -24
- data/rails_generators/robins_layout/USAGE +0 -0
- data/rails_generators/robins_layout/robins_layout_generator.rb +14 -0
- data/rails_generators/robins_layout/templates/application.html.erb +31 -0
- data/rails_generators/robins_layout/templates/layout.css +54 -0
- data/robins_html_helpers.gemspec +6 -6
- data/spec/models/form_builder_hint_options_spec.rb +32 -0
- data/spec/models/form_builder_spec.rb +28 -45
- metadata +32 -27
data/Manifest
CHANGED
@@ -1,30 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
tasks/rspec.rake
|
2
|
+
lib/robins_html_helpers.rb
|
3
|
+
lib/robins_html_helpers/form_builder.rb
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
spec/helpers/helpers_spec.rb
|
7
|
+
spec/railsenv/app/controllers/application_controller.rb
|
5
8
|
spec/railsenv/config/routes.rb
|
6
|
-
spec/railsenv/config/environments/production.rb
|
7
|
-
spec/railsenv/config/environments/test.rb
|
8
|
-
spec/railsenv/config/environments/development.rb
|
9
|
-
spec/railsenv/config/environment.rb
|
10
|
-
spec/railsenv/config/initializers/new_rails_defaults.rb
|
11
9
|
spec/railsenv/config/initializers/backtrace_silencers.rb
|
12
|
-
spec/railsenv/config/initializers/session_store.rb
|
13
|
-
spec/railsenv/config/initializers/inflections.rb
|
14
10
|
spec/railsenv/config/initializers/mime_types.rb
|
15
|
-
spec/railsenv/config/
|
16
|
-
spec/railsenv/config/
|
11
|
+
spec/railsenv/config/initializers/inflections.rb
|
12
|
+
spec/railsenv/config/initializers/session_store.rb
|
13
|
+
spec/railsenv/config/initializers/new_rails_defaults.rb
|
14
|
+
spec/railsenv/config/environment.rb
|
17
15
|
spec/railsenv/config/locales/en.yml
|
16
|
+
spec/railsenv/config/boot.rb
|
17
|
+
spec/railsenv/config/database.yml
|
18
|
+
spec/railsenv/config/environments/development.rb
|
19
|
+
spec/railsenv/config/environments/test.rb
|
20
|
+
spec/railsenv/config/environments/production.rb
|
18
21
|
spec/railsenv/db/test.sqlite3
|
19
|
-
spec/railsenv/app/controllers/application_controller.rb
|
20
|
-
spec/models/form_builder_spec.rb
|
21
|
-
spec/spec.opts
|
22
22
|
spec/spec_helper.rb
|
23
|
-
spec/
|
24
|
-
|
25
|
-
|
23
|
+
spec/spec.opts
|
24
|
+
spec/models/form_builder_spec.rb
|
25
|
+
spec/models/form_builder_hint_options_spec.rb
|
26
26
|
Manifest
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
robins_html_helpers.gemspec
|
28
|
+
rails_generators/robins_layout/templates/layout.css
|
29
|
+
rails_generators/robins_layout/templates/application.html.erb
|
30
|
+
rails_generators/robins_layout/robins_layout_generator.rb
|
31
|
+
rails_generators/robins_layout/USAGE
|
32
|
+
rails_generators/robins_html_helpers_resources/templates/robins_html_helpers.css
|
33
|
+
rails_generators/robins_html_helpers_resources/templates/robins_html_helpers.js
|
34
|
+
rails_generators/robins_html_helpers_resources/USAGE
|
35
|
+
rails_generators/robins_html_helpers_resources/robins_html_helpers_resources_generator.rb
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'rubygems'
|
|
7
7
|
require 'rake'
|
8
8
|
require 'echoe'
|
9
9
|
|
10
|
-
Echoe.new('robins_html_helpers', '0.2.
|
10
|
+
Echoe.new('robins_html_helpers', '0.2.2') do |p|
|
11
11
|
p.description = "HTML stuff I use frequently."
|
12
12
|
p.url = "http://github.com/robinsp/robins_html_helpers"
|
13
13
|
p.author = "Robin Spainhour"
|
@@ -1,35 +1,56 @@
|
|
1
1
|
module RobinsHtmlHelpers
|
2
|
+
|
3
|
+
# Customized form builder that inserts an HTML label tag before the form
|
4
|
+
# fields and wraps the +label+ and input elements in an enclosing div tag.
|
5
|
+
# The enclosing +div+ has class +custom_form_field+ by default.
|
6
|
+
#
|
7
|
+
#--
|
8
|
+
# <% form_for( @item, :builder => RobinsHtmlHelpers::FormBuilder) do |f| %>
|
9
|
+
# <%= f.text_field :name %>
|
10
|
+
# <%end%>
|
11
|
+
#
|
12
|
+
# <div class="custom_form_field">
|
13
|
+
# <label for="item_name">Name</label>
|
14
|
+
# <input type="text" value="Get filofax pen from anders/mf" size="30" name="item[name]" id="item_name"/>
|
15
|
+
# </div>
|
16
|
+
#
|
17
|
+
#++
|
18
|
+
#
|
19
|
+
# For text_field and text_area a hint options can be passed to set default
|
20
|
+
# text using javascript. (This requires that you have included the javascript
|
21
|
+
# and css files that come with this gem. Refer to the README file for
|
22
|
+
# instructions.)
|
2
23
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
24
|
+
class HintOptions #:nodoc:
|
25
|
+
attr_reader :hint, :hint_class
|
26
|
+
|
27
|
+
def initialize(hint, hint_class)
|
28
|
+
raise "No :hint supplied" if hint_class && hint.blank?
|
29
|
+
@hint = hint
|
30
|
+
@hint_class = hint_class || "hinting"
|
31
|
+
end
|
32
|
+
|
33
|
+
def enabled?
|
34
|
+
!hint.blank?
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_js(dom_element_id)
|
38
|
+
"new RobinsHtmlHelpers.FormFieldHint('#{dom_element_id}', '#{hint}', '#{hint_class}');"
|
39
|
+
end
|
40
|
+
end
|
3
41
|
|
4
42
|
def text_field(method, options = {})
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
raise "No :hint supplied" if hint_class && hint.blank?
|
9
|
-
|
10
|
-
result = wrap_field(method, super(method, options), label_text )
|
11
|
-
result << hint_js_tag(the_dom_id, hint, (hint_class || "hinting")) unless hint.blank?
|
12
|
-
result
|
43
|
+
text_input_field(method, options) do
|
44
|
+
super(method, options)
|
45
|
+
end
|
13
46
|
end
|
14
47
|
|
15
48
|
def text_area(method, options = {})
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
raise "No :hint supplied" if hint_class && hint.blank?
|
21
|
-
|
22
|
-
result = wrap_field(method, super(method, options), label_text )
|
23
|
-
result << hint_js_tag(the_dom_id, hint, (hint_class || "hinting")) unless hint.blank?
|
24
|
-
result
|
49
|
+
text_input_field(method, options) do
|
50
|
+
super(method, options)
|
51
|
+
end
|
25
52
|
end
|
26
|
-
|
27
|
-
def hint_js_tag(element_id, hint, hint_class)
|
28
|
-
raise "Missing arg" if element_id.blank? || hint.blank? || hint_class.blank?
|
29
|
-
script = "new RobinsHtmlHelpers.FormFieldHint('#{element_id}', '#{hint}', '#{hint_class}');"
|
30
|
-
@template.javascript_tag(script)
|
31
|
-
end
|
32
|
-
|
53
|
+
|
33
54
|
def password_field(method, options = {})
|
34
55
|
label_text = options.delete(:label)
|
35
56
|
wrap_field(method, super(method, options), label_text )
|
@@ -54,6 +75,23 @@ module RobinsHtmlHelpers
|
|
54
75
|
def wrap_field(method, form_field, label_text)
|
55
76
|
"<div class=\"custom_form_field\">#{label(method, label_text )} #{ form_field }</div>"
|
56
77
|
end
|
78
|
+
|
79
|
+
def get_dom_id_from(options, method)
|
80
|
+
return options[:id] || object_name + "_" + method.to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
def text_input_field(method, options = {})
|
84
|
+
label_text = options.delete(:label)
|
85
|
+
hint_options = HintOptions.new(options.delete(:hint), options.delete(:hint_class))
|
86
|
+
|
87
|
+
result = wrap_field(method, yield, label_text )
|
88
|
+
|
89
|
+
if hint_options.enabled?
|
90
|
+
result << @template.javascript_tag( hint_options.to_js( get_dom_id_from(options, method) ) )
|
91
|
+
end
|
92
|
+
|
93
|
+
result
|
94
|
+
end
|
57
95
|
end
|
58
96
|
|
59
97
|
end
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RobinsLayoutGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
puts "Installing"
|
4
|
+
record do |m|
|
5
|
+
m.file 'application.html.erb',
|
6
|
+
'app/views/layouts/application.html.erb',
|
7
|
+
:collision => :ask
|
8
|
+
|
9
|
+
m.file 'layout.css',
|
10
|
+
'public/stylesheets/layout.css',
|
11
|
+
:collision => :ask
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<%= stylesheet_link_tag :all %>
|
8
|
+
<%= javascript_include_tag :defaults %>
|
9
|
+
<%= yield :head %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
|
13
|
+
|
14
|
+
<div id="wrap">
|
15
|
+
<div id="header">
|
16
|
+
<p>Header</p>
|
17
|
+
</div>
|
18
|
+
<div id="main" class="clearfix">
|
19
|
+
<%= yield %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div id="footer">
|
25
|
+
<p>Footer</p>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
* {margin:0;padding:0;}
|
2
|
+
|
3
|
+
/* must declare 0 margins on everything, also for main layout components use padding, not
|
4
|
+
vertical margins (top and bottom) to add spacing, else those margins get added to total height
|
5
|
+
and your footer gets pushed down a bit more, creating vertical scroll bars in the browser */
|
6
|
+
html, body, #wrap {
|
7
|
+
height: 100%;
|
8
|
+
}
|
9
|
+
|
10
|
+
body {
|
11
|
+
font-size: 62.5%;
|
12
|
+
font-family: Tahoma,sans-serif;
|
13
|
+
color: #575757;
|
14
|
+
background: #606060;
|
15
|
+
}
|
16
|
+
|
17
|
+
body > #wrap {
|
18
|
+
height: auto;
|
19
|
+
min-height: 100%;
|
20
|
+
background-color: #ffffff;
|
21
|
+
width: 80%;
|
22
|
+
margin: 0 auto;
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
#main {
|
27
|
+
padding-bottom: 5em; /* must be same height as the footer */
|
28
|
+
}
|
29
|
+
|
30
|
+
#header {
|
31
|
+
height: 5em;
|
32
|
+
text-align: center;
|
33
|
+
}
|
34
|
+
|
35
|
+
#footer {
|
36
|
+
position: relative;
|
37
|
+
margin-top: -5em; /* negative value of footer height */
|
38
|
+
height: 5em;
|
39
|
+
clear:both;
|
40
|
+
text-align: center;
|
41
|
+
}
|
42
|
+
|
43
|
+
/* CLEAR FIX*/
|
44
|
+
.clearfix:after {content: ".";
|
45
|
+
display: block;
|
46
|
+
height: 0;
|
47
|
+
clear: both;
|
48
|
+
visibility: hidden;}
|
49
|
+
.clearfix {display: inline-block;}
|
50
|
+
|
51
|
+
/* Hides from IE-mac \*/
|
52
|
+
* html .clearfix { height: 1%;}
|
53
|
+
.clearfix {display: block;}
|
54
|
+
/* End hide from IE-mac */
|
data/robins_html_helpers.gemspec
CHANGED
@@ -2,26 +2,26 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{robins_html_helpers}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Robin Spainhour"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-06-11}
|
10
10
|
s.description = %q{HTML stuff I use frequently.}
|
11
11
|
s.email = %q{robin@robinspainhour.com}
|
12
|
-
s.extra_rdoc_files = ["tasks/rspec.rake", "lib/robins_html_helpers
|
13
|
-
s.files = ["
|
12
|
+
s.extra_rdoc_files = ["tasks/rspec.rake", "lib/robins_html_helpers.rb", "lib/robins_html_helpers/form_builder.rb", "README.rdoc"]
|
13
|
+
s.files = ["tasks/rspec.rake", "lib/robins_html_helpers.rb", "lib/robins_html_helpers/form_builder.rb", "README.rdoc", "Rakefile", "spec/helpers/helpers_spec.rb", "spec/railsenv/app/controllers/application_controller.rb", "spec/railsenv/config/routes.rb", "spec/railsenv/config/initializers/backtrace_silencers.rb", "spec/railsenv/config/initializers/mime_types.rb", "spec/railsenv/config/initializers/inflections.rb", "spec/railsenv/config/initializers/session_store.rb", "spec/railsenv/config/initializers/new_rails_defaults.rb", "spec/railsenv/config/environment.rb", "spec/railsenv/config/locales/en.yml", "spec/railsenv/config/boot.rb", "spec/railsenv/config/database.yml", "spec/railsenv/config/environments/development.rb", "spec/railsenv/config/environments/test.rb", "spec/railsenv/config/environments/production.rb", "spec/railsenv/db/test.sqlite3", "spec/spec_helper.rb", "spec/spec.opts", "spec/models/form_builder_spec.rb", "spec/models/form_builder_hint_options_spec.rb", "Manifest", "robins_html_helpers.gemspec", "rails_generators/robins_layout/templates/layout.css", "rails_generators/robins_layout/templates/application.html.erb", "rails_generators/robins_layout/robins_layout_generator.rb", "rails_generators/robins_layout/USAGE", "rails_generators/robins_html_helpers_resources/templates/robins_html_helpers.css", "rails_generators/robins_html_helpers_resources/templates/robins_html_helpers.js", "rails_generators/robins_html_helpers_resources/USAGE", "rails_generators/robins_html_helpers_resources/robins_html_helpers_resources_generator.rb"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://github.com/robinsp/robins_html_helpers}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Robins_html_helpers", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{robins_html_helpers}
|
19
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
20
|
s.summary = %q{HTML stuff I use frequently.}
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version =
|
24
|
+
s.specification_version = 2
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
27
|
else
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) ) + "/../spec_helper"
|
2
|
+
|
3
|
+
describe RobinsHtmlHelpers::FormBuilder::HintOptions do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@class = RobinsHtmlHelpers::FormBuilder::HintOptions
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should not allow :hint_class option without a :hint option" do
|
10
|
+
lambda { @class.new("", "CSS_class") }.should raise_error("No :hint supplied")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be enabled if hint is present" do
|
14
|
+
@class.new("hint", "class").enabled?.should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should not be enabled if hint is blank" do
|
18
|
+
@class.new("", nil).enabled?.should be_false
|
19
|
+
@class.new(nil, nil).enabled?.should be_false
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should default :hint_class to 'hinting' " do
|
23
|
+
@class.new("hint", nil).hint_class.should == "hinting"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create Javascript from attributes given a dom_id" do
|
27
|
+
element_id, hint, hint_class = "element_id", "hint", "hint_class"
|
28
|
+
expected_script = "new RobinsHtmlHelpers.FormFieldHint('#{element_id}', '#{hint}', '#{hint_class}');"
|
29
|
+
|
30
|
+
@class.new(hint, hint_class).to_js(element_id).should == expected_script
|
31
|
+
end
|
32
|
+
end
|
@@ -21,7 +21,6 @@ describe RobinsHtmlHelpers::FormBuilder do
|
|
21
21
|
|
22
22
|
@expected_opts = {:object => @mock_the_object, :opt => "val" }
|
23
23
|
@opts_with_label = {:opt => "val", :label => "thelabel" }
|
24
|
-
|
25
24
|
end
|
26
25
|
|
27
26
|
[:text_field, :text_area, :password_field, :date_select, :check_box].each do |method|
|
@@ -44,51 +43,54 @@ describe RobinsHtmlHelpers::FormBuilder do
|
|
44
43
|
|
45
44
|
[:text_field, :text_area].each do |method|
|
46
45
|
describe "#{method.to_s}()" do
|
46
|
+
before do
|
47
|
+
@mock_template.stubs(method)
|
48
|
+
@hint_options_class = RobinsHtmlHelpers::FormBuilder::HintOptions
|
49
|
+
@hint_options_stub = @hint_options_class.new("Hint", "HintClass")
|
50
|
+
@hint_options_stub.stubs(:enabled?).returns(false)
|
51
|
+
@hint_options_class.stubs(:new).returns(@hint_options_stub)
|
52
|
+
end
|
53
|
+
|
47
54
|
it "should remove :label param before delegating to super class" do
|
48
55
|
@mock_template.expects(method).with(@mock_object_name, @expected_attrib, @expected_opts)
|
49
56
|
@builder.send method, @expected_attrib, @opts_with_label
|
50
57
|
end
|
51
58
|
|
59
|
+
it "should remove :hint and :hint_class options before delegating to super class" do
|
60
|
+
@mock_template.expects(method).with(@mock_object_name, @expected_attrib, @expected_opts)
|
61
|
+
@builder.send method, @expected_attrib, {:opt => "val", :hint => "A hint", :hint_class => "CSS_class"}
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should create HintOptions object" do
|
65
|
+
@hint_options_class.expects(:new).with("A hint", "CSS_class").returns(@hint_options_stub)
|
66
|
+
@builder.send method, @expected_attrib, {:opt => "val", :hint => "A hint", :hint_class => "CSS_class"}
|
67
|
+
end
|
52
68
|
|
53
|
-
describe "with
|
69
|
+
describe "with valid hint options" do
|
54
70
|
before do
|
55
|
-
@mock_template.stubs(method)
|
56
71
|
@builder.stubs(:wrap_field).returns("field-result")
|
72
|
+
@hint_options_stub.stubs(:enabled?).returns(true)
|
57
73
|
end
|
58
74
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should not allow :hint_class option without a :hint option" do
|
65
|
-
lambda { @builder.send(method, @expected_attrib, {:hint_class => "CSS_class"}) }.should raise_error("No :hint supplied")
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should append hint JS" do
|
69
|
-
@builder.expects(:hint_js_tag).returns("hint-result")
|
70
|
-
@builder.send(method, @expected_attrib, {:hint => "A hint"}).should == "field-result" + "hint-result"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should default :hint_class to 'hinting' " do
|
74
|
-
@builder.expects(:hint_js_tag).with("dom_id", "A hint", "hinting").returns("hint-result")
|
75
|
-
@builder.send(method, @expected_attrib, {:id => "dom_id", :hint => "A hint"})
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "with DOM id given by the developer" do
|
79
|
-
it "should create the hint JS by supplying an DOM element id, hint and hint_class" do
|
80
|
-
@builder.expects(:hint_js_tag).with("element_id", "A hint", "hint_class").returns("hint-result")
|
75
|
+
describe "and DOM id given by the developer" do
|
76
|
+
it "should create Javascript by supplying an DOM element id" do
|
77
|
+
@hint_options_stub.expects(:to_js).with("element_id")
|
81
78
|
@builder.send method, @expected_attrib, {:id => "element_id", :hint => "A hint", :hint_class => "hint_class"}
|
82
79
|
end
|
83
80
|
end
|
84
81
|
|
85
82
|
describe "When the DOM id is set by default" do
|
86
83
|
it "should create the hint JS by supplying an DOM element id, hint and hint_class" do
|
87
|
-
@
|
84
|
+
@hint_options_stub.expects(:to_js).with("#{@mock_object_name}_#{@expected_attrib.to_s}")
|
88
85
|
@builder.send method, @expected_attrib, {:hint => "A hint", :hint_class => "hint_class"}
|
89
86
|
end
|
90
87
|
end
|
91
88
|
|
89
|
+
it "should wrap the result of to_js() using javascript_tag helper and append it" do
|
90
|
+
@hint_options_stub.expects(:to_js).returns("pure-js")
|
91
|
+
@mock_template.expects(:javascript_tag).with("pure-js").returns("hint-result")
|
92
|
+
@builder.send(method, @expected_attrib).should == "field-result" + "hint-result"
|
93
|
+
end
|
92
94
|
end
|
93
95
|
end
|
94
96
|
end
|
@@ -120,23 +122,4 @@ describe RobinsHtmlHelpers::FormBuilder do
|
|
120
122
|
@builder.check_box( @expected_attrib, @opts_with_label )
|
121
123
|
end
|
122
124
|
end
|
123
|
-
|
124
|
-
describe "hint_js_tag()" do
|
125
|
-
it "should call javascript_tag" do
|
126
|
-
element_id, hint, hint_class = "element_id", "hint", "hint_class"
|
127
|
-
js_script = "new RobinsHtmlHelpers.FormFieldHint('#{element_id}', '#{hint}', '#{hint_class}');"
|
128
|
-
@mock_template.expects(:javascript_tag).with(js_script)
|
129
|
-
@builder.hint_js_tag(element_id, hint, hint_class)
|
130
|
-
end
|
131
|
-
|
132
|
-
it "should fail is any argument is blank" do
|
133
|
-
element_id, hint, hint_class = "element_id", "hint", "hint_class"
|
134
|
-
|
135
|
-
lambda {@builder.hint_js_tag("", hint, hint_class)}.should raise_error("Missing arg")
|
136
|
-
lambda {@builder.hint_js_tag(element_id, "", hint_class)}.should raise_error("Missing arg")
|
137
|
-
lambda {@builder.hint_js_tag(element_id, hint, "")}.should raise_error("Missing arg")
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
141
|
-
|
142
125
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robinsp-robins_html_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Spainhour
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -21,40 +21,45 @@ extensions: []
|
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- tasks/rspec.rake
|
24
|
-
- lib/robins_html_helpers/form_builder.rb
|
25
24
|
- lib/robins_html_helpers.rb
|
25
|
+
- lib/robins_html_helpers/form_builder.rb
|
26
26
|
- README.rdoc
|
27
27
|
files:
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
28
|
+
- tasks/rspec.rake
|
29
|
+
- lib/robins_html_helpers.rb
|
30
|
+
- lib/robins_html_helpers/form_builder.rb
|
31
|
+
- README.rdoc
|
32
|
+
- Rakefile
|
33
|
+
- spec/helpers/helpers_spec.rb
|
34
|
+
- spec/railsenv/app/controllers/application_controller.rb
|
32
35
|
- spec/railsenv/config/routes.rb
|
33
|
-
- spec/railsenv/config/environments/production.rb
|
34
|
-
- spec/railsenv/config/environments/test.rb
|
35
|
-
- spec/railsenv/config/environments/development.rb
|
36
|
-
- spec/railsenv/config/environment.rb
|
37
|
-
- spec/railsenv/config/initializers/new_rails_defaults.rb
|
38
36
|
- spec/railsenv/config/initializers/backtrace_silencers.rb
|
39
|
-
- spec/railsenv/config/initializers/session_store.rb
|
40
|
-
- spec/railsenv/config/initializers/inflections.rb
|
41
37
|
- spec/railsenv/config/initializers/mime_types.rb
|
42
|
-
- spec/railsenv/config/
|
43
|
-
- spec/railsenv/config/
|
38
|
+
- spec/railsenv/config/initializers/inflections.rb
|
39
|
+
- spec/railsenv/config/initializers/session_store.rb
|
40
|
+
- spec/railsenv/config/initializers/new_rails_defaults.rb
|
41
|
+
- spec/railsenv/config/environment.rb
|
44
42
|
- spec/railsenv/config/locales/en.yml
|
43
|
+
- spec/railsenv/config/boot.rb
|
44
|
+
- spec/railsenv/config/database.yml
|
45
|
+
- spec/railsenv/config/environments/development.rb
|
46
|
+
- spec/railsenv/config/environments/test.rb
|
47
|
+
- spec/railsenv/config/environments/production.rb
|
45
48
|
- spec/railsenv/db/test.sqlite3
|
46
|
-
- spec/railsenv/app/controllers/application_controller.rb
|
47
|
-
- spec/models/form_builder_spec.rb
|
48
|
-
- spec/spec.opts
|
49
49
|
- spec/spec_helper.rb
|
50
|
-
- spec/
|
51
|
-
-
|
52
|
-
-
|
50
|
+
- spec/spec.opts
|
51
|
+
- spec/models/form_builder_spec.rb
|
52
|
+
- spec/models/form_builder_hint_options_spec.rb
|
53
53
|
- Manifest
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
54
|
+
- robins_html_helpers.gemspec
|
55
|
+
- rails_generators/robins_layout/templates/layout.css
|
56
|
+
- rails_generators/robins_layout/templates/application.html.erb
|
57
|
+
- rails_generators/robins_layout/robins_layout_generator.rb
|
58
|
+
- rails_generators/robins_layout/USAGE
|
59
|
+
- rails_generators/robins_html_helpers_resources/templates/robins_html_helpers.css
|
60
|
+
- rails_generators/robins_html_helpers_resources/templates/robins_html_helpers.js
|
61
|
+
- rails_generators/robins_html_helpers_resources/USAGE
|
62
|
+
- rails_generators/robins_html_helpers_resources/robins_html_helpers_resources_generator.rb
|
58
63
|
has_rdoc: true
|
59
64
|
homepage: http://github.com/robinsp/robins_html_helpers
|
60
65
|
post_install_message:
|
@@ -84,7 +89,7 @@ requirements: []
|
|
84
89
|
rubyforge_project: robins_html_helpers
|
85
90
|
rubygems_version: 1.2.0
|
86
91
|
signing_key:
|
87
|
-
specification_version:
|
92
|
+
specification_version: 2
|
88
93
|
summary: HTML stuff I use frequently.
|
89
94
|
test_files: []
|
90
95
|
|