## View helpers ##

Currently the view helpers only target use with devise and cancan.
The default labels are always loaded from the `cream` locale file, which is generated by the `config` generator.

### Rest link helpers ###

Display a link (anchor tag) for a given object only if the current user has permission to execute that action.

* show_link or read_link
* edit_link or update_link
* create_link or new_link
* destroy_link or delete_link

Each Rest helper method takes an object for which to create the link. Optionally provide a label as the second argument. 

Example usage:

<%= create_link project %>
<%= create_link project, 'Create new project' %>

### Session link helpers ###

Show links for performing user authentication and registration actions 

* log_out_link or sign_out_link
* log_in_link or sign_in_link  

Each of these methods take an optional options hash. 
If no role option given, they default to create link for basic 'user' role.

Example usage:

<%= log_out_link %> 
<%= log_out_link :label => 'Log me out' %>
<%= log_out_link :role => 'admin', :label => 'Log me out' %>


### Registration link helpers ###

Show links for performing user authentication and registration actions 

* register_link or sign_up_link    
* edit_profile_link or edit_registration_link   

Each of these methods take an optional options hash. 
If no role option given, they default to create link for basic 'user' role.

Example usage:

<%= register_link %> 
<%= register_link :label => 'Register me' %>
<%= register_link :role => 'admin', :label => 'Register me' %>

### Registration Menu item helpers ###

Show menu links for registration conditionally

* edit_user_menu_item or edit_registration_menu_item   
* register_menu_item or sign_up_menu_item

1) only shown if user is currently logged in
2) only shown if user is NOT currently logged in (and hence already registered)

Example usage:

ul.menu
  <%= register_menu_item %> 

### Session Menu item helpers ###

Show menu links for session operations conditionally

* logout_menu_item or sign_out_menu_item 
* login_menu_item or sign_in_menu_item 
                                      
1) only shown if user is currently logged in
2) only shown if user is NOT currently logged in

ul.menu
  <%= login_menu_item %> 
  <%= logout_menu_item %> 


## Block helpers ##

Execute block if user is logged in (or not logged in)
* user_block
* not_user_block

Execute block if user is logged and is admin (or not admin)
* admin_block
* not_admin_block

Execute block if ip is localhost (or not localhost)
* localhost_block
* not_localhost_block
  
Execute block if role is included in list of roles (or not)
* roles_block
* not_roles_block

## Block area helpers ##

Create div.user 'area' and execute block if user is logged in as a user (or not) 

* user_area
* not_user_area

Create div.admin 'area' and execute block if user is admin (or not admin)

* admin_area
* not_admin_area

Example:
<pre>
<% admin_area do %> 
  ul.admin_menu
  ...

If logged in as admin, results in:

div.admin
  ul.admin_menu  
   ...
</pre>

## Roles block area helpers ##

Creates are if role is one included in list of roles (or not)

* roles_area
* not_roles_area

Example:
<pre>
<% roles_area 'admin, 'editor', :class => 'special' do %> 
  ul.admin_menu
  ...
  
If logged in as either 'editor' or 'admin', results in:

div.special
  ul.admin_menu  
   ...
    
</pre>

## Misc helpers ##

* user? - 
* admin?
* role?
* localhost?

Examples
<pre>     
<%= current_user.username if user? %>
<%= "Admin: #{current_user.username}" if admin? %>  
<%= "Special user!" if role?('admin', 'reviewer') %>  
<%= "Running on localhost!" if localhost? %>  
</pre>