Skip to content

Commit 1e35dd8

Browse files
committed
replacing spaces with tabs, uninstalling local textmate bundle for the win!
1 parent 3fdaa3d commit 1e35dd8

12 files changed

+146
-145
lines changed

CHANGELOG

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
== 01-24-2011
2+
3+
* rewrote for rails 3 && (ruby 1.8 || ruby 1.9), added tests
4+
15
== 03-07-2009
26

3-
* big change: removed the 2nd param for concat, rails no longer requires the binding be passed.
4-
* added a helper for creating accordions
7+
* big change: removed the 2nd param for concat, rails no longer requires the binding be passed.
8+
* added a helper for creating accordions
59

610
== 09-04-2008
711

8-
* big change: renamed classes, and helper 'tabs_for' now requires a block
12+
* big change: renamed classes, and helper 'tabs_for' now requires a block
913

10-
== 08-28-2008
11-
12-
* added the ability to call TabsRenderer.new with a block parameter
14+
== 08-28-2008
15+
16+
* added the ability to call TabsRenderer.new with a block parameter
1317

1418
== 06-22-2008 initial import
15-
16-
* TabsRenderer added
19+
20+
* TabsRenderer added

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
source "http://rubygems.org"
22

3-
# Specify your gem's dependencies in ui_helpers.gemspec
43
gemspec

README.textile

+14-14
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ This helper simplifies the code required to use the jQuery UI Tab plugin.
1111
<pre><code>
1212
<% tabs_for do |tab| %>
1313
<% tab.create('tab_one', 'Tab 1') do %>
14-
# ... insert tab contents
14+
# ... insert tab contents
1515
<% end %>
1616
<% tab.create('tab_two', 'Tab 2') do %>
17-
# ... insert tab contents
17+
# ... insert tab contents
1818
<% end %>
1919
<% end %>
2020
</code></pre>
@@ -23,19 +23,19 @@ The above will generate this HTML in your view:
2323

2424
<pre><code>
2525
<div id="tabs">
26-
<ul>
27-
<li><a href="#tab_one"><span>Tab 1</span></a></li>
28-
<li><a href="#tab_two"><span>Tab 2</span></a></li>
29-
</ul>
30-
<div id="tab_one">
31-
# ... insert tab contents
32-
</div>
33-
<div id="tab_two">
34-
# ... insert tab contents
35-
</div>
26+
<ul>
27+
<li><a href="#tab_one"><span>Tab 1</span></a></li>
28+
<li><a href="#tab_two"><span>Tab 2</span></a></li>
29+
</ul>
30+
<div id="tab_one">
31+
# ... insert tab contents
32+
</div>
33+
<div id="tab_two">
34+
# ... insert tab contents
35+
</div>
3636
</div>
3737
</code></pre>
38-
38+
3939
Tabs will be rendered in the order you create them.
4040

4141
You can easily render a tab conditionally by appending your condition to the end of
@@ -53,7 +53,7 @@ DIV as you like ...
5353
<pre><code>
5454
<% tabs_for(:class => 'zippy') do |tab| %>
5555
<% tab.create('tab_one', 'Tab 1', :style => 'background: #FFF') do %>
56-
# ... insert tab contents
56+
# ... insert tab contents
5757
<% end %>
5858
<% end %>
5959
</code></pre>

Rakefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ task :default => :test
88

99
desc 'Test the simple_form plugin.'
1010
Rake::TestTask.new(:test) do |t|
11-
t.libs << 'lib'
12-
t.libs << 'test'
13-
t.pattern = 'test/**/*_test.rb'
14-
t.verbose = true
11+
t.libs << 'lib'
12+
t.libs << 'test'
13+
t.pattern = 'test/**/*_test.rb'
14+
t.verbose = true
1515
end

jquery_ui_rails_helpers.gemspec

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
# -*- encoding: utf-8 -*-
2+
23
$:.push File.expand_path("../lib", __FILE__)
34
require "jquery_ui_rails_helpers/version"
45

56
Gem::Specification.new do |s|
6-
s.name = "jquery_ui_rails_helpers"
7-
s.version = JqueryUiRailsHelpers::VERSION
8-
s.platform = Gem::Platform::RUBY
9-
s.summary = "jQuery UI Rails Helpers"
10-
s.authors = ["CodeOfficer"]
11-
s.email = ["[email protected]"]
12-
s.homepage = "http://www.codeofficer.com/"
13-
s.description = "jQuery UI Rails Helpers"
7+
s.name = "jquery_ui_rails_helpers"
8+
s.version = JqueryUiRailsHelpers::VERSION
9+
s.platform = Gem::Platform::RUBY
10+
s.summary = "jQuery UI Rails Helpers"
11+
s.authors = ["CodeOfficer"]
12+
s.email = ["[email protected]"]
13+
s.homepage = "http://www.codeofficer.com/"
14+
s.description = "jQuery UI Rails Helpers"
1415

