html reset

This commit is contained in:
Mark Moser 2017-03-20 10:57:50 -05:00
parent cb6f41fe29
commit 0727440a31
58 changed files with 397 additions and 529 deletions

View File

@ -1,4 +1,4 @@
<nav> <nav aria-label="Admin Menu">
<%= link_to("Users", admin_users_url) if policy(User).index? %> <%= link_to("Users", admin_users_url) if policy(User).index? %>
<% #= link_to("Departments", admin_departments_url) if policy(Department).index? %> <% #= link_to("Departments", admin_departments_url) if policy(Department).index? %>
<%= link_to("Quizzes", admin_quizzes_url) if policy(Quiz).index? %> <%= link_to("Quizzes", admin_quizzes_url) if policy(Quiz).index? %>

View File

@ -1,23 +1,20 @@
<% <% content_for :title, "Skills Assessment Admin" %>
content_for :main_class, "intro_tpl"
content_for :title, "Skills Assessment Admin"
%>
<h1>Admin Login</h1> <h1>Admin Login</h1>
<%= form_for :auth, url: admin_login_path do |form| %> <%= form_for :auth, url: admin_login_path do |form| %>
<% if flash[:error].present? %> <% if flash[:error].present? %>
<div class="form-group"> <div>
Need a <%= link_to "password reset", admin_reset_request_path %>? Need a <%= link_to "password reset", admin_reset_request_path %>?
</div> </div>
<% end %> <% end %>
<div class="form-group"> <div>
<%= form.label :email %> <%= form.label :email %>
<%= form.email_field :email %> <%= form.email_field :email %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :password %> <%= form.label :password %>
<%= form.password_field :password %> <%= form.password_field :password %>
</div> </div>

View File

@ -1,22 +1,18 @@
<% <% content_for :title, "Skills Assessment Admin" %>
content_for :main_class, "intro_tpl"
content_for :title, "Skills Assessment Admin"
%>
<h1>Password Reset</h1> <h1>Password Reset</h1>
<%= form_for :auth, url: admin_reset_password_path do |form| %> <%= form_for :auth, url: admin_reset_password_path do |form| %>
<%= hidden_field_tag :reset_token, params[:reset_token] %> <div>
<div class="form-group">
<%= form.label :password %> <%= form.label :password %>
<%= form.password_field :password %> <%= form.password_field :password %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :password_confirmation %> <%= form.label :password_confirmation %>
<%= form.password_field :password_confirmation %> <%= form.password_field :password_confirmation %>
</div> </div>
<%= submit_tag "Reset Password" %> <%= submit_tag "Reset Password" %>
<%= hidden_field_tag :reset_token, params[:reset_token] %>
<% end %> <% end %>

View File

@ -1,12 +1,9 @@
<% <% content_for :title, "Skills Assessment Admin" %>
content_for :main_class, "intro_tpl"
content_for :title, "Skills Assessment Admin"
%>
<h1>Password Reset</h1> <h1>Password Reset</h1>
<%= form_for :auth, url: admin_send_reset_path do |form| %> <%= form_for :auth, url: admin_send_reset_path do |form| %>
<div class="form-group"> <div>
<%= form.label :email %> <%= form.label :email %>
<%= form.email_field :email %> <%= form.email_field :email %>
</div> </div>

View File

@ -1,27 +1,27 @@
<%= render partial: 'shared/form_model_errors', locals: { obj: candidate } %> <%= render partial: 'shared/form_model_errors', locals: { obj: candidate } %>
<%= form_for candidate, url: action, method: :post do |form| %> <%= form_for candidate, url: action, method: :post do |form| %>
<div class="form-group"> <div>
<%= form.label :name, "Candidate name" %> <%= form.label :name, "Candidate name" %>
<%= form.text_field :name %> <%= form.text_field :name %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :email, "Candidate email" %> <%= form.label :email, "Candidate email" %>
<%= form.email_field :email %> <%= form.email_field :email %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :experience, "Years of experience" %> <%= form.label :experience, "Years of experience" %>
<%= form.select :experience, experience_options(candidate.experience), include_blank: false %> <%= form.select :experience, experience_options(candidate.experience), include_blank: false %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :project, "Client or project" %> <%= form.label :project, "Client or project" %>
<%= form.text_field :project %> <%= form.text_field :project %>
</div> </div>
<div class="form-group"> <div>
<%= form.radio_button :position, 'full-time' %> <%= form.radio_button :position, 'full-time' %>
<%= form.label "position_full-time", "Full-time" %> <%= form.label "position_full-time", "Full-time" %>
@ -29,12 +29,12 @@
<%= form.label :position_contract, "Contract" %> <%= form.label :position_contract, "Contract" %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :skill_needs, "Specific skill needs" %> <%= form.label :skill_needs, "Specific skill needs" %>
<%= form.text_field :skill_needs %> <%= form.text_field :skill_needs %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :quiz_id, "Quiz" %> <%= form.label :quiz_id, "Quiz" %>
<%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %> <%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %>
</div> </div>

View File

@ -1,10 +1,7 @@
<% <% content_for :title, "Edit Candidate - Skills Assessment Admin" %>
content_for :title, "Edit Candidate - Skills Assessment Admin"
%>
<main class="intro_tpl">
<h1>Edit: <%= @candidate.name %></h1> <h1>Edit: <%= @candidate.name %></h1>
<p><strong>Test ID: </strong><%= @candidate.test_hash %></p>
<div><strong>Test ID: </strong><%= @candidate.test_hash %></div>
<%= render partial: 'form', locals: { action: admin_update_candidate_path(@candidate.id), candidate: @candidate, quizzes: @quizzes } %> <%= render partial: 'form', locals: { action: admin_update_candidate_path(@candidate.id), candidate: @candidate, quizzes: @quizzes } %>
</main>

View File

@ -2,10 +2,8 @@
content_for :section_title, "Candidates" content_for :section_title, "Candidates"
content_for :title, "Candidates - Skills Assessment Admin" content_for :title, "Candidates - Skills Assessment Admin"
%> %>
<main class="summary_tpl">
<%= link_to(admin_new_candidate_path, { class: 'secondary-btn' }) do %> <%= link_to("Create New Candidate", admin_new_candidate_path, { class: "" }) if policy(Candidate).create? %>
<button>Create New Candidate</button>
<% end if policy(Candidate).create? %>
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr> <tr>
@ -36,5 +34,5 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= paginate @candidates %> <%= paginate @candidates %>
</main>

View File

@ -1,10 +1,6 @@
<% <% content_for :title, "New Candidate - Skills Assessment Admin" %>
content_for :title, "New Candidate - Skills Assessment Admin"
%>
<main class="intro_tpl">
<h1>New Candidate</h1> <h1>New Candidate</h1>
<%= render partial: 'form', locals: <%= render partial: 'form', locals:
{ action: admin_create_candidate_path, candidate: @candidate, quizzes: @quizzes } %> { action: admin_create_candidate_path, candidate: @candidate, quizzes: @quizzes } %>
</main>

