admin interface generation

This commit is contained in:
Mark Moser 2016-08-17 17:49:09 -05:00
parent 9e27ba379e
commit 6a3f652dd7
26 changed files with 268 additions and 0 deletions

View File

@ -0,0 +1,12 @@
module Admin
class AuthController < AdminController
def login
end
def auth
end
def logout
end
end
end

View File

@ -0,0 +1,21 @@
module Admin
class QuestionController < AdminController
def index
end
def new
end
def create
end
def view
end
def edit
end
def update
end
end
end

View File

@ -0,0 +1,21 @@
module Admin
class QuizController < AdminController
def index
end
def new
end
def create
end
def view
end
def edit
end
def update
end
end
end

View File

@ -0,0 +1,21 @@
module Admin
class UserController < AdminController
def index
end
def new
end
def create
end
def view
end
def edit
end
def update
end
end
end

View File

@ -0,0 +1,2 @@
class AdminController < ApplicationController
end

View File

@ -0,0 +1,2 @@
<h1>Admin::Auth#login</h1>
<p>Find me in app/views/admin/auth/login.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Auth#logout</h1>
<p>Find me in app/views/admin/auth/logout.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Questions#edit</h1>
<p>Find me in app/views/admin/questions/edit.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Questions#index</h1>
<p>Find me in app/views/admin/questions/index.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Questions#new</h1>
<p>Find me in app/views/admin/questions/new.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Questions#view</h1>
<p>Find me in app/views/admin/questions/view.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Quizes#edit</h1>
<p>Find me in app/views/admin/quizes/edit.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Quizes#index</h1>
<p>Find me in app/views/admin/quizes/index.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Quizes#new</h1>
<p>Find me in app/views/admin/quizes/new.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Quizes#view</h1>
<p>Find me in app/views/admin/quizes/view.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Users#edit</h1>
<p>Find me in app/views/admin/users/edit.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Users#index</h1>
<p>Find me in app/views/admin/users/index.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Users#new</h1>
<p>Find me in app/views/admin/users/new.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Users#view</h1>
<p>Find me in app/views/admin/users/view.html.erb</p>

View File

@ -23,5 +23,11 @@ module SkillAssessmentApp
config.action_mailer.delivery_method = :mailjet config.action_mailer.delivery_method = :mailjet
config.action_mailer.default_url_options = { host: ENV['full_app_url'] } config.action_mailer.default_url_options = { host: ENV['full_app_url'] }
config.generators do |g|
g.assets false
g.helper false
g.routes false
end
end end
end end

View File

@ -1,4 +1,31 @@
Rails.application.routes.draw do Rails.application.routes.draw do
post "/admin/login", to: "admin/auth#auth", as: :admin_auth
get "/admin/logout", to: "admin/auth#logout", as: :admin_logout
get "/admin", to: "admin/auth#login", as: :admin
get "/admin/quizzes", to: "admin/quiz#index", as: :admin_quizzes
get "/admin/quiz/new", to: "admin/quiz#new", as: :admin_new_quiz
post "/admin/quiz/create", to: "admin/quiz#create", as: :admin_create_quiz
get "/admin/quiz/:quiz_id", to: "admin/quiz#view", as: :admin_quiz
get "/admin/quiz/:quiz_id/edit", to: "admin/quiz#edit", as: :admin_edit_quiz
post "/admin/quiz/:quiz_id/update", to: "admin/quiz#update", as: :admin_update_quiz
get "/admin/users", to: "admin/user#index", as: :admin_users
get "/admin/user/new", to: "admin/user#new", as: :admin_new_user
post "/admin/user/create", to: "admin/user#create", as: :admin_create_user
get "/admin/user/:user_id", to: "admin/user#view", as: :admin_user
get "/admin/user/:user_id/edit", to: "admin/user#edit", as: :admin_edit_user
post "/admin/user/:user_id/update", to: "admin/user#update", as: :admin_update_user
get "/admin/questions", to: "admin/question#index", as: :admin_questions
get "/admin/question/new", to: "admin/question#new", as: :admin_new_question
post "/admin/question/create", to: "admin/question#create", as: :admin_create_question
get "/admin/question/:question_id", to: "admin/question#view", as: :admin_question
get "/admin/question/:question_id/edit", to: "admin/question#edit", as: :admin_edit_question
post "/admin/question/:question_id/update", to: "admin/question#update", as: :admin_update_question
#########################################################################################
post "/validate", to: "candidate#validate", as: :validate_candidate post "/validate", to: "candidate#validate", as: :validate_candidate
get "/login(/:test_id)", to: "candidate#login", as: :login get "/login(/:test_id)", to: "candidate#login", as: :login
get "/welcome", to: "candidate#welcome", as: :welcome get "/welcome", to: "candidate#welcome", as: :welcome

View File

@ -0,0 +1,21 @@
require 'test_helper'
module Admin
class AuthControllerTest < ActionDispatch::IntegrationTest
test "should get login" do
get admin_url
assert_response :success
assert_template 'admin/auth/login'
end
test "should get auth" do
post admin_auth_url
assert_response :success
end
test "should get logout" do
get admin_logout_url
assert_response :success
end
end
end

View File

@ -0,0 +1,35 @@
require 'test_helper'
module Admin
class QuestionControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get admin_questions_url
assert_response :success
end
test "should get new" do
get admin_new_question_url
assert_response :success
end
test "should post create" do
post admin_create_question_url
assert_response :success
end
test "should get view" do
get admin_question_url questions(:fed5).to_i
assert_response :success
end
test "should get edit" do
get admin_edit_question_url questions(:fed5).to_i
assert_response :success
end
test "should post update question" do
post admin_update_question_url questions(:fed5).to_i
assert_response :success
end
end
end

View File

@ -0,0 +1,35 @@
require 'test_helper'
module Admin
class QuizControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get admin_quizzes_url
assert_response :success
end
test "should get new" do
get admin_new_quiz_url
assert_response :success
end
test "should post create" do
post admin_create_quiz_url
assert_response :success
end
test "should get view" do
get admin_quiz_url quizzes(:fed).to_i
assert_response :success
end
test "should get edit" do
get admin_edit_quiz_url quizzes(:fed).to_i
assert_response :success
end
test "should post update quiz" do
post admin_update_quiz_url quizzes(:fed).to_i
assert_response :success
end
end
end

View File

@ -0,0 +1,35 @@
require 'test_helper'
module Admin
class UserControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get admin_users_url
assert_response :success
end
test "should get new" do
get admin_new_user_url
assert_response :success
end
test "should post create" do
post admin_create_user_url
assert_response :success
end
test "should get view" do
get admin_user_url users(:recruiter).to_i
assert_response :success
end
test "should get edit" do
get admin_edit_user_url users(:recruiter).to_i
assert_response :success
end
test "should post update user" do
post admin_update_user_url users(:recruiter).to_i
assert_response :success
end
end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class AdminControllerTest < ActionDispatch::IntegrationTest
end