1516
s.add_dependency("rails", "~> 3.0.0")
1617
s.add_dependency("shoulda", "~> 3.0.0.beta2")
1718

18-
s.files = `git ls-files`.split("\n")
19-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21-
s.require_paths = ["lib"]
19+
s.files = `git ls-files`.split("\n")
20+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22+
s.require_paths = ["lib"]
2223

23-
s.rubyforge_project = "jquery_ui_rails_helpers"
24+
s.rubyforge_project = "jquery_ui_rails_helpers"
2425
end
25-
26-
27-

lib/helpers/accordions_helper.rb

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
module AccordionsHelper
2-
def accordions_for( *options, &block )
3-
raise ArgumentError, "Missing block" unless block_given?
4-
raw AccordionsHelper::AccordionsRenderer.new( *options, &block ).render
5-
end
2+
def accordions_for( *options, &block )
3+
raise ArgumentError, "Missing block" unless block_given?
4+
raw AccordionsHelper::AccordionsRenderer.new( *options, &block ).render
5+
end
66

7-
class AccordionsRenderer
7+
class AccordionsRenderer
88

9-
def initialize( options={}, &block )
10-
raise ArgumentError, "Missing block" unless block_given?
9+
def initialize( options={}, &block )
10+
raise ArgumentError, "Missing block" unless block_given?
1111

12-
@template = eval( 'self', block.binding )
13-
@options = options
14-
@accordions = []
12+
@template = eval( 'self', block.binding )
13+
@options = options
14+
@accordions = []
1515

16-
yield self
17-
end
16+
yield self
17+
end
1818

19-
def create( accordion_id, accordion_text, options={}, &block )
20-
raise "Block needed for AccordionsRenderer#CREATE" unless block_given?
21-
@accordions << [ accordion_id, accordion_text, options, block ]
22-
end
19+
def create( accordion_id, accordion_text, options={}, &block )
20+
raise "Block needed for AccordionsRenderer#CREATE" unless block_given?
21+
@accordions << [ accordion_id, accordion_text, options, block ]
22+
end
2323

24-
def render
24+
def render
2525
content = @accordions.collect do |accordion|
2626
accordion_head(accordion) << accordion_body(accordion)
2727
end.join
28-
content_tag( :div, raw(content), { :id => :accordions }.merge( @options ) )
29-
end
28+
content_tag( :div, raw(content), { :id => :accordions }.merge( @options ) )
29+
end
3030

31-
private # ---------------------------------------------------------------------------
31+
private # ---------------------------------------------------------------------------
3232

33-
def accordion_head(accordion)
34-
content_tag :h3, link_to(accordion[1], '#'), :id => accordion[0]
35-
end
33+
def accordion_head(accordion)
34+
content_tag :h3, link_to(accordion[1], '#'), :id => accordion[0]
35+
end
3636

37-
def accordion_body(accordion)
38-
content_tag :div, capture( &accordion[3] )
39-
end
37+
def accordion_body(accordion)
38+
content_tag :div, capture( &accordion[3] )
39+
end
4040

41-
def method_missing( *args, &block )
42-
@template.send( *args, &block )
43-
end
41+
def method_missing( *args, &block )
42+
@template.send( *args, &block )
43+
end
4444

45-
end
45+
end
4646
end
4747

lib/helpers/javascripts_helper.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module JavascriptsHelper
22

3-
def stylesheet(*args)
4-
content_for(:head) { stylesheet_link_tag(*args) }
5-
end
3+
def stylesheet(*args)
4+
content_for(:head) { stylesheet_link_tag(*args) }
5+
end
66

7-
def javascript(*args)
8-
content_for(:head) { javascript_include_tag(*args) }
9-
end
7+
def javascript(*args)
8+
content_for(:head) { javascript_include_tag(*args) }
9+
end
1010

1111
def field_id_for_js(f, attribute)
1212
"#{f.object_name}[#{attribute.to_s.sub(/\?$/,"")}]".gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "")

lib/helpers/tabs_helper.rb

+41-41
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,64 @@
22
# module JqueryUiRailsHelpers
33