View File

@ -4,23 +4,24 @@
%> %>
<%= render partial: 'shared/form_model_errors', locals: {obj: @user} %> <%= render partial: 'shared/form_model_errors', locals: {obj: @user} %>
<%= form_for @user, url: admin_profile_url, method: :post do |form| %> <%= form_for @user, url: admin_profile_url, method: :post do |form| %>
<div class="form-group"> <div>
<%= form.label :name, "Full Name" %> <%= form.label :name, "Full Name" %>
<%= form.text_field :name %> <%= form.text_field :name %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :email, "eMail" %> <%= form.label :email, "eMail" %>
<%= form.email_field :email %> <%= form.email_field :email %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :password, "New Password" %> <%= form.label :password, "New Password" %>
<%= form.password_field :password %> <%= form.password_field :password %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :password_confirmation, "New Password Confirmation" %> <%= form.label :password_confirmation, "New Password Confirmation" %>
<%= form.password_field :password_confirmation %> <%= form.password_field :password_confirmation %>
</div> </div>

View File

@ -3,7 +3,8 @@
content_for :title, "Profile - Skills Assessment Admin" content_for :title, "Profile - Skills Assessment Admin"
%> %>
<p>Name: <%= current_user.name %></p> <div>Name: <%= current_user.name %></div>
<p>email: <%= current_user.email %></p> <div>email: <%= current_user.email %></div>
<p>Role: <%= current_user.role %></p> <div>Role: <%= current_user.role %></div>
<%= link_to('Edit', admin_edit_profile_path, { class: 'btn' }) %>
<%= link_to('Edit', admin_edit_profile_path, { class: "" }) %>

View File

@ -9,10 +9,8 @@
</ul> </ul>
<% unless (disable ||= false) %> <% unless (disable ||= false) %>
<div class="form-group"> <div> Add option </div>
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div> <div>
<li style="display: none;">
<%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %> <%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
</li>
</div> </div>
<% end %> <% end %>

View File

@ -12,10 +12,8 @@
</ul> </ul>
<% unless (disable ||= false) %> <% unless (disable ||= false) %>
<div class="form-group"> <div>Add option</div>
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div> <div>
<li style="display: none;">
<%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %> <%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
</li>
</div> </div>
<% end %> <% end %>

View File

@ -1,45 +1,44 @@
<%= render partial: 'shared/form_model_errors', locals: { obj: question} %> <%= render partial: 'shared/form_model_errors', locals: { obj: question} %>
<%= form_for question, url: action do |form| %> <%= form_for question, url: action do |form| %>
<div class="form-group"> <div>
<%= form.label :quiz_id, 'Quiz' %> <%= form.label :quiz_id, 'Quiz' %>
<%= form.select :quiz_id, options_for_select(@quizzes.map{ |q| [q.name, q.id] }, question.quiz_id), include_blank: (@quizzes.size > 1) %> <%= form.select :quiz_id, options_for_select(@quizzes.map{ |q| [q.name, q.id] }, question.quiz_id), include_blank: (@quizzes.size > 1) %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :category, 'Category' %> <%= form.label :category, 'Category' %>
<%= form.text_field :category %> <%= form.text_field :category %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :sort, 'Sort' %> <%= form.label :sort, 'Sort' %>
<%= form.text_field :sort %> <%= form.text_field :sort %>
</div> </div>
<div class="form-group"> <div>
<%= form.check_box :active %> <%= form.check_box :active %>
<%= form.label :active, 'Active' %> <%= form.label :active, 'Active' %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :question, "Question" %> <%= form.label :question, "Question" %>
<%= form.text_area :question %> <%= form.text_area :question %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :attachment, "Attachment URL" %> <%= form.label :attachment, "Attachment URL" %>
<%= form.text_field :attachment %> <%= form.text_field :attachment %>
<% if @question.attachment.present? %> <%= image_tag @question.attachment if @question.attachment.present? %>
<p><%= image_tag @question.attachment %></p>
<% end %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :input_type, 'Input Type' %> <%= form.label :input_type, 'Input Type' %>
<%= form.select :input_type, question_type_options(question.input_type), { include_blank: false }, { data: { qid: question.id } } %> <%= form.select :input_type, question_type_options(question.input_type), { include_blank: false }, { data: { qid: question.id } } %>
</div> </div>
<div class="form-group" data-id="input-options-wrapper"> <div>
<%= fields_for @question do |fields| %> <%= fields_for @question do |fields| %>
<% partial = question.input_type.blank? ? 'admin/question/text' : "admin/question/#{question.input_type}" %> <% partial = question.input_type.blank? ? 'admin/question/text' : "admin/question/#{question.input_type}" %>
<%= render partial: partial, locals: {question: question, fields: fields } %> <%= render partial: partial, locals: {question: question, fields: fields } %>

View File

@ -9,10 +9,8 @@
</ul> </ul>
<% unless (disable ||= false) %> <% unless (disable ||= false) %>
<div class="form-group"> <div>Add option</div>
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div> <div>
<li style="display: none;">
<%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %> <%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
</li>
</div> </div>
<% end %> <% end %>

View File

@ -1,21 +1,17 @@
<strong>Radio Options</strong> <strong>Radio Options</strong>
<ul data-id="input_option_list"> <ul>
<% question.input_options.each do | option | %> <% question.input_options.each do | option | %>
<li> <li>
<%= text_field_tag 'question[multi_choice][]', option, { disabled: (disable ||= false), data: { last: option } } %> <%= text_field_tag 'question[multi_choice][]', option, { disabled: (disable ||= false), data: { last: option } } %>
</li> </li>
<% end %> <% end %>
</ul>
<ul>
<li>Other: <input type="text" disabled="disabled" /></li> <li>Other: <input type="text" disabled="disabled" /></li>
</ul> </ul>
<% unless (disable ||= false) %> <% unless (disable ||= false) %>
<div class="form-group"> <div>Add option</div>
<div class="btn tertiary-btn" data-id="input_option_adder"> Add option </div> <div>
<li style="display: none;">
<%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %> <%= text_field_tag 'question[multi_choice][]', nil, { disabled: (disable ||= false), data: { last: nil } } %>
</li>
</div> </div>
<% end %> <% end %>

View File

@ -15,7 +15,7 @@
<td><%= question.input_type %></td> <td><%= question.input_type %></td>
<td><%= question.category %></td> <td><%= question.category %></td>
<td><%= question.active unless question.active? %></td> <td><%= question.active unless question.active? %></td>
<td><%= link_to 'Edit', admin_edit_question_path(question.to_i), { class: 'btn tertiary-btn' } %></td> <td><%= link_to 'Edit', admin_edit_question_path(question.to_i), { class: "" } %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View File

