admin views roughed in
This commit is contained in:
parent
430097b6ef
commit
63701c8247
28
Guardfile
28
Guardfile
@ -15,6 +15,20 @@
|
|||||||
#
|
#
|
||||||
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
||||||
|
|
||||||
|
guard 'livereload' do
|
||||||
|
watch(%r{app/assets/.+\.(scss|css|js|erb)})
|
||||||
|
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
||||||
|
watch(%r{app/controllers/.+\.rb})
|
||||||
|
watch(%r{app/helpers/.+\.rb})
|
||||||
|
watch(%r{public/.+\.(css|js|html)})
|
||||||
|
watch(%r{config/locales/.+\.yml})
|
||||||
|
|
||||||
|
# Rails Assets Pipeline
|
||||||
|
watch(%r{(app|vendor)(/assets/\w+/(.+\.(scss|css|js|erb|html|png|jpg))).*}) do |m|
|
||||||
|
"/assets/#{m[3]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
guard :minitest, spring: true, all_after_pass: true, all_on_start: false do
|
guard :minitest, spring: true, all_after_pass: true, all_on_start: false do
|
||||||
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
||||||
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
||||||
@ -32,20 +46,6 @@ guard :minitest, spring: true, all_after_pass: true, all_on_start: false do
|
|||||||
watch(%r{^app/views/(.*_mailer/)?([^/]+)\.erb$}) { ["test/mailers", "test/integration"] }
|
watch(%r{^app/views/(.*_mailer/)?([^/]+)\.erb$}) { ["test/mailers", "test/integration"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
guard 'livereload' do
|
|
||||||
watch(%r{app/assets/.+\.(scss|css|js|erb)})
|
|
||||||
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
|
||||||
watch(%r{app/controllers/.+\.rb})
|
|
||||||
watch(%r{app/helpers/.+\.rb})
|
|
||||||
watch(%r{public/.+\.(css|js|html)})
|
|
||||||
watch(%r{config/locales/.+\.yml})
|
|
||||||
|
|
||||||
# Rails Assets Pipeline
|
|
||||||
watch(%r{(app|vendor)(/assets/\w+/(.+\.(scss|css|js|erb|html|png|jpg))).*}) do |m|
|
|
||||||
"/assets/#{m[3]}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
guard :rubocop do
|
guard :rubocop do
|
||||||
watch(/.+\.rb$/)
|
watch(/.+\.rb$/)
|
||||||
watch(/Rakefile/)
|
watch(/Rakefile/)
|
||||||
|
@ -42,7 +42,7 @@ module Admin
|
|||||||
private
|
private
|
||||||
|
|
||||||
def quiz_params
|
def quiz_params
|
||||||
params.require(:quiz).permit(:dept, :unit)
|
params.require(:quiz).permit(:name, :dept, :unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
class AdminController < ApplicationController
|
class AdminController < ApplicationController
|
||||||
|
layout 'admin'
|
||||||
before_action :authorize_admin
|
before_action :authorize_admin
|
||||||
|
|
||||||
def dashboard
|
def dashboard
|
||||||
|
@quizzes = Quiz.includes(:questions).all
|
||||||
|
@users = User.order(:role, :name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_admin
|
def current_admin
|
||||||
|
@ -9,4 +9,12 @@ module ApplicationHelper
|
|||||||
["15+ Years", "15+"]
|
["15+ Years", "15+"]
|
||||||
], disabled: "-", selected: (val.blank? ? '' : val))
|
], disabled: "-", selected: (val.blank? ? '' : val))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin_role_options val
|
||||||
|
options_for_select([
|
||||||
|
%w(Reviewer reviewer),
|
||||||
|
%w(Recruiter recruiter),
|
||||||
|
%w(Admin admin)
|
||||||
|
], disabled: "-", selected: (val.blank? ? '' : val))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,7 @@ class Quiz < ApplicationRecord
|
|||||||
has_many :questions, -> { order(:sort) }
|
has_many :questions, -> { order(:sort) }
|
||||||
has_many :candidates
|
has_many :candidates
|
||||||
|
|
||||||
|
validates_presence_of :name
|
||||||
validates_presence_of :dept
|
validates_presence_of :dept
|
||||||
validates_presence_of :unit
|
validates_presence_of :unit
|
||||||
end
|
end
|
||||||
|
@ -1,2 +1,21 @@
|
|||||||
<h1>Admin::Auth#login</h1>
|
<main class="intro_tpl">
|
||||||
<p>Find me in app/views/admin/auth/login.html.erb</p>
|
<h1>Admin Login</h1>
|
||||||
|
|
||||||
|
<% if flash[:error].present? %>
|
||||||
|
<div class="error"><%= flash[:error] %></div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= form_for :auth, url: admin_login_path do |form| %>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :email %>
|
||||||
|
<%= form.email_field :email %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :password %>
|
||||||
|
<%= form.password_field :password %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= submit_tag "Log in" %>
|
||||||
|
<% end %>
|
||||||
|
</main>
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
<h1>Admin::Auth#logout</h1>
|
|
||||||
<p>Find me in app/views/admin/auth/logout.html.erb</p>
|
|
@ -1 +1,18 @@
|
|||||||
huzzah! dashboard
|
<%
|
||||||
|
content_for :section_title, "Admin Dashboard"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
|
<section>
|
||||||
|
<h1>Quizzes</h1>
|
||||||
|
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||||
|
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h1>Users</h1>
|
||||||
|
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||||
|
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
<h1>Admin::Questions#index</h1>
|
|
||||||
<p>Find me in app/views/admin/questions/index.html.erb</p>
|
|
@ -1,6 +1,29 @@
|
|||||||
<%= form_for quiz, url: action do |f| %>
|
<% if flash[:error].present? %>
|
||||||
<p>Unit: <%= f.text_field :unit %></p>
|
<div class="error">
|
||||||
<p>Dept: <%= f.text_field :dept %></p>
|
<%= flash[:error] %>
|
||||||
|
<p>
|
||||||
<%= f.submit %>
|
<% quiz.errors.messages.each do |k,v| %>
|
||||||
|
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= form_for quiz, url: action do |form| %>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :name, "Quiz Description" %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :dept, 'Department' %>
|
||||||
|
<%= form.text_field :dept %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :unit, 'Unit' %>
|
||||||
|
<%= form.text_field :unit %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= form.submit %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
19
app/views/admin/quiz/_table_list.html.erb
Normal file
19
app/views/admin/quiz/_table_list.html.erb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Dept</th>
|
||||||
|
<th>Unit</th>
|
||||||
|
<th>Questions</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% quizzes.each do |quiz| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to quiz.name, admin_quiz_path(quiz.to_i) %></td>
|
||||||
|
<td><%= quiz.dept %></td>
|
||||||
|
<td><%= quiz.unit %></td>
|
||||||
|
<td><%= quiz.questions.count %></td>
|
||||||
|
<td><%= link_to 'edit', admin_edit_quiz_path(quiz.to_i), { class: 'btn tertiary-btn' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
@ -1,4 +1,7 @@
|
|||||||
<h1>Admin::Quizes#edit</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/quizes/edit.html.erb</p>
|
content_for :section_title, "Edit: #{@quiz.name}"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>
|
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>
|
||||||
|
</main>
|
||||||
|
@ -1,2 +1,8 @@
|
|||||||
<h1>Admin::Quizes#index</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/quizes/index.html.erb</p>
|
content_for :section_title, "Quizzes"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
|
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||||
|
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||||
|
</main>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<h1>Admin::Quizes#new</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/quizes/new.html.erb</p>
|
content_for :section_title, "New Quiz"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>
|
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>
|
||||||
|
</main>
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
<h1>Admin::Quizes#view</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/quizes/view.html.erb</p>
|
content_for :section_title, "#{@quiz.name}"
|
||||||
|
%>
|
||||||
|
|
||||||
<main>
|
<main class="summary_tpl">
|
||||||
|
<p><%= @quiz.name %></p>
|
||||||
<p><%= @quiz.dept %></p>
|
<p><%= @quiz.dept %></p>
|
||||||
<p><%= @quiz.unit %></p>
|
<p><%= @quiz.unit %></p>
|
||||||
|
<%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: 'btn' }) %>
|
||||||
</main>
|
</main>
|
||||||
|
@ -1,7 +1,29 @@
|
|||||||
<%= form_for user, url: action do |f| %>
|
<% if flash[:error].present? %>
|
||||||
<p>Name: <%= f.text_field :name %></p>
|
<div class="error">
|
||||||
<p>eMail: <%= f.email_field :email %></p>
|
<%= flash[:error] %>
|
||||||
<p>Role: <%= f.text_field :role %></p>
|
<p>
|
||||||
|
<% user.errors.messages.each do |k,v| %>
|
||||||
<%= f.submit %>
|
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= form_for user, url: action do |form| %>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :name, "Full Name" %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :email, "eMail" %>
|
||||||
|
<%= form.email_field :email %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= form.label :role, "Role" %>
|
||||||
|
<%= form.select :role, admin_role_options(user.role), include_blank: false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= form.submit %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
17
app/views/admin/user/_table_list.html.erb
Normal file
17
app/views/admin/user/_table_list.html.erb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<th>User</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Role</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% users.each do |user| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to user.name, admin_user_path(user.to_i) %></td>
|
||||||
|
<td><%= mail_to(user.email) %></td>
|
||||||
|
<td><%= user.role %></td>
|
||||||
|
<td><%= link_to 'edit', admin_edit_user_path(user.to_i), { class: 'btn tertiary-btn' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
@ -1,4 +1,7 @@
|
|||||||
<h1>Admin::Users#edit</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/users/edit.html.erb</p>
|
content_for :section_title, "Edit: #{@user.name}"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>
|
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>
|
||||||
|
</main>
|
||||||
|
@ -1,2 +1,9 @@
|
|||||||
<h1>Admin::Users#index</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/users/index.html.erb</p>
|
content_for :section_title, "Users"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
|
<h1>Users</h1>
|
||||||
|
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||||
|
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||||
|
</main>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<h1>Admin::Users#new</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/users/new.html.erb</p>
|
content_for :section_title, "New User"
|
||||||
|
%>
|
||||||
|
|
||||||
|
<main class="summary_tpl">
|
||||||
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>
|
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>
|
||||||
|
</main>
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<h1>Admin::Users#view</h1>
|
<%
|
||||||
<p>Find me in app/views/admin/users/view.html.erb</p>
|
content_for :section_title, "#{@user.name}"
|
||||||
|
%>
|
||||||
|
|
||||||
<main>
|
<main class="summary_tpl">
|
||||||
<%= @user.name %>
|
<p><%= @user.name %></p>
|
||||||
|
<p><%= mail_to(@user.email) %></p>
|
||||||
|
<p><%= @user.role %></p>
|
||||||
|
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %>
|
||||||
</main>
|
</main>
|
||||||
|
46
app/views/layouts/admin.html.erb
Normal file
46
app/views/layouts/admin.html.erb
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
|
<title><%= yield(:title) %></title>
|
||||||
|
|
||||||
|
<!--[if ! lte IE 8]><!-->
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<!--<![endif]-->
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<%= javascript_include_tag 'ie9' %>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layout">
|
||||||
|
|
||||||
|
<header class="no-progressbar">
|
||||||
|
<div class="page-title slash-left">
|
||||||
|
<% if content_for?(:section_title) %>
|
||||||
|
<div><%= yield(:section_title) %></div>
|
||||||
|
<% else %>
|
||||||
|
<div>Skills Assessment Admin</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<div class="pd_logo"><%= image_tag("perficientdigital.png", alt:"Perficient Digital") %></div>
|
||||||
|
<div class="footer_yellow-bar slantleft slantright"> </div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!--[if ! lte IE 8]><!-->
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<!--<![endif]-->
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,2 +0,0 @@
|
|||||||
<h1>Recruiter#create</h1>
|
|
||||||
<p>Find me in app/views/recruiter/create.html.erb</p>
|
|
@ -7,24 +7,27 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
get "/admin/quizzes", to: "admin/quiz#index", as: :admin_quizzes
|
get "/admin/quizzes", to: "admin/quiz#index", as: :admin_quizzes
|
||||||
get "/admin/quiz/new", to: "admin/quiz#new", as: :admin_new_quiz
|
get "/admin/quiz/new", to: "admin/quiz#new", as: :admin_new_quiz
|
||||||
post "/admin/quiz/create", to: "admin/quiz#create", as: :admin_create_quiz
|
post "/admin/quiz/new", 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", to: "admin/quiz#view", as: :admin_quiz
|
||||||
get "/admin/quiz/:quiz_id/edit", to: "admin/quiz#edit", as: :admin_edit_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
|
post "/admin/quiz/:quiz_id/edit", to: "admin/quiz#update", as: :admin_update_quiz
|
||||||
|
patch "/admin/quiz/:quiz_id/edit", to: "admin/quiz#update"
|
||||||
|
|
||||||
get "/admin/users", to: "admin/user#index", as: :admin_users
|
get "/admin/users", to: "admin/user#index", as: :admin_users
|
||||||
get "/admin/user/new", to: "admin/user#new", as: :admin_new_user
|
get "/admin/user/new", to: "admin/user#new", as: :admin_new_user
|
||||||
post "/admin/user/create", to: "admin/user#create", as: :admin_create_user
|
post "/admin/user/new", 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", to: "admin/user#view", as: :admin_user
|
||||||
get "/admin/user/:user_id/edit", to: "admin/user#edit", as: :admin_edit_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
|
post "/admin/user/:user_id/edit", to: "admin/user#update", as: :admin_update_user
|
||||||
|
patch "/admin/user/:user_id/edit", to: "admin/user#update"
|
||||||
|
|
||||||
get "/admin/questions", to: "admin/question#index", as: :admin_questions
|
get "/admin/questions", to: "admin/question#index", as: :admin_questions
|
||||||
get "/admin/question/new", to: "admin/question#new", as: :admin_new_question
|
get "/admin/question/new", to: "admin/question#new", as: :admin_new_question
|
||||||
post "/admin/question/create", to: "admin/question#create", as: :admin_create_question
|
post "/admin/question/new", 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", to: "admin/question#view", as: :admin_question
|
||||||
get "/admin/question/:question_id/edit", to: "admin/question#edit", as: :admin_edit_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 "/admin/question/:question_id/edit", to: "admin/question#update", as: :admin_update_question
|
||||||
|
patch "/admin/question/:question_id/edit", to: "admin/question#update"
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
5
db/migrate/20160818225721_add_name_to_quiz.rb
Normal file
5
db/migrate/20160818225721_add_name_to_quiz.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class AddNameToQuiz < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
add_column :quizzes, :name, :string, after: :id
|
||||||
|
end
|
||||||
|
end
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160803003932) do
|
ActiveRecord::Schema.define(version: 20160818225721) do
|
||||||
|
|
||||||
create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
||||||
t.integer "candidate_id"
|
t.integer "candidate_id"
|
||||||
@ -62,6 +62,7 @@ ActiveRecord::Schema.define(version: 20160803003932) do
|
|||||||
t.string "dept"
|
t.string "dept"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.string "name"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
||||||
|
@ -29,7 +29,8 @@ module Admin
|
|||||||
|
|
||||||
test "should post create" do
|
test "should post create" do
|
||||||
assert_difference("Quiz.count", 1) do
|
assert_difference("Quiz.count", 1) do
|
||||||
post admin_create_quiz_url, params: { quiz: { unit: 'PDW', dept: 'MBL' } }
|
post admin_create_quiz_url, params: { quiz:
|
||||||
|
{ name: 'PDW Mobile team screening', unit: 'PDW', dept: 'MBL' } }
|
||||||
end
|
end
|
||||||
assert_redirected_to admin_quizzes_url
|
assert_redirected_to admin_quizzes_url
|
||||||
end
|
end
|
||||||
|
@ -39,7 +39,7 @@ module Admin
|
|||||||
user = users(:recruiter)
|
user = users(:recruiter)
|
||||||
get admin_user_url user.to_i
|
get admin_user_url user.to_i
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'main', user.name
|
assert_select 'p', user.name
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should get edit" do
|
test "should get edit" do
|
||||||
@ -55,7 +55,7 @@ module Admin
|
|||||||
assert_redirected_to admin_user_path(user.to_i)
|
assert_redirected_to admin_user_path(user.to_i)
|
||||||
|
|
||||||
get admin_user_url user.to_i
|
get admin_user_url user.to_i
|
||||||
assert_select 'main', 'new name'
|
assert_select 'p', 'new name'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should fail to update user" do
|
test "should fail to update user" do
|
||||||
|
1
test/fixtures/quizzes.yml
vendored
1
test/fixtures/quizzes.yml
vendored
@ -1,5 +1,6 @@
|
|||||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
fed:
|
fed:
|
||||||
|
name: PDR Standard FED Screening
|
||||||
unit: PDR
|
unit: PDR
|
||||||
dept: FED
|
dept: FED
|
||||||
|
Loading…
Reference in New Issue
Block a user