From 5207b6b8fd5c89b01e9cb137176a5862e6bc1154 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Wed, 27 Jul 2016 22:16:12 -0500 Subject: [PATCH] roughed in quiz GET views --- app/assets/images/icon-dropdownlist.png | Bin 0 -> 1133 bytes .../images/icon-unorderedlistbullet.png | Bin 0 -> 1346 bytes app/assets/images/perficientdigital.png | Bin 0 -> 4774 bytes app/controllers/candidate_controller.rb | 19 +++++++ app/views/candidate/question.html.erb | 53 ++++++++++++++++++ app/views/candidate/saved.html.erb | 8 +++ app/views/candidate/summary.html.erb | 2 + app/views/candidate/thankyou.html.erb | 5 ++ app/views/candidate/welcome.html.erb | 43 ++++++++++++++ app/views/layouts/_footer.html.erb | 5 ++ app/views/layouts/application.html.erb | 38 ++++++++++--- app/views/questions/_checkbox.html.erb | 20 +++++++ app/views/questions/_live-coder.html.erb | 41 ++++++++++++++ app/views/questions/_radio.html.erb | 20 +++++++ app/views/questions/_text.html.erb | 11 ++++ app/workers/quiz_status.rb | 23 ++++++++ config/routes.rb | 7 +++ 17 files changed, 288 insertions(+), 7 deletions(-) create mode 100644 app/assets/images/icon-dropdownlist.png create mode 100644 app/assets/images/icon-unorderedlistbullet.png create mode 100644 app/assets/images/perficientdigital.png create mode 100644 app/controllers/candidate_controller.rb create mode 100644 app/views/candidate/question.html.erb create mode 100644 app/views/candidate/saved.html.erb create mode 100644 app/views/candidate/summary.html.erb create mode 100644 app/views/candidate/thankyou.html.erb create mode 100644 app/views/candidate/welcome.html.erb create mode 100644 app/views/layouts/_footer.html.erb create mode 100644 app/views/questions/_checkbox.html.erb create mode 100644 app/views/questions/_live-coder.html.erb create mode 100644 app/views/questions/_radio.html.erb create mode 100644 app/views/questions/_text.html.erb diff --git a/app/assets/images/icon-dropdownlist.png b/app/assets/images/icon-dropdownlist.png new file mode 100644 index 0000000000000000000000000000000000000000..759e8621a657c95e9bdafee4160e82ba95495ae5 GIT binary patch literal 1133 zcmaJ>O>EOv9Cs;{q_i}LO=t*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@&T6yLbmn7yTr+T{BDgn*W%gju%GBtN}HZgE>H83=CGBk8Gvve^sa5ix^ zaHFGp|gz0t3PcF?(%`1WFO+n~&!>JdPAaVP^Az78jg)^?{Dj2SqPZbi;&zX$ZuGCte^2p8QkufN8!6n7CcyH)}F5FmCX4 zaSW-rmGtBPe|u(*`n|QM|9oD`z0SbSicNUFetgkBA<0kw)9S9>t*`&LAtCt05eAk! zQMZ2IT(TtZPu*9qmxmuV7xF|fL?|i?U$(!v;DVaK@2_oJum1o4FZJLm0hS-SYr+os z+LkEDEq4kDzMeSaRLhyh8Ctb}zrPOeda-Pg2Fpw>F_EULA!;StKSV~XJ(Q-^=EM{H z|4-u4RRYsjMu;XEi>`K>vGUC&qw971E7vj@i7t1Vu(IjgI%CH-=Fw(TABFsQe?EWP z_v-THhkcH({BZUduc-ZeyNgMaC+ty`lDN}k`u1zg)RkJbS-jn+K`#3*HNaa4KcjUsm^cg=vZ_sg)}G2e2P)M( MUHx3vIVCg!04}5Z-2eap literal 0 HcmV?d00001 diff --git a/app/assets/images/perficientdigital.png b/app/assets/images/perficientdigital.png new file mode 100644 index 0000000000000000000000000000000000000000..cf0c8ac0c14e420ad23acd890b2e784d1ddeb0a6 GIT binary patch literal 4774 zcmaJ^c|4Te+rMYXl4XX9vNciR!I&9KW*%c#$&w{emYNt#%+kzYEJd=75K$ugk|hyp zLR7YrB}s~Gc`Rdz!4OJ$N57}%_x|xd@A>0C*E#3@2{?{Tlo={)9X2qnSF=>_{H802~Dm7`l@#;9+J2oG0EEk8=;a^ct@V z06a?GryOaHmKGQ{5&@3e)`8OrWG)&2boJ?EoSP4x2D^aw^d@5E*-xL#!@S+G@(x;- z2urdt-pl)V5Cv}+WOd3d$j1%sF0Zc#)1_m$1Oz+{2cr{wiBt?7EB}iZ!Hz@(@Bj@siQ=h_M5EE_2$VVsrN-4zqXrUb zIJz2h^1W$FNc#~<~BqD5^5qE*)N5jf! zek)p9{{N~3!av$nnl1jn{{ElD)Kh_Eyt*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M;HKd%XsRtLsCPk+@-yvY;C*b+hjsv8!XSe2qefIG}gtxU>| H&WHaGDt&v` literal 0 HcmV?d00001 diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb new file mode 100644 index 0000000..aa6cb4c --- /dev/null +++ b/app/controllers/candidate_controller.rb @@ -0,0 +1,19 @@ +class CandidateController < ApplicationController + def welcome + end + + def question + @question = Question.where(input_type: 'live-coder').order("RAND()").first + @status = QuizStatus.new(Candidate.order("RAND()").first) + @answer = @question.answers.order("RAND()").first + end + + def summary + end + + def thankyou + end + + def saved + end +end diff --git a/app/views/candidate/question.html.erb b/app/views/candidate/question.html.erb new file mode 100644 index 0000000..942631c --- /dev/null +++ b/app/views/candidate/question.html.erb @@ -0,0 +1,53 @@ +<% + content_for :title, "Skills Assessment" + content_for :category, @question.category + content_for :footer_title, "Skills Assessment" +%> +
+
+

<%= @question.question %>

+ <%= render partial: "questions/#{@question.input_type}" %> + + <% if @status.on_summary %> + +
+ +
+ + <% else %> + +
+ +
+
+ +
+ + <% end %> +
+
+ + diff --git a/app/views/candidate/saved.html.erb b/app/views/candidate/saved.html.erb new file mode 100644 index 0000000..8d2eb0e --- /dev/null +++ b/app/views/candidate/saved.html.erb @@ -0,0 +1,8 @@ +

+ Your test results have been saved. You can visit again later with your candidate ID to complete + the test starting from where you left off. +

+ + diff --git a/app/views/candidate/summary.html.erb b/app/views/candidate/summary.html.erb new file mode 100644 index 0000000..4d178c1 --- /dev/null +++ b/app/views/candidate/summary.html.erb @@ -0,0 +1,2 @@ +

Candidate#summary

+

Find me in app/views/candidate/summary.html.erb

diff --git a/app/views/candidate/thankyou.html.erb b/app/views/candidate/thankyou.html.erb new file mode 100644 index 0000000..4f04a58 --- /dev/null +++ b/app/views/candidate/thankyou.html.erb @@ -0,0 +1,5 @@ +

+ Your answers have been submitted. We will review and your recruiter + will contact you if we would like to set up an interview. +

+ diff --git a/app/views/candidate/welcome.html.erb b/app/views/candidate/welcome.html.erb new file mode 100644 index 0000000..db8866f --- /dev/null +++ b/app/views/candidate/welcome.html.erb @@ -0,0 +1,43 @@ +<% content_for :title, "Skills Assessment" %> + + + +
+

Oops!

+

+ 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. +

+ +
+ + + +
+

Let's Get Started

+

+ 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. +

+

+ The questions will test your knowledge in the areas of HTML, CSS, and JavaScript. + Please note that you can only move forward through the test, not back, + and you must attempt to answer the question before moving to the + next one. You'll have an opportunity at the end of the test to review and update your + 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. +

+

+ Please answer to the best of your ability—it's totally okay to say + "I don't know"!—and above all, relax and have fun! Once you submit your + answers, we will review your assessment and your recruiter will be in touch. +

+ +
+
+ + +
+ +
+
diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..9ba1d7e --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 71eab8a..1515cdc 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,38 @@ - - - SkillAssessmentApp + + + + <%= csrf_meta_tags %> - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> - + <%= yield(:title) %> + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + + - <%= yield %> +
+ <% if content_for?(:category) %> + +
+ -- NO PROGRESS BAR ON EDITS -- +
+
Section: <%= yield(:category) %>
+
+
+ + <% else %> + +
+
+
Perficient Digital Skills Assessment
+
+
+ + <% end %> + <%= yield %> +
+ <%= render partial: 'layouts/footer' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> diff --git a/app/views/questions/_checkbox.html.erb b/app/views/questions/_checkbox.html.erb new file mode 100644 index 0000000..bdc1c59 --- /dev/null +++ b/app/views/questions/_checkbox.html.erb @@ -0,0 +1,20 @@ +
+ + <% + @question.input_options.each do | option | + option_id = "#{option.parameterize}_#{@question.to_i}" + %> +
+ + > + +
+ <% end %> + + -- MOVE TO FLASH HASH -- +
Please select or enter an answer.
+
diff --git a/app/views/questions/_live-coder.html.erb b/app/views/questions/_live-coder.html.erb new file mode 100644 index 0000000..ba2b10e --- /dev/null +++ b/app/views/questions/_live-coder.html.erb @@ -0,0 +1,41 @@ +
+ Please revisit this page with JavaScript enabled to modify your answer. +
+ +
+

+ This is a question where you will be asked to write code, and it utilizes a JavaScript-enabled + environment. It looks like JavaScript is not loaded for some reason. Please check the box below + to acknowledge that you agree to come back at a later time to finish answering this question + before you can submit the test. +

+ + +
+ +
+ <% + # answers inserted dynamically via jQuery .load() + # to check for JS capability/enabled + %> + +
+ + +
+ +
+ + +
+ +
+ + +
+ + -- MOVE TO FLASH HASH -- +
You must write code in one of the above textareas to progress.
+ +
+
diff --git a/app/views/questions/_radio.html.erb b/app/views/questions/_radio.html.erb new file mode 100644 index 0000000..3975252 --- /dev/null +++ b/app/views/questions/_radio.html.erb @@ -0,0 +1,20 @@ +
+ + <% + @question.input_options.each do | option | + option_id = "#{option.parameterize}_#{@question.to_i}" + %> +
+ + > + +
+ <% end %> + + -- MOVE TO FLASH HASH -- +
Please select or enter an answer. (The character limit for a textarea answer is 1000)
+
diff --git a/app/views/questions/_text.html.erb b/app/views/questions/_text.html.erb new file mode 100644 index 0000000..baba253 --- /dev/null +++ b/app/views/questions/_text.html.erb @@ -0,0 +1,11 @@ +
+ + + + +
Characters remaining:
+ + -- MOVE TO FLASH HASH -- +
Please select or enter an answer. (The character limit for a textarea answer is 1000)
+ +
diff --git a/app/workers/quiz_status.rb b/app/workers/quiz_status.rb index 9e6d695..8b5af02 100644 --- a/app/workers/quiz_status.rb +++ b/app/workers/quiz_status.rb @@ -20,4 +20,27 @@ class QuizStatus def can_submit on_summary && candidate.answered_questions.count == candidate.questions.count end + + # query($TotalQuestions); + # $TotalQuestions = $result->num_rows + 1; + # + # $progressBarValue = round($questionId/$TotalQuestions * 100); + # $_SESSION['pBarValue'] = $progressBarValue; + # + # $pValue = $_SESSION['pBarValue']; + # + # if(!isset($_GET['qid'])) { ?> + #
+ #
+ # % + #
+ #
+ # end diff --git a/config/routes.rb b/config/routes.rb index 787824f..fdf912c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,10 @@ Rails.application.routes.draw do + get "/welcome", to: 'candidate#welcome', as: :welcome + get "/thankyou", to: 'candidate#thankyou', as: :thankyou + get "/saved", to: 'candidate#saved', as: :saved + get "/summary", to: 'candidate#summary', as: :summary + get "/question", to: 'candidate#question', as: :question + + root to: 'candidate#welcome' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end