@ -4,4 +4,5 @@
%> %>
<h1><%= @question.quiz.name %></h1> <h1><%= @question.quiz.name %></h1>
<%= render partial: 'form', locals: {question: @question, action: admin_update_question_path } %> <%= render partial: 'form', locals: {question: @question, action: admin_update_question_path } %>

View File

@ -7,5 +7,5 @@
<% quizzes.each do |quiz, questions| %> <% quizzes.each do |quiz, questions| %>
<h1><%= quiz %></h1> <h1><%= quiz %></h1>
<%= render partial: 'admin/question/table_list', locals: { questions: questions } %> <%= render partial: 'admin/question/table_list', locals: { questions: questions } %>
<%= link_to('Edit Quiz', admin_quiz_path(questions.first.quiz.to_i), { class: 'btn' }) %> <%= link_to('Edit Quiz', admin_quiz_path(questions.first.quiz.to_i), { class: "" }) %>
<% end %> <% end %>

View File

@ -3,39 +3,30 @@
content_for :title, "Question - Skills Assessment Admin" content_for :title, "Question - Skills Assessment Admin"
%> %>
<table cellspacing="0" cellpadding="0"> <h1><%= @question.quiz.name %></h1>
<tr>
<th>Category</th> <h2>Category</h2>
<td><%= @question.category %></td> <div><%= @question.category %></div>
</tr>
<tr> <h2>Type</h2>
<th>Type</th> <div><%= @question.input_type %></div>
<td><%= @question.input_type %></td>
</tr> <h2>Sort</h2>
<tr> <div><%= @question.sort %></div>
<th>Sort</th>
<td><%= @question.sort %></td> <div>
</tr>
<tr>
<th></th>
<td>
<%= check_box_tag 'question_active', nil, @question.active?, {disabled: true} %> <%= check_box_tag 'question_active', nil, @question.active?, {disabled: true} %>
<%= label_tag 'question_active', 'Active' %> <%= label_tag 'question_active', 'Active' %>
</td> </div>
</tr>
</table>
<strong>Question</strong>
<p><%= @question.question %></p>
<% if @question.attachment.present? %> <h2>Question</h2>
<p><%= image_tag @question.attachment %></p> <div><%= @question.question %></div>
<% end %> <div><%= image_tag @question.attachment if @question.attachment.present? %></div>
<%= fields_for @question do |fields| %> <%= fields_for @question do |fields| %>
<%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %> <%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %>
<% end %> <% end %>
<%= link_to('Edit', admin_edit_question_path(@question.to_i), { class: 'btn' }) %> <%= link_to('Edit', admin_edit_question_path(@question.to_i), { class: "" }) %>
<%= link_to('View Quiz', admin_quiz_path(@question.quiz_id), { class: "" }) %>
<%= link_to('View Quiz', admin_quiz_path(@question.quiz_id), { class: 'btn' }) %>

View File

@ -1,16 +1,16 @@
<%= render partial: 'shared/form_model_errors', locals: { obj: quiz} %> <%= render partial: 'shared/form_model_errors', locals: { obj: quiz} %>
<%= form_for quiz, url: action do |form| %> <%= form_for quiz, url: action do |form| %>
<div class="form-group"> <div>
<%= form.label :name, "Quiz Description" %> <%= form.label :name, "Quiz Description" %>
<%= form.text_field :name %> <%= form.text_field :name %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :dept, 'Department' %> <%= form.label :dept, 'Department' %>
<%= form.text_field :dept %> <%= form.text_field :dept %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :unit, 'Unit' %> <%= form.label :unit, 'Unit' %>
<%= form.text_field :unit %> <%= form.text_field :unit %>
</div> </div>

View File

@ -13,7 +13,7 @@
<td><%= quiz.dept %></td> <td><%= quiz.dept %></td>
<td><%= quiz.unit %></td> <td><%= quiz.unit %></td>
<td><%= quiz.questions.count %></td> <td><%= quiz.questions.count %></td>
<td><%= link_to 'edit', admin_edit_quiz_path(quiz.to_i), { class: 'btn tertiary-btn' } if policy(quiz).edit? %></td> <td><%= link_to 'edit', admin_edit_quiz_path(quiz.to_i), { class: "" } if policy(quiz).edit? %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View File

@ -1,5 +1,3 @@
<% <% content_for :section_title, "Edit: #{@quiz.name}" %>
content_for :section_title, "Edit: #{@quiz.name}"
%>
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %> <%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>

View File

@ -4,4 +4,4 @@
%> %>
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %> <%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %> <%= link_to('New Quiz', admin_new_quiz_path, { class: "" }) %>

View File

@ -3,10 +3,10 @@
content_for :title, "Quiz - Skills Assessment Admin" content_for :title, "Quiz - Skills Assessment Admin"
%> %>
<p><%= @quiz.name %></p> <div><%= @quiz.name %></div>
<p><%= @quiz.dept %></p> <div><%= @quiz.dept %></div>
<p><%= @quiz.unit %></p> <div><%= @quiz.unit %></div>
<%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: 'btn' }) %> <%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: "" }) %>
<%= render partial: 'admin/question/table_list', locals: { questions: @quiz.questions, disable: true } %> <%= render partial: 'admin/question/table_list', locals: { questions: @quiz.questions, disable: true } %>
<%= link_to('New Question', admin_new_question_path, { class: 'btn' }) %> <%= link_to('New Question', admin_new_question_path, { class: "" }) %>

View File

@ -1,23 +1,20 @@
<div class="comment-message"> <div>
<%= comment.message %> <%= comment.message %>
<% if policy(comment).update? %> <% if policy(comment).update? %>
<label class="comment-edit-btn" for="comment-<%= comment.id %>">edit</label> <label class="" for="comment-<%= comment.id %>">edit</label>
<% end %> <% end %>
<% if comment.edits? %> <% if comment.edits? %>
<div class="comment-edit-stamp">Updated <%= time_ago_in_words(comment.updated_at) %> ago</div> <div>Updated <%= time_ago_in_words(comment.updated_at) %> ago</div>
<% else %> <% else %>
<div class="comment-edit-stamp"><%= time_ago_in_words(comment.created_at) %> ago</div> <div><%= time_ago_in_words(comment.created_at) %> ago</div>
<% end %> <% end %>
</div> </div>
<div class="comment-author"><%= comment.user.name %></div> <div><%= comment.user.name %></div>
<% if policy(comment).update? %> <% if policy(comment).update? %>
<input type="checkbox" id="comment-<%= comment.id %>"> <input type="checkbox" id="comment-<%= comment.id %>">
<div class="comment-edit-form">
<%= render partial: 'comment_form', locals: {comment: comment, test_hash: comment.test_hash } %> <%= render partial: 'comment_form', locals: {comment: comment, test_hash: comment.test_hash } %>
</div>
<% end %> <% end %>

View File

