<?xml version="1.0" encoding="UTF-8"?>
<wiki>
  <body>&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Need to change the tabs on the top of the page in RuckSack? Well you have come to the right place!&lt;/p&gt;
&lt;h2&gt;The details&lt;/h2&gt;
&lt;p&gt;Tabs in RuckSack are rendered in the &amp;#8220;app/views/layouts/_tabs.html.haml&amp;#8221; partial. If you look at that file, you may notice two important variables:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@tabbed_navigation_items&lt;/li&gt;
	&lt;li&gt;@user_navigation_items&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These contain the tabs on the left and right, respectively. If you look at the action views, you&amp;#8217;ll notice that these are almost always assigned like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
  - @tabbed_navigation_items = common_tabs(:pages)
  - @user_navigation_items = user_tabs(nil)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Basically &amp;#8220;common_tabs&amp;#8221; and &amp;#8220;user_tabs&amp;#8221; are both helpers located in &amp;#8220;app/helpers/application_helper.rb&amp;#8221;. The variable being passed in controls which tab is marked as active, in this case the &amp;#8220;pages&amp;#8221; tab for the left tabs, and nothing for the right tabs.&lt;/p&gt;
&lt;p&gt;Looking further, here is the code for those two helpers:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
	def common_tabs(current)
	  items = [{:id =&amp;gt; :overview, :url =&amp;gt; '/dashboard'},
	           {:id =&amp;gt; :pages, :url =&amp;gt; '/pages/current'},
	           {:id =&amp;gt; :reminders, :url =&amp;gt; '/reminders'},
	           {:id =&amp;gt; :journal, :url =&amp;gt; '/journals'}]
	  
	  @selected_navigation_item = current
	  return items
	end
	
	def user_tabs(current)
	  items = [{:id =&amp;gt; :users, :url =&amp;gt; '/users'}]
	  
	  @selected_user_item = current
	  return items
	end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So essentially, an item in the tab is represented as a hash. e.g.:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
{:id =&amp;gt; :journal, :url =&amp;gt; '/journals'}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which makes a &amp;#8220;Journal&amp;#8221; tab linking to &amp;#8220;/journals&amp;#8221;. So all you need to do is add your own hash to the items list in either common_tabs or user_tabs. e.g.:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
{:id =&amp;gt; :cake, :url =&amp;gt; '/cake'}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But wait! There is one more thing to do. You need to add a localization for your tab in lang/ui/en-US.yml. e.g.:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
cake: Cake
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And hey presto! You have a new tab. Now all you need to do is implement &amp;#8220;/cake&amp;#8221;&amp;#8230;&lt;/p&gt;</body>
  <created-at type="datetime">2008-10-08T13:43:14-07:00</created-at>
  <id type="integer">64955</id>
  <permalink>changing-tabs</permalink>
  <repository-id type="integer">37011</repository-id>
  <title>Changing tabs</title>
  <updated-at type="datetime">2008-10-08T13:43:14-07:00</updated-at>
  <user-id type="integer">10850</user-id>
</wiki>
