From 17d62131c91616868c4f9342353c1dc86d9251a7 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Fri, 10 Feb 2017 15:46:43 -0600 Subject: [PATCH] scratched in view partials --- .../stylesheets/molecules/_admin_review.scss | 25 +++++- app/controllers/admin/result_controller.rb | 2 + app/views/admin/result/_comment.html.erb | 2 + app/views/admin/result/_comment_form.html.erb | 10 +++ app/views/admin/result/view.html.erb | 76 ++++++++++--------- 5 files changed, 80 insertions(+), 35 deletions(-) create mode 100644 app/views/admin/result/_comment.html.erb create mode 100644 app/views/admin/result/_comment_form.html.erb diff --git a/app/assets/stylesheets/molecules/_admin_review.scss b/app/assets/stylesheets/molecules/_admin_review.scss index 586367d..8cbab59 100644 --- a/app/assets/stylesheets/molecules/_admin_review.scss +++ b/app/assets/stylesheets/molecules/_admin_review.scss @@ -1,12 +1,14 @@ .admin-review { counter-reset: question; + float: left; + width: 66%; form { margin-left: 2.3em; position: relative; &::before { - content: counter(question) ") "; + content: counter(question) ') '; counter-increment: question; font-size: 1.25em; left: -1.8em; @@ -17,6 +19,27 @@ } +.review-comments { + float: right; + padding-left: 30px; + width: 33%; + + .comment-message { + margin-right: 5px; + } + + .comment-author { + font-size: 0.85em; + font-weight: 700; + margin-bottom: 30px; + text-align: right; + + &:before { + content: '- '; + } + } +} + .review_meta { @media screen and (min-width: 768px) { diff --git a/app/controllers/admin/result_controller.rb b/app/controllers/admin/result_controller.rb index 867c922..67be27a 100644 --- a/app/controllers/admin/result_controller.rb +++ b/app/controllers/admin/result_controller.rb @@ -19,6 +19,8 @@ module Admin @candidate = Candidate.find_by(test_hash: params[:test_hash]) @quiz = @candidate.my_quiz @status = QuizStatus.new(@candidate) + @comments = QuizComment.includes(:user).where(test_hash: @candidate.test_hash).order(:created_at) + @comment = QuizComment.new end end end diff --git a/app/views/admin/result/_comment.html.erb b/app/views/admin/result/_comment.html.erb new file mode 100644 index 0000000..b260eca --- /dev/null +++ b/app/views/admin/result/_comment.html.erb @@ -0,0 +1,2 @@ +
<%= comment.message %>
+
<%= comment.user.name %>
diff --git a/app/views/admin/result/_comment_form.html.erb b/app/views/admin/result/_comment_form.html.erb new file mode 100644 index 0000000..8867b8e --- /dev/null +++ b/app/views/admin/result/_comment_form.html.erb @@ -0,0 +1,10 @@ +<%= render partial: 'shared/form_model_errors', locals: { obj: @comment } %> + +<%= form_for @comment, url: "#", method: :post do |form| %> +
+ <%= form.label :message, "Comment" %> + <%= form.text_area :message %> +
+ + <%= submit_tag "Save Comment" %> +<% end %> diff --git a/app/views/admin/result/view.html.erb b/app/views/admin/result/view.html.erb index d0452ca..3b1abaa 100644 --- a/app/views/admin/result/view.html.erb +++ b/app/views/admin/result/view.html.erb @@ -2,42 +2,50 @@ content_for :title, "Quiz Review - Skills Assessment Admin" %> -
-

Quiz Review

+
+
+

Quiz Review

-
-
- Test ID: <%= @candidate.test_hash %>
- Years of Experience: <%= @candidate.experience %>
- Client/Project: <%= @candidate.project %>
- Recruiter Email: <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %>
+
+
+ Test ID: <%= @candidate.test_hash %>
+ Years of Experience: <%= @candidate.experience %>
+ Client/Project: <%= @candidate.project %>
+ Recruiter Email: <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %>
+
+ +
<%= render partial: 'voting' %>
-
<%= render partial: 'voting' %>
+ <% @quiz.each do |question| %> + <%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %> +
+
+
+

<%= question.question %>

+
+
+ +
+ <% if question.attachment.present? %> + <%= image_tag question.attachment %> + <% end %> +
+ <%= render partial: "quiz/#{question.input_type}", locals: {question: question, answer: question.answer, form: form} %> +
+
+
+ <% end #form_tag %> + <% end #questions loop %> + + <%= link_to(admin_results_path, { class: 'secondary-btn' }) do %> + + <% end %>
- <% @quiz.each do |question| %> - <%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %> -
-
-
-

<%= question.question %>

-
-
- -
- <% if question.attachment.present? %> - <%= image_tag question.attachment %> - <% end %> -
- <%= render partial: "quiz/#{question.input_type}", locals: {question: question, answer: question.answer, form: form} %> -
-
-
- <% end #form_tag %> - <% end #questions loop %> - - <%= link_to(admin_results_path, { class: 'secondary-btn' }) do %> - - <% end %> -
+
+

Comments

+ <%= render partial: 'comment', collection: @comments %> +
<%= render partial: 'comment_form' %>
+
+