44
module TabsHelper
5-
def tabs_for( *options, &block )
6-
raise ArgumentError, "Missing block" unless block_given?
7-
raw TabsHelper::TabsRenderer.new( *options, &block ).render
8-
end
5+
def tabs_for( *options, &block )
6+
raise ArgumentError, "Missing block" unless block_given?
7+
raw TabsHelper::TabsRenderer.new( *options, &block ).render
8+
end
99

10-
class TabsRenderer
10+
class TabsRenderer
1111

12-
def initialize( options={}, &block )
13-
raise ArgumentError, "Missing block" unless block_given?
12+
def initialize( options={}, &block )
13+
raise ArgumentError, "Missing block" unless block_given?
1414

15-
@template = eval( 'self', block.binding )
16-
@options = options
17-
@tabs = []
15+
@template = eval( 'self', block.binding )
16+
@options = options
17+
@tabs = []
1818

19-
yield self
20-
end
19+
yield self
20+
end
2121

22-
def create( tab_id, tab_text, options={}, &block )
23-
raise "Block needed for TabsRenderer#CREATE" unless block_given?
24-
@tabs << [ tab_id, tab_text, options, block, {:ajax => false} ]
25-
end
22+
def create( tab_id, tab_text, options={}, &block )
23+
raise "Block needed for TabsRenderer#CREATE" unless block_given?
24+
@tabs << [ tab_id, tab_text, options, block, {:ajax => false} ]
25+
end
2626

27-
def create_ajax( link, tab_text, options={})
28-
@tabs << [ link, tab_text, options, nil, {:ajax => true} ]
29-
end
27+
def create_ajax( link, tab_text, options={})
28+
@tabs << [ link, tab_text, options, nil, {:ajax => true} ]
29+
end
3030

31-
def render
32-
content_tag( :div, raw([render_tabs, render_bodies].join), { :id => :tabs }.merge( @options ) )
33-
end
31+
def render
32+
content_tag( :div, raw([render_tabs, render_bodies].join), { :id => :tabs }.merge( @options ) )
33+
end
3434

35-
private # ---------------------------------------------------------------------------
35+
private # ---------------------------------------------------------------------------
3636

37-
def render_tabs
38-
content_tag :ul do
39-
result = @tabs.collect do |tab|
37+
def render_tabs
38+
content_tag :ul do
39+
result = @tabs.collect do |tab|
4040
if tab[4][:ajax]
41-
content_tag( :li, link_to( content_tag( :span, raw(tab[1]) ), "#{tab[0]}" ) )
41+
content_tag( :li, link_to( content_tag( :span, raw(tab[1]) ), "#{tab[0]}" ) )
4242
else
43-
content_tag( :li, link_to( content_tag( :span, raw(tab[1]) ), "##{tab[0]}" ) )
43+
content_tag( :li, link_to( content_tag( :span, raw(tab[1]) ), "##{tab[0]}" ) )
4444
end
45-
end.join
45+
end.join
4646
raw(result)
47-
end
48-
end
47+
end
48+
end
4949

50-
def render_bodies
51-
@tabs.collect do |tab|
50+
def render_bodies
51+
@tabs.collect do |tab|
5252
if tab[4][:ajax]
53-
# there are no divs for ajaxed tabs
53+
# there are no divs for ajaxed tabs
5454
else
55-
content_tag( :div, capture( &tab[3] ), tab[2].merge( :id => tab[0] ) )
55+
content_tag( :div, capture( &tab[3] ), tab[2].merge( :id => tab[0] ) )
5656
end
57-
end.join.to_s
58-
end
57+
end.join.to_s
58+
end
5959

60-
def method_missing( *args, &block )
61-
@template.send( *args, &block )
62-
end
60+
def method_missing( *args, &block )
61+
@template.send( *args, &block )
62+
end
6363

64-
end
64+
end
6565
end
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module JqueryUiRailsHelpers
2-
VERSION = "0.0.2"
2+
VERSION = "0.0.2"
33
end

test/test_helper.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class ActionView::TestCase
2222
setup :shhhhhh_url_helpers
2323

2424
def shhhhhh_url_helpers
25-
def @controller._routes
26-
Module.new do
27-
def self.url_helpers
28-
Module.new
29-
end
30-
end
31-
end
25+
def @controller._routes
26+
Module.new do
27+
def self.url_helpers
28+
Module.new
29+
end
30+
end
31+
end
3232
end
3333

3434
end

0 commit comments

Comments
 (0)