@ -1,7 +1,7 @@
<% if comment.id.nil? %> <% if comment.id.nil? %>
<%= form_for comment, url: admin_create_comment_path(test_hash: test_hash), method: :post do |form| %> <%= form_for comment, url: admin_create_comment_path(test_hash: test_hash), method: :post do |form| %>
<div class="form-group"> <div>
<%= form.label :message, "New Comment" %> <%= form.label :message, "New Comment" %>
<%= form.text_area :message %> <%= form.text_area :message %>
</div> </div>
@ -12,7 +12,7 @@
<% else %> <% else %>
<%= form_for comment, url: admin_update_comment_path(test_hash: test_hash, id: comment.id), method: :post do |form| %> <%= form_for comment, url: admin_update_comment_path(test_hash: test_hash, id: comment.id), method: :post do |form| %>
<div class="form-group"> <div>
<%= form.label :message, "Update Comment" %> <%= form.label :message, "Update Comment" %>
<%= form.text_area :message %> <%= form.text_area :message %>
</div> </div>

View File

@ -1,7 +1,5 @@
<% # TODO: This should be extracted into a decorator, or something. It is only a quick hack solution. %>
<% if current_user.acts_as_reviewer? %> <% if current_user.acts_as_reviewer? %>
<div class="review_meta__votes" data-id="vote-count"> <div data-id="vote-count">
<strong>Votes: </strong> <strong>Votes: </strong>
<% if @candidate.pending? && current_user.commented_on?(@candidate.test_hash) %> <% if @candidate.pending? && current_user.commented_on?(@candidate.test_hash) %>
@ -27,7 +25,7 @@
<% end %> <% end %>
<% if current_user.acts_as_manager? %> <% if current_user.acts_as_manager? %>
<div class="review_meta__vetos"> <div>
<%= form_tag admin_interview_path(test_hash: @candidate.test_hash) do %> <%= form_tag admin_interview_path(test_hash: @candidate.test_hash) do %>
<strong>Interview: </strong> <strong>Interview: </strong>
@ -37,7 +35,7 @@
<%= radio_button_tag :review_status, :declined, checked = @candidate.declined? %> <%= radio_button_tag :review_status, :declined, checked = @candidate.declined? %>
<%= label_tag :review_status_declined, "No" %> <%= label_tag :review_status_declined, "No" %>
<div class="review-status-comments"> <div>
<span>Review comments for recruiter</span> <span>Review comments for recruiter</span>
<%= text_area_tag :review_comments, @candidate.review_comments %> <%= text_area_tag :review_comments, @candidate.review_comments %>
<%= submit_tag 'Send Request' %> <%= submit_tag 'Send Request' %>

View File

@ -2,7 +2,7 @@
content_for :section_title, "Completed Tests" content_for :section_title, "Completed Tests"
content_for :title, "Quiz Results - Skills Assessment Admin" content_for :title, "Quiz Results - Skills Assessment Admin"
%> %>
<main class="summary_tpl">
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr> <tr>
<th><%= sortable "test_hash", "Test ID" %></th> <th><%= sortable "test_hash", "Test ID" %></th>
@ -24,5 +24,5 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= paginate @candidates %> <%= paginate @candidates %>
</main>

View File

@ -2,11 +2,9 @@
content_for :title, "Quiz Review - Skills Assessment Admin" content_for :title, "Quiz Review - Skills Assessment Admin"
%> %>
<div class="summary_tpl"> <div>
<div class="admin-review"> <h1>Quiz Review</h1>
<h2 class="prft-heading">Quiz Review</h2>
<div class="review_meta">
<div> <div>
<% unless @candidate.pending? %> <% unless @candidate.pending? %>
<strong>Name:</strong> <%= @candidate.name %><br /> <strong>Name:</strong> <%= @candidate.name %><br />
@ -18,44 +16,29 @@
<strong>Skill Needs:</strong> <%= @candidate.skill_needs %><br /> <strong>Skill Needs:</strong> <%= @candidate.skill_needs %><br />
<strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br /> <strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br />
</div> </div>
</div>
<% @quiz.each do |question| %> <% @quiz.each do |question| %>
<%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %> <%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %>
<article class="answer-sec <%= question.input_type %>-type" data-qid="<%= question.question_id %>"> <h2><%= question.question %></h2>
<div class="question-heading"> <%= image_tag question.attachment if question.attachment.present? %>
<div class="question-title">
<h3><%= question.question %></h3>
</div>
</div>
<div class="answer-container"> <fieldset disabled>
<% if question.attachment.present? %>
<%= image_tag question.attachment %>
<% end %>
<fieldset disabled class="answer-block">
<%= render partial: "quiz/#{question.input_type}", locals: {question: question, answer: question.answer, form: form} %> <%= render partial: "quiz/#{question.input_type}", locals: {question: question, answer: question.answer, form: form} %>
</fieldset> </fieldset>
</div>
</article>
<% end #form_tag %>
<% end #questions loop %>
<%= link_to(admin_results_path, { class: 'secondary-btn' }) do %>
<button>Back to list</button>
<% end %> <% end %>
<% end %>
<%= link_to("Back to list", admin_results_path, { class: "" }) %>
</div> </div>
<div class="review-comments">
<div> <div>
<h2 class="prft-heading">Voting</h2> <div>
<div class="review_meta"> <h1>Voting</h1>
<div><%= render partial: 'voting' %></div> <div><%= render partial: 'voting' %></div>
</div> </div>
</div>
<div> <div>
<h2 id="comment-header" class="prft-heading">Comments</h2> <h1 id="comment-header">Comments</h1>
<% if policy(QuizComment).new? %> <% if policy(QuizComment).new? %>
<%= render partial: 'comment_form', locals: {comment: @comment, test_hash: @candidate.test_hash } %> <%= render partial: 'comment_form', locals: {comment: @comment, test_hash: @candidate.test_hash } %>
<% end %> <% end %>
@ -63,4 +46,3 @@
<a href="#comment-header">Back to top</a> <a href="#comment-header">Back to top</a>
</div> </div>
</div> </div>
</div>

View File

