funky_tabs 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -80,7 +80,22 @@ Funky Tabs adds a few helper methods to all your controllers and views automatic
80
80
  <div onclick="<%= js_to_funky_tab(:products,:edit,"'+current_product+'") %>">Edit this Product</div>
81
81
  - The tab_action and tab_action_id parameters are optional. If you call this method without a tab_action, it will call the default tab action.
82
82
 
83
- * location_hash_for_funky_tab(tab,tab_action,tab_action_id) - if, for whatever reason, you just need to know what the unique location hash would be for a particular tab, tab action and object id, this method will tell you.
83
+ * location_hash_for_funky_tab(tab,tab_action,tab_action_id) - This method is useful for directing a tab action to another tab action in a controller. For example, let's say you want to list all a users products if they have any, but direct them to the "add" tab action if they don't have any products yet. You can do this with the following code:
84
+ def list_products
85
+ if current_user.products.blank?
86
+ params[:location_hash] = location_hash_for_funky_tab(:products,:add)
87
+ add_products
88
+ return
89
+ end
90
+
91
+ render "list_products"
92
+ end
93
+
94
+ def add_products
95
+ render "add_products"
96
+ end
97
+
98
+ Now if a user tries to go to the "list" tab action, the controller will render the "add" tab action instead. However, since the original get request included the location hash for the "list" tab action, we have to update the location hash parameter so that Funky Tabs will update the window location hash to the "add" tab action value instead of the "list" tab action value.
84
99
 
85
100
  == Rendering
86
101
 
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.4') do |p|
5
+ Echoe.new('funky_tabs', '0.1.5') 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.4"
5
+ s.version = "0.1.5"
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-24}
9
+ s.date = %q{2011-05-25}
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"]
@@ -8,11 +8,7 @@ module FunkyTabs
8
8
  module InstanceMethods
9
9
  def render(*args, &block)
10
10
  super(*args, &block) and return if params[:funky_tabs].nil?
11
- if FunkyTabs.correct_path_for_location_hash?(request.fullpath,params[:location_hash])
12
- @location_hash = params[:location_hash]
13
- else
14
- @location_hash = FunkyTabs.location_hash_for_content_path(request.fullpath)
15
- end
11
+ @location_hash = params[:location_hash]
16
12
  super(*args, &block) and return if @location_hash.nil?
17
13
  @tab_index = FunkyTabs.tab_index_from_location_hash(@location_hash)
18
14
  super(*args, &block) and return if @tab_index.nil?
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.4
5
+ version: 0.1.5
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-24 00:00:00 -07:00
13
+ date: 2011-05-25 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16