funky_tabs 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/funky_tabs.gemspec +2 -2
- data/lib/funky_tabs/renderers.rb +4 -4
- data/lib/funky_tabs/tab.rb +1 -0
- data/lib/funky_tabs.rb +13 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('funky_tabs', '0.1.
|
5
|
+
Echoe.new('funky_tabs', '0.1.6') do |p|
|
6
6
|
p.description = "Create Ajaxified tabs with simple history through window location hashes for Rails."
|
7
7
|
p.url = "http://github.com/thomaspouncy/funky_tabs"
|
8
8
|
p.author = "Thomas Pouncy"
|
data/funky_tabs.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{funky_tabs}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Thomas Pouncy"]
|
9
|
-
s.date = %q{2011-
|
9
|
+
s.date = %q{2011-07-13}
|
10
10
|
s.description = %q{Create Ajaxified tabs with simple history through window location hashes for Rails.}
|
11
11
|
s.email = %q{thomas.pouncy@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/funky_tabs.rb", "lib/funky_tabs/helpers.rb", "lib/funky_tabs/rails.rb", "lib/funky_tabs/renderers.rb", "lib/funky_tabs/tab.rb", "lib/funky_tabs/tab_action.rb"]
|
data/lib/funky_tabs/renderers.rb
CHANGED
@@ -7,13 +7,13 @@ module FunkyTabs
|
|
7
7
|
|
8
8
|
module InstanceMethods
|
9
9
|
def render(*args, &block)
|
10
|
-
super(*args, &block)
|
10
|
+
return super(*args, &block) if params[:funky_tabs].nil?
|
11
11
|
@location_hash = params[:location_hash]
|
12
|
-
super(*args, &block)
|
12
|
+
return super(*args, &block) if @location_hash.nil?
|
13
13
|
@tab_index = FunkyTabs.tab_index_from_location_hash(@location_hash)
|
14
|
-
super(*args, &block)
|
14
|
+
return super(*args, &block) if @tab_index.nil?
|
15
15
|
@render_content = render_to_string(*args, &block)
|
16
|
-
super(:template=>"funky_tabs/update/update_tab",:layout=>false)
|
16
|
+
return super(:template=>"funky_tabs/update/update_tab",:layout=>false)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/funky_tabs/tab.rb
CHANGED
data/lib/funky_tabs.rb
CHANGED
@@ -123,6 +123,17 @@ module FunkyTabs
|
|
123
123
|
return location_hash_for_tab_action(tab,tab_action)
|
124
124
|
end
|
125
125
|
|
126
|
+
def self.controller_for_tab(tab)
|
127
|
+
return default_tabs_controller if tab.nil?
|
128
|
+
unless tab.is_a?(FunkyTabs::Tab)
|
129
|
+
tab_index = find_tab(tab)
|
130
|
+
return default_tabs_controller if tab_index.nil?
|
131
|
+
tab = tabs[tab_index]
|
132
|
+
end
|
133
|
+
return tab.controller_name unless tab.controller_name.blank?
|
134
|
+
return default_tabs_controller
|
135
|
+
end
|
136
|
+
|
126
137
|
def self.content_path_for_tab_and_tab_action(tab,tab_action=nil,tab_action_id=nil)
|
127
138
|
unless tab.is_a?(FunkyTabs::Tab)
|
128
139
|
tab_index = find_tab(tab)
|
@@ -140,9 +151,9 @@ module FunkyTabs
|
|
140
151
|
return tab_action.content_path+"?id=#{tab_action_id}"
|
141
152
|
end
|
142
153
|
if tab_action.name.downcase == "index"
|
143
|
-
content_path = "/#{
|
154
|
+
content_path = "/#{controller_for_tab(tab)}/#{tab.name.gsub(/\s/,"_").downcase}_index"
|
144
155
|
else
|
145
|
-
content_path = "/#{
|
156
|
+
content_path = "/#{controller_for_tab(tab)}/#{tab_action.name.gsub(/\s/,"_").downcase}_#{tab.name.gsub(/\s/,"_").downcase}"
|
146
157
|
end
|
147
158
|
return content_path if tab_action_id.nil?
|
148
159
|
return "#{content_path}/#{tab_action_id}"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: funky_tabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Pouncy
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-13 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|