@ -1,33 +1,37 @@
<%= render partial: 'shared/form_model_errors', locals: { obj: user} %> <%= render partial: 'shared/form_model_errors', locals: { obj: user} %>
<%= form_for user, url: action do |form| %> <%= form_for user, url: action do |form| %>
<div class="form-group"> <div>
<%= form.label :name, "Full Name" %> <%= form.label :name, "Full Name" %>
<%= form.text_field :name %> <%= form.text_field :name %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :email, "eMail" %> <%= form.label :email, "eMail" %>
<%= form.email_field :email %> <%= form.email_field :email %>
</div> </div>
<div class="form-group"> <div>
<%= form.label :role, "Role" %> <%= form.label :role, "Role" %>
<%= form.select :role, admin_role_options(user.role), include_blank: false %> <%= form.select :role, admin_role_options(user.role), include_blank: false %>
</div> </div>
<div class="form-group"> <div>
<div><strong>Quiz Review List</strong></div> <div><strong>Quiz Review List</strong></div>
<p> <p>
Quizzes this user should be reviewing the results of.<br /> Quizzes this user should be reviewing the results of.<br />
Admins and Recruiters should not have any checked, unless they are expected Admins and Recruiters should not have any checked, unless they are expected
to participate in the technical review for that quiz. to participate in the technical review for that quiz.
</p> </p>
<%= form.collection_check_boxes(:quiz_ids, Quiz.all, :id, :name, {}, {class: 'checkbox'}) do | quiz | %>
<div class="form-group-multiples"> <ul>
<%= form.collection_check_boxes(:quiz_ids, Quiz.all, :id, :name, {}, {class: ""}) do | quiz | %>
<li>
<%= quiz.check_box( checked: user.quizzes.include?(quiz.object)) %> <%= quiz.check_box( checked: user.quizzes.include?(quiz.object)) %>
<%= quiz.label %> <%= quiz.label %>
</div> </li>
<% end %> <% end %>
</ul>
</div> </div>
<%= form.submit %> <%= form.submit %>

View File

@ -11,7 +11,7 @@
<td><%= link_to user.name, admin_user_path(user.to_i) %></td> <td><%= link_to user.name, admin_user_path(user.to_i) %></td>
<td><%= mail_to(user.email) %></td> <td><%= mail_to(user.email) %></td>
<td><%= user.role %></td> <td><%= user.role %></td>
<td><%= link_to 'edit', admin_edit_user_path(user.to_i), { class: 'btn tertiary-btn' } if policy(user).edit? %></td> <td><%= link_to 'edit', admin_edit_user_path(user.to_i), { class: "" } if policy(user).edit? %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View File

@ -1,5 +1,3 @@
<% <% content_for :section_title, "Edit: #{@user.name}" %>
content_for :section_title, "Edit: #{@user.name}"
%>
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %> <%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>

View File

@ -1,7 +1,7 @@
<% <% content_for :section_title, "Users" %>
content_for :section_title, "Users"
%>
<h1>Users</h1> <h1>Users</h1>
<%= render partial: 'admin/user/table_list', locals: { users: @users } %> <%= render partial: 'admin/user/table_list', locals: { users: @users } %>
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) if policy(User).create? %>
<%= link_to('New User', admin_new_user_path, { class: "" }) if policy(User).create? %>

View File

@ -1,5 +1,3 @@
<% <% content_for :section_title, "New User" %>
content_for :section_title, "New User"
%>
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %> <%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>

View File

@ -1,16 +1,14 @@
<% <% content_for :section_title, "#{@user.name}" %>
content_for :section_title, "#{@user.name}"
%>
<p><%= @user.name %></p> <div><%= @user.name %></div>
<p><%= mail_to(@user.email) %></p> <div><%= mail_to(@user.email) %></div>
<p><%= @user.role %></p> <div><%= @user.role %></div>
<p>Quizzes:</p> <div>Quizzes:</div>
<ul> <ul>
<% @user.quizzes.each do |quiz| %> <% @user.quizzes.each do |quiz| %>
<li><%= quiz.name %></li> <li><%= quiz.name %></li>
<% end %> <% end %>
</ul> </ul>
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %> <%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: "" }) %>

View File

@ -1,20 +1,14 @@
<% content_for :title, "Skills Assessment" %> <% content_for :title, "Skills Assessment" %>
<main class="intro_tpl"> <h1>Let's Get Started</h1>
<h1 class="prft-heading">Let's Get Started</h1>
<p> <p>Hey there! Give us your Test ID, and we'll get you started.</p>
Hey there! Give us your Test ID, and we'll get you started.
</p>
<%= form_tag(validate_candidate_path) do %> <%= form_tag(validate_candidate_path) do %>
<div class="form-group"> <%= render partial: "shared/generic_flash" %>
<label for="userid">What's your Test ID?</label>
<label for="test_id">What's your Test ID?</label>
<input type="text" id="test_id" name="test_id" required /> <input type="text" id="test_id" name="test_id" required />
<% if flash[:error].present? %>
<div class="error"><%= flash[:error] %></div>
<% end %>
</div>
<button type="submit">Log in</button> <button type="submit">Log in</button>
<% end %> <% end %>
</main>

View File

@ -1,11 +1,10 @@
<% content_for :title, "Skills Assessment" %> <% content_for :title, "Skills Assessment" %>
<main class="intro_tpl"> <h1>Oops!</h1>
<h1 class="prft-heading">Oops!</h1>
<p> <p>
Looks like you hit the browser's Back button. You can't go backwards in the test, Looks like you hit the browser's Back button. You can't go backwards in the test,
but you'll have a chance at the end to review your answers and make changes. but you'll have a chance at the end to review your answers and make changes.
</p> </p>
<a href="<%= question_path %>"><button>Continue Test</button></a> <%= link_to "Continue Test", question_path, {class: ""} %>
</main>

View File

@ -1,11 +1,8 @@
<% content_for :title, "Saved! - Skills Assessment" %> <% content_for :title, "Saved! - Skills Assessment" %>
<main class="styleguide_tpl">
<p> <p>
Your test results have been saved. You can visit again later with your Test ID to complete Your test results have been saved. You can visit again later with your Test ID to complete
the test starting from where you left off. the test starting from where you left off.
</p> </p>
<div class="button-wrap"> <%= link_to "Return to test", question_path, {class: ""} %>
<a class="btn primary-btn" href="<%= question_path %>">Return to test</a>
</div>
</main>

View File

@ -1,8 +1,8 @@
<% content_for :title, "Thank You - Skills Assessment" %> <% content_for :title, "Thank You - Skills Assessment" %>
<main class="styleguide_tpl">
<h1>Thank you!</h1> <h1>Thank you!</h1>
<p> <p>
Your answers have been submitted. We will review and your recruiter Your answers have been submitted.
will be in touch. We will review and your recruiter will be in touch.
</p> </p>
</main>

View File

@ -1,11 +1,12 @@
<% content_for :title, "Skills Assessment" %> <% content_for :title, "Skills Assessment" %>
<main class="intro_tpl"> <h1>Welcome!</h1>
<h1 class="prft-heading">Welcome!</h1>
<p> <p>
This is a skills assessment test. It's the first step in the process of interviewing This is a skills assessment test. It's the first step in the process of interviewing
for a Front-End Development position with Perficient Digital. for a Front-End Development position with Perficient Digital.
</p> </p>
<p> <p>
The questions will test your knowledge in the areas of HTML, CSS, and JavaScript. The questions will test your knowledge in the areas of HTML, CSS, and JavaScript.
Please note that you can <strong>only move forward through the test</strong>, not back, Please note that you can <strong>only move forward through the test</strong>, not back,
@ -14,13 +15,11 @@
answers if need be. At any time, you may save your progress and log back in to continue answers if need be. At any time, you may save your progress and log back in to continue
taking the test from where you left off. taking the test from where you left off.
</p> </p>
<p> <p>
Please answer to the best of your ability&mdash;it's totally okay to say Please answer to the best of your ability&mdash;it's totally okay to say
"I don't know"!&mdash;and above all, relax and have fun! Once you submit your "I don't know"!&mdash;and above all, relax and have fun! Once you submit your
answers, we will review your assessment and your recruiter will be in touch. answers, we will review your assessment and your recruiter will be in touch.
</p> </p>
<div class="button-wrap"> <%= link_to "Begin", question_path, {class: ""} %>
<%= link_to "Begin", question_path, {class: 'btn'} %>
</div>
</main>

