ECM User Area¶ ↑
Installation¶ ↑
Add it to your Gemfile:
# Gemfile gem 'ecm_user_area2'
If you don’t have devise installed, install it:
rails g devise:install
Install:
rails g ecm:user_area:install
Add Migrations and migrate:
rake ecm_user_area_engine:install:migrations && rake db:migrate
Add routes:
# config/routes.rb Ecm::UserArea::Routing.routes(self)
Add the helpers:
#app/controllers/application_controller.rb helper Ecm::UserAreaHelper
Usage¶ ↑
to secure a controller, add following before_action:
# app/controllers/my_secure_controller.rb before_action :authenticate_user!
When you visit any controller actions, you will be redirected to the sign in form.
How to add a user navigation?¶ ↑
Inside a navbar:
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="navbar-collapse collapse navbar-responsive-collapse"> <%= render_user_navigation %> </div>
You can call render_user_navigation(dropdown: true) to create a dropdown navigation
Running Specs¶ ↑
gem install bundler bundle cd spec/dummy && rake db:migrate RAILS_ENV=test && cd ../.. guard
This project rocks and uses MIT-LICENSE.