foodsoft/app/views/layouts/_main_tabnav.html.erb

71 lines
2.9 KiB
Text
Raw Normal View History

<%
u = @current_user
tabs = [
{ :name => "Start", :url => root_path, :active => ["index", "messages", "home"],
:subnav => [
{ :name => "Messages", :url => "/messages"},
{ :name => "My tasks", :url => "/home/tasks" },
{ :name => "My ordergroup", :url => "/home/ordergroup"},
{ :name => "My profile", :url => "/home/profile"}
]
},
{ :name => "Foodcoop", :url => "/foodcoop/members", :active => ["foodcoop", "tasks"],
:subnav => [
{ :name => "Members", :url => "/foodcoop/members"},
{ :name => "Workgroups", :url => "/foodcoop/workgroups"},
{ :name => "Tasks", :url => "/tasks"}
]
},
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"],
:subnav => [
{ :name => "Order", :url => "/ordering" },
{ :name => "My orders", :url => "/ordering/myOrders" },
2009-02-03 21:14:48 +01:00
{ :name => "Manage orders", :url => "/orders", :access_denied? => (!u.role_orders?) }
]
},
2009-01-18 17:42:51 +01:00
{ :name => "Articles", :url => "/suppliers",
:active => ["articles", "suppliers", "deliveries", "article_categories", "stockit"],
2009-02-03 21:14:48 +01:00
:access_denied? => (!u.role_article_meta? && !u.role_suppliers?),
:subnav => [
2009-01-18 17:42:51 +01:00
{ :name => "Artikel", :url => supplier_articles_path(Supplier.first) },
{ :name => "Lager", :url => "/stockit" },
2009-02-03 21:14:48 +01:00
{ :name => "Lieferantinnen", :url => suppliers_path, :access_denied? => (!u.role_suppliers?) },
2009-01-18 17:42:51 +01:00
{ :name => "Kategorien", :url => "/article_categories"}
]
},
{ :name => "Finance", :url => "/finance",
:active => ["finance/invoices", "finance/transactions", "finance/balancing"],
2009-02-03 21:14:48 +01:00
:access_denied? => (!u.role_finance?),
:subnav => [
{ :name => "Manage accounts", :url => "/finance/transactions" },
{ :name => "Balance orders", :url => "/finance/balancing/list" },
{ :name => "Invoices", :url => finance_invoices_path }
]
},
{ :name => "Administration", :url => "/admin",
:active => ["admin", "admin/users", "admin/ordergroups", "admin/workgroups"],
2009-02-03 21:14:48 +01:00
:access_denied? => (!u.role_admin?),
:subnav => [
{ :name => "Users", :url => admin_users_path },
{ :name => "Ordergroups", :url => admin_ordergroups_path },
{ :name => "Workgroups", :url => admin_workgroups_path }
]
}
]
-%>
<ul>
<% for tab in tabs -%>
2009-02-03 21:14:48 +01:00
<% unless tab[:access_denied?] -%>
<li class="<%= 'current' if tab_is_active?(tab) %>">
<%= link_to tab[:name], tab[:url] %>
<ul>
<% for subtab in tab[:subnav] -%>
2009-02-03 21:14:48 +01:00
<% unless subtab[:access_denied?] -%>
<li><%= link_to subtab[:name], subtab[:url] %></li>
<% end -%>
<% end -%>
</ul>
</li>
<% end -%>
<% end -%>
</ul>