<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>Zetani DVD Rentals</title>
<%= stylesheet_link_tag "scaffold", :media => "screen" %>
<%= stylesheet_link_tag "screen", :media => "screen" %>
<%= stylesheet_link_tag "niftyCorners", :media => "screen" %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag "synergousselects" %>
<%= javascript_include_tag "niftycube" %>
<script type="text/javascript">
Event.observe(window, 'load', function(){
Nifty("div#admin_menu");
Nifty("div#user_rentals");
});
</script>
</head>

<body>
<div id="header">
<h1 id="dvd_rental_demo">DVD Rental Demo</h1>
<h2><a href="mailto:lee.hambley@gmail.com">Lee Hambley's</a> Demo Application for <strong>Zetani</strong></h2>
</div>
<div id="header_tabs">
<ul id="tabnav">
<li><a href="/">Home</a></li>
<li><a href="/categories/browse">Browse</a></li>
<li><a href="/static/learn_more">Learn More</a></li>
<li><a href="/account/register">Register / Free Trial</a></li>
</ul>
</div>
<div id="menu_container">
<div id="common_menu">
<h2 class="reader_tip header">Common User Menu</h2>
<ul>
<li><%= link_to "Home", :controller => '/' %></li>
<li><%= link_to "Browse Categories", :controller => 'categories', :action => 'browse' %></li>
</ul>
<ul>
<li><%= link_to "About Us", :controller => 'static', :action => 'about_us' %></li>
<li><%= link_to "Terms of Service", :controller => 'static', :action => 'terms_of_service' %></li>
</ul>
</div>
<% if not logged_in? -%>
<div id="guest_menu">
<h2 class="reader_tip header">Guest Menu</h2>
<ul>
<li><%= link_to("Register", :controller => 'account', :action => 'register') %></li>
<li><%= link_to("Sign In", :controller => 'account', :action => 'login')%></li>
</ul>
</div>
<% else -%>
<% if @current_user.has_role("Administrator") -%>
<div id="admin_menu">
<h2 class="reader_tip header">Administration Menu</h2>
<ul>
<li><%= link_to "Edit Categories", :controller => "categories" %></li>
<li><%= link_to "Edit Roles", :controller => 'roles' %> &amp; <%= link_to "Rights", :controller => 'rights' %>
<li><%= link_to "Edit Titles", :controller => 'titles' %></li>
</ul>
</div>
<% end -%>
<div id="user_menu">
<h2 class="reader_tip header">User Menu</h2>
<ul>
<li><%= link_to "My Account", :controller => "account" %></li>
<li><%= link_to("Sign Out", :controller => 'account', :action => 'logout')%></li>
<li><%= link_to "Edit My Account", :action => 'edit', :id => @current_user.id -%></li>
</ul>
</div>
<div id="user_rentals">
<h2 class="header">Rentals</h2>
<ul>
!! <% @current_user.rentals.each {|rental| -%>
!! <li class="rental<%= " overdue" if rental.updated_at + 3.days < Time.now %>">
!! <%= link_to rental.title.name, :controller => 'titles', :action => 'show', :id => rental.title_id %>
!! <%=
!! if rental.updated_at + 3.days > Time.now
!! " due back in " + distance_of_time_in_words(rental.updated_at + 3.days, Time.now)
!! else
!! distance_of_time_in_words(rental.updated_at + 3.days, Time.now) + " over due!"
!! end
!! -%>
!! </li>
!! <% } -%>
</ul>
</div>
<% end -%>
</div>
<div id="content_container">
<div id="location_container">
<h3 class="reader_tip header">Location</h3>
<span class="location location_first"><a href="/">Home</a></span>
<% if controller.controller_path -%>
<% if controller.action_name -%>
<span class="location_inner">
<% else %>
<span class="location_last">
<% end -%>
<%= link_to controller.controller_path.capitalize, :controller => controller.controller_path %>
</span>
<% end -%>
<% if controller.action_name -%>
<span class="location_last"><%= link_to controller.action_name.capitalize, :controller => controller.controller_path, :action => controller.action_name unless controller.action_name == "index" %></span>
<% end -%>
</div>
<div id="flashes">
<h2 class="reader_tip header">Messages</h2>
<%
# Define Standard _Flash_ names..
flashes = [:notice, :warning, :message]
# Usage:
# :notice for positive feedback (action successful, etc)
# :message for neutral feedback (reminders, etc)
# :warning for negative feedback (action unsuccessful, error encountered, etc)
%>
<% for name in flashes %>
<% if flash[name] %>
<%= "<div id=\"flash_#{name}\">#{flash[name]}</div>" %>
<% end %>
<% end %>
</div>
<div id="page">
<%= yield %>
</div>
</div>
<div id="footer">
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png"/></a><br/>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License</a>.</p>
</div>
</body>
</html>