From 1b977d0c996473a05b8b05785d0ecf4b183034c2 Mon Sep 17 00:00:00 2001 From: Wyatt Greene Date: Tue, 7 Feb 2012 17:55:31 -0500 Subject: [PATCH] Added support for Twitter Bootstrap (version 2). --- CHANGELOG.rdoc | 4 ++ README.rdoc | 19 ++++++- lib/generators/tabs/templates/tabulous.rb | 30 ++++++++--- lib/tabulous/options.rb | 6 +++ lib/tabulous/tabulous.rb | 62 +++++++++++++++++++++-- lib/tabulous/version.rb | 2 +- 6 files changed, 109 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index b69da23..5d97f1a 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,7 @@ +== 1.2.0 (February 8, 2012) +* Added support for Twitter Bootstrap (version 2). +* Noted in the documentation that tabulous works with Rails 3.2. + == 1.1.0 (January 10, 2012) * Deprecated the raise_error_if_no_tab_found configuration setting. Replaced it with config.when_action_has_no_tab. diff --git a/README.rdoc b/README.rdoc index 6ab5509..180559e 100644 --- a/README.rdoc +++ b/README.rdoc @@ -6,7 +6,7 @@ Tabulous provides an easy way to add tabs to your Rails application. == Requirements -Tabulous only works with Rails 3.0 and 3.1. It has been tested on Ruby 1.8.7 and 1.9.2. +Tabulous works with Rails 3.0, 3.1 and 3.2. It has been tested on Ruby 1.8.7 and 1.9.2. == Usage @@ -66,6 +66,23 @@ There is a tutorial at http://techiferous.com/2011/03/tutorial-for-adding-tabs-t Also, look in this gem's test/applications directory to find working example applications. Look at their app/tabs/tabulous.rb and app/layouts/application.html.erb files. +== Twitter Bootstrap + +To get tabulous to work with Twitter Bootstrap version 2, make sure the +following values are set in app/tabs/tabulous.rb: + +* config.css.scaffolding = false +* config.tabs_ul_class = "nav nav-pills" # or whatever Bootstrap class you want +* config.bootstrap_style_subtabs = true +* config.active_tab_clickable = true + +When config.bootstrap_style_subtabs is set to true, the subtabs are rendered +inside the tab markup, so you only need to call the tabs helper in your +layout, not the subtabs helper. + +Also note that if you use Twitter Bootstrap, you lose the ability to disable +individual subtabs. + == Contributing Developers are encouraged to contribute ideas or code. diff --git a/lib/generators/tabs/templates/tabulous.rb b/lib/generators/tabs/templates/tabulous.rb index d5b5056..525f0af 100644 --- a/lib/generators/tabs/templates/tabulous.rb +++ b/lib/generators/tabs/templates/tabulous.rb @@ -122,9 +122,9 @@ s << ' end' Tabulous::Formatter.format(s).join("\n") %> - #------------- - # OPTIONS - #------------- + #--------------------- + # GENERAL OPTIONS + #--------------------- # By default, you cannot click on the active tab. config.active_tab_clickable = false @@ -140,13 +140,28 @@ # config.when_action_has_no_tab = :render # the tab navigation HTML will be generated, # but no tab or subtab will be active + #-------------------- + # MARKUP OPTIONS + #-------------------- + # By default, div elements are used in the tab markup. When html5 is # true, nav elements are used instead. config.html5 = false - #------------ - # STYLES - #------------ + # This gives you control over what class the