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 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') do |p|
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"
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-05-25}
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"]
@@ -7,13 +7,13 @@ module FunkyTabs
7
7
 
8
8
  module InstanceMethods
9
9
  def render(*args, &block)
10
- super(*args, &block) and return if params[:funky_tabs].nil?
10
+ return super(*args, &block) if params[:funky_tabs].nil?
11
11
  @location_hash = params[:location_hash]
12
- super(*args, &block) and return if @location_hash.nil?
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) and return if @tab_index.nil?
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
@@ -7,6 +7,7 @@ module FunkyTabs
7
7
  attr_accessor :title
8
8
  attr_accessor :default_tab_action
9
9
  attr_accessor :tab_actions
10
+ attr_accessor :controller_name
10
11
 
11
12
  #default values for attrs
12
13
  def title
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 = "/#{default_tabs_controller}/#{tab.name.gsub(/\s/,"_").downcase}_index"
154
+ content_path = "/#{controller_for_tab(tab)}/#{tab.name.gsub(/\s/,"_").downcase}_index"
144
155
  else
145
- content_path = "/#{default_tabs_controller}/#{tab_action.name.gsub(/\s/,"_").downcase}_#{tab.name.gsub(/\s/,"_").downcase}"
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
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-05-25 00:00:00 -07:00
13
+ date: 2011-07-13 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16