View File

@ -1,16 +1,7 @@
<% content_for :title, "Skills Assessment" %> <% content_for :title, "Skills Assessment" %>
<main class="intro_tpl"> <h1>Welcome Back</h1>
<h1 class="prft-heading">Welcome Back</h1>
<p>Hello, <%= current_candidate.name %>!</p> <p>Hello, <%= current_candidate.name %>!</p>
<p>We are ready to pick up where you left off.</p>
<p> <%= link_to "Return to Test", question_path, { class: "" } %>
We are ready to pick up where you left off.
</p>
<div class="btn-return">
<%= link_to "Return to Test", question_path, { class: "btn primary-btn" } %>
</div>
</main>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="no-js"> <html lang="en">
<head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -10,43 +11,29 @@
<!--[if ! lte IE 8]><!--> <!--[if ! lte IE 8]><!-->
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<!--<![endif]--> <!--<![endif]-->
<!--[if lt IE 9]>
<%= javascript_include_tag 'ie9' %>
<![endif]-->
</head> </head>
<body>
<div class="layout">
<header class="no-progressbar admin"> <body>
<%= render partial: "admin/nav" if current_user %> <header>
<div class="page-title slash-left">
<% if content_for?(:section_title) %> <% if content_for?(:section_title) %>
<div><%= yield(:section_title) %></div> <div><%= yield(:section_title) %></div>
<% else %> <% else %>
<div>Skills Assessment Admin</div> <div>Skills Assessment Admin</div>
<% end %> <% end %>
</div>
</header> </header>
<main class="<%= content_for?(:main_class) ? yield(:main_class) : "admin_tpl" %>"> <%= render partial: "admin/nav" if current_user %>
<%= render partial: "shared/generic_flash" %>
<%= yield %>
</main>
</div> <%= render partial: "shared/generic_flash" %>
<%= yield %>
<footer> <footer>
<div class="footer_title">&nbsp;</div> <div><%= image_tag("perficientdigital.png", alt:"Perficient Digital") %></div>
<div class="pd_logo"><%= image_tag("perficientdigital.png", alt:"Perficient Digital") %></div>
<div class="footer_yellow-bar slantleft slantright">&nbsp;</div>
</footer> </footer>
<!--[if ! lte IE 8]><!--> <!--[if ! lte IE 8]><!-->
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'admin', 'data-turbolinks-track': 'reload' %>
<%= yield :custom_javascipt %> <%= yield :custom_javascipt %>
<!--<![endif]--> <!--<![endif]-->
</body> </body>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="no-js"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -11,49 +11,39 @@
<!--[if ! lte IE 8]><!--> <!--[if ! lte IE 8]><!-->
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<!--<![endif]--> <!--<![endif]-->
<!--[if lt IE 9]>
<%= javascript_include_tag 'ie9' %>
<![endif]-->
</head> </head>
<body>
<div class="layout">
<header <%= "class=no-progressbar" unless content_for?(:progress) %>> <body>
<div class="page-title slash-left"> <header>
<% if content_for?(:category) %> <% if content_for?(:category) %>
<div>Section: <%= yield(:category) %></div> <div>Section: <%= yield(:category) %></div>
<% else %> <% else %>
<div>Skills Assessment Test</div> <div>Skills Assessment Test</div>
<% end %> <% end %>
</div>
</header> </header>
<main>
<%= yield %> <%= yield %>
</main>
<% if content_for?(:progress) %> <% if content_for?(:progress) %>
<div class="progress ignore-margin"> <aside role="progressbar"
<div class="progress-bar" role="progressbar" aria-valuenow="<%= yield :progress %>" style="width: <%= yield :progress %>%"
aria-valuemin="0" aria-valuemax="100" style="width: <%= yield :progress %>%"> aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="<%= yield :progress %>">
<span><%= yield :progress %>%</span> <span><%= yield :progress %>%</span>
</div> </aside>
</div>
<% end %> <% end %>
</div> <footer role="contentinfo">
<div><%= yield(:footer_title) %></div>
<footer> <div><%= image_tag("perficientdigital.png", alt:"Perficient Digital") %></div>
<div class="footer_title"><h2><%= yield(:footer_title) %></h2></div>
<div class="pd_logo"><%= image_tag("perficientdigital.png", alt:"Perficient Digital") %></div>
<div class="footer_yellow-bar slantleft slantright">&nbsp;</div>
</footer> </footer>
<!--[if ! lte IE 8]><!--> <!--[if ! lte IE 8]><!-->
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= yield :custom_javascipt %> <%= yield :custom_javascipt %>
<!--<![endif]--> <!--<![endif]-->
</body> </body>
</html> </html>

View File

@ -1,15 +1,14 @@
<% answers = Array(question.answer) %> <% answers = Array(question.answer) %>
<%= form.collection_check_boxes(:answer_array, question.input_options, :to_s, :to_s, {}, {class: 'checkbox'}) do | option | %> <%= form.collection_check_boxes(:answer_array, question.input_options, :to_s, :to_s, {}, {class: ""}) do | option | %>
<% <%
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}" option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
checked = answers.include?(option.value) ? 'checked' : '' checked = answers.include?(option.value) ? 'checked' : ''
%> %>
<div class="form-group-multiples"> <div class="">
<%= option.check_box( id: option_id, checked: checked, data: { last: checked } ) %> <%= option.check_box( id: option_id, checked: checked, data: { last: checked } ) %>
<%= option.label(for: option_id) %> <%= option.label(for: option_id) %>
</div> </div>
<% end %> <% end %>
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %> <%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>

View File

