Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

admin dashboard setup along with devise login set to username

  • Loading branch information...
commit f7856ea17f4532e63c910edf4fb12d372595907d 1 parent 1b66605
@bsodmike authored
View
1  Gemfile
@@ -15,6 +15,7 @@ gem 'cancan'
gem 'devise'
gem 'vidibus-routing_error'
gem 'kaminari'
+gem 'wicked_pdf'
gem 'rspec-rails', :group => [:development, :test]
gem 'pry', :group => [:development, :test]
View
5 app/controllers/admin/dashboard_controller.rb
@@ -0,0 +1,5 @@
+class Admin::DashboardController < AdminController
+ def index
+ end
+
+end
View
7 app/controllers/admin_controller.rb
@@ -0,0 +1,7 @@
+class AdminController < ApplicationController
+ before_filter :authenticate_user!
+ before_filter do
+ redirect_to '/' unless current_user && current_user.admin? && current_user.active?
+ end
+
+end
View
2  app/views/admin/dashboard/index.html.erb
@@ -0,0 +1,2 @@
+<h1>Admin::Dashboard#index</h1>
+<p>Find me in app/views/admin/dashboard/index.html.erb</p>
View
4 app/views/devise/sessions/new.html.erb
@@ -1,8 +1,8 @@
<h2>Sign in</h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
- <div><%= f.label :email %><br />
- <%= f.email_field :email %></div>
+ <div><%= f.label :username %><br />
+ <%= f.text_field :username %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
View
9 config/routes.rb
@@ -1,8 +1,11 @@
CoreApp::Application.routes.draw do
- devise_for :users
-
- get "public/index"
root :to => 'public#index'
+ devise_for :users, :path => "login"
+
+ namespace :admin do
+ root :to => 'dashboard#index'
+
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.