Sha256: 016c3b19a04b7433a4d5d4a90bfb8b80c4143b2feef82a51dfe4c36d4efbf93e

Contents?: true

Size: 1.03 KB

Versions: 24

Compression:

Stored size: 1.03 KB

Contents

The `views` generator generates views (partials) for use with menus.

It is sometimes the case that you want to have menu items in a main navigation menu that enable the user to log in/out, register a new user account or edit an existing user account. The menu items partials ensure that these menuitems are only shown as appropriate in relation to the current user login status, so that log out and edit account is only shown if the user is currently logged in and vice-versa.   

<pre>$ rails g cream:views</pre>

Create HAML views

<pre>$ rails g cream:views --template_engine haml</pre>

Example usage:
<pre>ul.menu
    render 'cream/login_items'                              
    render 'cream/registration_items'

  ul.admin_menu_
    render 'cream/admin_login_items'</pre>
    
    
<pre>module RolePermit
  class Moderator
    def initialize(ability)
      super
    end


    def permit?(user)
      super
      return if !user.role?(:moderator)
      can :read, :all
      user.owns(Comment)
      user.owns(Book, :author)
    end
  end
end</pre>

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
cream-0.8.6 wiki/VIEWS_GENERATOR.txt
cream-0.8.5 wiki/VIEWS_GENERATOR.txt
cream-0.8.4 wiki/VIEWS_GENERATOR.txt
cream-0.8.3 wiki/VIEWS_GENERATOR.txt
cream-0.8.2 wiki/VIEWS_GENERATOR.txt
cream-0.8.1 wiki/VIEWS_GENERATOR.txt
cream-0.8.0 wiki/VIEWS_GENERATOR.txt
cream-0.7.10 wiki/VIEWS_GENERATOR.txt
cream-0.7.8 wiki/VIEWS_GENERATOR.txt
cream-0.7.7 wiki/VIEWS_GENERATOR.txt
cream-0.7.6 wiki/VIEWS_GENERATOR.txt
cream-0.7.5 wiki/VIEWS_GENERATOR.txt
cream-0.7.3 wiki/VIEWS_GENERATOR.txt
cream-0.7.2 wiki/VIEWS_GENERATOR.txt
cream-0.7.0 wiki/VIEWS_GENERATOR.txt
cream-0.6.4 wiki/VIEWS_GENERATOR.txt
cream-0.6.3 wiki/VIEWS_GENERATOR.txt
cream-0.6.1 wiki/VIEWS_GENERATOR.txt
cream-0.6.0 wiki/VIEWS_GENERATOR.txt
cream-0.5.10 wiki/VIEWS_GENERATOR.txt