@ -4,20 +4,20 @@
question.input_options.each do | option | question.input_options.each do | option |
option_id = "#{option.parameterize}_#{question.to_i}" option_id = "#{option.parameterize}_#{question.to_i}"
checkbox_html = {class: 'checkbox', id: option_id, data: { last: answers.include?(option) ? 'checked' : '' } } checkbox_html = {class: "", id: option_id, data: { last: answers.include?(option) ? 'checked' : '' } }
%> %>
<div class="form-group-multiples"> <div class="">
<%= check_box_tag('answer[answer_hash][options][]', option, answers.include?(option), checkbox_html) %> <%= check_box_tag('answer[answer_hash][options][]', option, answers.include?(option), checkbox_html) %>
<%= label_tag(option_id, option) %> <%= label_tag(option_id, option) %>
</div> </div>
<% <%
end %> end %>
<div class="form-group-multiples"> <div class="">
<% <%
option_id = "other_#{question.to_i}" option_id = "other_#{question.to_i}"
checkbox_html = {class: 'checkbox', id: option_id, data: { last: answers.include?('other') ? 'checked' : '' } } checkbox_html = {class: "", id: option_id, data: { last: answers.include?('other') ? 'checked' : '' } }
text_html = {class: 'input-other', id: "text_#{option_id}", data: { last: other_value }} text_html = {class: "", id: "text_#{option_id}", data: { last: other_value }}
%> %>
<%= check_box_tag('answer[answer_hash][options][]', 'other', answers.include?('other'), checkbox_html) %> <%= check_box_tag('answer[answer_hash][options][]', 'other', answers.include?('other'), checkbox_html) %>
<%= label_tag(option_id, 'Other') %> <%= label_tag(option_id, 'Other') %>

View File

@ -1,11 +1,12 @@
<% answer_string = answer.try(:answer) || answer %> <% answer_string = answer.try(:answer) || answer %>
<%= form.collection_radio_buttons(:answer, question.input_options, :to_s, :to_s, {}, {class: 'radio'}) do | option | %> <%= form.collection_radio_buttons(:answer, question.input_options, :to_s, :to_s, {}, {class: ""}) do | option | %>
<% <%
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}" option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
checked = answer_string == option.value ? 'checked' : '' checked = answer_string == option.value ? 'checked' : ''
%> %>
<div class="form-group-multiples"> <div class="">
<%= option.radio_button( id: option_id, checked: checked, data: { last: checked } ) %> <%= option.radio_button( id: option_id, checked: checked, data: { last: checked } ) %>
<%= option.label(for: option_id) %> <%= option.label(for: option_id) %>
</div> </div>

View File

@ -4,20 +4,20 @@
question.input_options.each do | option | question.input_options.each do | option |
option_id = "#{option.parameterize}_#{question.to_i}" option_id = "#{option.parameterize}_#{question.to_i}"
radio_html = {class: 'radio', id: option_id, data: {last: (answer_string == option) ? 'checked' : '' }} radio_html = {class: "", id: option_id, data: {last: (answer_string == option) ? 'checked' : '' }}
%> %>
<div class="form-group-multiples"> <div class="">
<%= radio_button_tag('answer[answer_hash][options][]', option, (answer_string == option), radio_html) %> <%= radio_button_tag('answer[answer_hash][options][]', option, (answer_string == option), radio_html) %>
<%= label_tag(option_id, option) %> <%= label_tag(option_id, option) %>
</div> </div>
<% <%
end %> end %>
<div class="form-group-multiples"> <div class="">
<% <%
option_id = "other_#{question.to_i}" option_id = "other_#{question.to_i}"
radio_html = {class: 'radio', id: option_id, data: { last: answer_string }} radio_html = {class: "", id: option_id, data: { last: answer_string }}
text_html = {class: 'input-other', id: "text_#{option_id}", data: { last: other_value }} text_html = {class: "", id: "text_#{option_id}", data: { last: other_value }}
%> %>
<%= radio_button_tag('answer[answer_hash][options][]', 'other', (answer_string == 'other'), radio_html) %> <%= radio_button_tag('answer[answer_hash][options][]', 'other', (answer_string == 'other'), radio_html) %>
<%= label_tag option_id, 'Other' %> <%= label_tag option_id, 'Other' %>

View File

@ -3,6 +3,6 @@
<label for="answer_answer">Enter answer here</label> <label for="answer_answer">Enter answer here</label>
<%= text_area_tag 'answer[answer]', answer_string, {rows: 10, data: { last: answer_string } } %> <%= text_area_tag 'answer[answer]', answer_string, {rows: 10, data: { last: answer_string } } %>
<div class="chars <%= params[:action] == 'summary' ? 'hidden' : '' %>">Characters remaining: <span></span></div> <div class="<%= params[:action] == 'summary' ? 'hidden' : '' %>">Characters remaining: <span></span></div>
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %> <%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>

View File

@ -6,34 +6,19 @@
%> %>
<%= form_for(@answer, url: post_answer_path(@answer.id), html:{method: :post, id: 'answer-form', data: {qid: @question.question_id}}) do |form| %> <%= form_for(@answer, url: post_answer_path(@answer.id), html:{method: :post, id: 'answer-form', data: {qid: @question.question_id}}) do |form| %>
<main class="answer-sec <%= @question.input_type %>-type questions_tpl" data-qid="<%= @question.question_id %>">
<h2 class="question-text"><%= @question.question %></h2>
<% if @question.attachment.present? %> <div><%= @question.question %></div>
<%= image_tag @question.attachment %> <%= image_tag @question.attachment if @question.attachment.present? %>
<% end %>
<div class="content-well">
<%= hidden_field_tag 'answer[question_id]', @question.question_id %>
<%= hidden_field_tag 'answer[answer_id]', @question.answer_id %>
<%= render partial: @question.input_type, locals: {question: @question, form: form, answer: @answer } %> <%= render partial: @question.input_type, locals: {question: @question, form: form, answer: @answer } %>
</div>
<% if @status.on_summary %> <% if @status.on_summary %>
<button type="submit" name="submit">Save and return to summary</button>
<div class="btn-container-summary button-wrap">
<input type="submit" name="submit" value="Save and return to summary">
</div>
<% else %> <% else %>
<button type="submit" name="save">Save</button>
<div class="btn-container-left"> <button type="submit" name="submit">Next &rarr;</button>
<input type="submit" class="secondary-btn" name="save" value="Save">
</div>
<div class="btn-container-right">
<input type="submit" class="tertiary-btn arrow-btn-right" name="submit" value="Next &rarr;">
</div>
<% end %> <% end %>
</main>
<%= hidden_field_tag 'answer[question_id]', @question.question_id %>
<%= hidden_field_tag 'answer[answer_id]', @question.answer_id %>
<% end %> <% end %>

View File

@ -7,8 +7,7 @@
end end
%> %>
<main class="summary_tpl"> <h1>Almost done!</h1>
<h2 class="prft-heading">Almost done!</h2>
<p> <p>
Now's the time to review your answers and go back and change any, if you need to. Now's the time to review your answers and go back and change any, if you need to.
Once you're done, hit the button at the bottom of the page to submit your answers. Once you're done, hit the button at the bottom of the page to submit your answers.
@ -17,39 +16,31 @@
<hr> <hr>
<% @quiz.each do |question| %> <% @quiz.each do |question| %>
<%= form_for(:answer, remote: true, url: post_answer_path(answer_id: question.answer_id), html:{class: 'summary-form'}) do |form| %> <%= form_for(:answer, remote: true, url: post_answer_path(answer_id: question.answer_id), html:{class: ""}) do |form| %>
<article class="answer-sec"> <h2><%= question.question %></h2>
<div class="question-heading">
<div class="question-title"> <div>
<h3><%= question.question %></h3> <%= link_to('Edit', question_path(question.question_id)) %>
</div> <button>Save</button>
<div class="answer-buttons"> <button>Cancel</button>
<a href="<%= question_path(question.question_id) %>" class="tertiary-btn button-edit">Edit</a>
<button class="tertiary-btn button-save">Save</button>
<button class="tertiary-btn button-cancel">Cancel</button>
</div>
</div> </div>
<div class="answer-container"> <%= image_tag question.attachment if question.attachment.present? %>
<% if question.attachment.present? %>
<%= image_tag question.attachment %> <fieldset disabled>
<% end %> <%= render partial: question.input_type, locals: {question: question, form: form, answer: question.answer} %>
</fieldset>
<fieldset disabled class="answer-block">
<%= hidden_field_tag 'answer[question_id]', question.question_id %> <%= hidden_field_tag 'answer[question_id]', question.question_id %>
<%= hidden_field_tag 'answer[answer_id]', question.answer_id %> <%= hidden_field_tag 'answer[answer_id]', question.answer_id %>
<%= hidden_field_tag 'submit', true %> <%= hidden_field_tag 'submit', true %>
<%= render partial: question.input_type, locals: {question: question, form: form, answer: question.answer} %>
</fieldset>
</div>
</article>
<% end %> <% end %>
<% end %> <% end %>
<%= form_tag post_summary_path, id: 'summary-submit', class: "btn-center" do %>
<%= form_tag post_summary_path, id: 'summary-submit', class: "" do %>
<% unless @status.can_submit %> <% unless @status.can_submit %>
<div class="error">Sorry, you must answer all questions before you can submit.</div> <div class="error">Sorry, you must answer all questions before you can submit.</div>
<% end %> <% end %>
<%= submit_tag "Submit all answers", {class: 'submit-button', disabled: !@status.can_submit } %> <%= submit_tag "Submit all answers", {class: "", disabled: !@status.can_submit } %>
<% end %> <% end %>
</main>

View File

@ -1,10 +1,8 @@
<% if flash[:error].present? %> <% if flash[:error].present? %>
<div class="error"> <div class="error">
<%= flash[:error] %> <%= flash[:error] %>
<p>
<% obj.errors.messages.each do |k,v| %> <% obj.errors.messages.each do |k,v| %>
<%= "#{k.to_s} #{v.join(' and ')}" %><br /> <div><%= "#{k.to_s} #{v.join(' and ')}" %></div>
<% end %> <% end %>
</p>
</div> </div>
<% end %> <% end %>

View File

@ -64,7 +64,7 @@ module Admin
assert_redirected_to admin_question_path(question.to_i) assert_redirected_to admin_question_path(question.to_i)
get admin_question_path question.to_i get admin_question_path question.to_i
assert_select 'p', 'foo bar baz' assert_select 'div', 'foo bar baz'
end end
test "should post attachment" do test "should post attachment" do

View File

@ -40,7 +40,7 @@ module Admin
quiz = quizzes :fed quiz = quizzes :fed
get admin_quiz_url quiz.to_i get admin_quiz_url quiz.to_i
assert_response :success assert_response :success
assert_select 'p', quiz.dept assert_select 'div', quiz.dept
end end
test "should get edit" do test "should get edit" do
@ -56,7 +56,7 @@ module Admin
assert_redirected_to admin_quiz_path(quiz.to_i) assert_redirected_to admin_quiz_path(quiz.to_i)
get admin_quiz_path quiz.to_i get admin_quiz_path quiz.to_i
assert_select 'p', 'another' assert_select 'div', 'another'
end end
test "should fail to update quiz" do test "should fail to update quiz" do

View File

@ -44,7 +44,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 'p', user.name assert_select 'div', user.name
end end
test "should get edit" do test "should get edit" do
@ -62,7 +62,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 'p', 'new name' assert_select 'div', 'new name'
end end
test "should fail to update user" do test "should fail to update user" do

View File

@ -36,14 +36,14 @@ class CandidateControllerTest < ActionDispatch::IntegrationTest
auth_candidate candidates(:martha) auth_candidate candidates(:martha)
get welcome_path get welcome_path
assert_select '.prft-heading', "Welcome!" assert_select 'h1', "Welcome!"
end end
test "should display welcome back view" do test "should display welcome back view" do
auth_candidate candidates(:roy) auth_candidate candidates(:roy)
get welcome_path get welcome_path
assert_select '.prft-heading', "Welcome Back" assert_select 'h1', "Welcome Back"
end end
test "should redirect to thankyou when completed" do test "should redirect to thankyou when completed" do

View File

@ -7,7 +7,7 @@ class QuestionAttachmentsTest < ActionDispatch::IntegrationTest
get question_path questions(:fed6) get question_path questions(:fed6)
assert_response :success assert_response :success
assert_select '.question-text', questions(:fed6).question assert_select 'div', questions(:fed6).question
assert_select "img[src=\"#{questions(:fed6).attachment}\"]" assert_select "img[src=\"#{questions(:fed6).attachment}\"]"
end end

View File

@ -7,7 +7,7 @@ class QuestionFlowTest < ActionDispatch::IntegrationTest
get question_path get question_path
assert_response :success assert_response :success
assert_select '.question-text', questions(:fed1).question assert_select 'div', questions(:fed1).question
end end
test "should load the summary" do test "should load the summary" do
@ -15,7 +15,7 @@ class QuestionFlowTest < ActionDispatch::IntegrationTest
get summary_path get summary_path
assert_response :success assert_response :success
assert_select '.prft-heading', 'Almost done!' assert_select 'h1', 'Almost done!'
end end
test "can load specific question from summary" do test "can load specific question from summary" do
@ -24,7 +24,7 @@ class QuestionFlowTest < ActionDispatch::IntegrationTest
get question_path(question.id) get question_path(question.id)
assert_response :success assert_response :success
assert_select '.question-text', question.question assert_select 'div', question.question
end end
test 'juan should be on summary with 80% complete' do test 'juan should be on summary with 80% complete' do
@ -32,6 +32,6 @@ class QuestionFlowTest < ActionDispatch::IntegrationTest
get summary_path get summary_path
assert_response :success assert_response :success
assert_select '.progress span', '80%' assert_select 'aside span', '80%'
end end
end end

View File

@ -8,7 +8,7 @@ class QuestionLiveCoderTest < ActionDispatch::IntegrationTest
get question_path(question.id) get question_path(question.id)
assert_response :success assert_response :success
assert_select '.question-text', question.question assert_select 'div', question.question
end end
test "should load seed data into live coder" do test "should load seed data into live coder" do