diff --git a/app/assets/stylesheets/molecules/_accordions.scss b/app/assets/stylesheets/molecules/_accordions.scss new file mode 100644 index 0000000..b96290b --- /dev/null +++ b/app/assets/stylesheets/molecules/_accordions.scss @@ -0,0 +1,54 @@ +.accordion { + margin-bottom: 0.75em; + + [type="checkbox"]:checked + label, + [type="checkbox"]:checked ~ label:after, + [type="checkbox"]:not(:checked) + label, + [type="checkbox"]:not(:checked) ~ label:after, + [type="radio"]:checked + label, + [type="radio"]:checked ~ label:after, + [type="radio"]:not(:checked) + label, + [type="radio"]:not(:checked) ~ label:after { + content: ""; + border: 0; + background-color: transparent; + } + + [type="checkbox"]:hover:not(:disabled) + label:before, + [type="radio"]:hover:not(:disabled) + label:before, + [type="radio"]:not(:checked) ~ label:before, + [type="checkbox"]:not(:checked) ~ label:before, + [type="radio"]:checked ~ label:before, + [type="checkbox"]:checked ~ label:before { + background-color: transparent; + border: 0; + content: "+"; + font-size: 1.3em; + line-height: 1; + } + + [type="checkbox"]:hover:checked + label:before, + [type="radio"]:hover:checked + label:before, + [type="radio"]:checked ~ label:before, + [type="checkbox"]:checked ~ label:before { + background-color: transparent; + content: "-"; + } + + [type="radio"]:not(:checked) + label, + [type="checkbox"]:not(:checked) + label, + [type="radio"]:checked + label, + [type="checkbox"]:checked + label { + padding-left: 20px; + } + + .accordion__copy { + display: none; + margin-top: 0.75em; + } + + .accordion__toggle:checked ~ .accordion__copy { + display: block; + } + +} diff --git a/app/assets/stylesheets/molecules/_livecoder.scss b/app/assets/stylesheets/molecules/_livecoder.scss index 5ca90d2..4d7c3d1 100644 --- a/app/assets/stylesheets/molecules/_livecoder.scss +++ b/app/assets/stylesheets/molecules/_livecoder.scss @@ -31,8 +31,15 @@ background-color: #fff; } -fieldset:disabled .results { - border-color: #bbb; +fieldset:disabled { + .results { + border-color: #bbb; + } + + .code-results, + .code-input label { + display: block; + } } iframe { diff --git a/app/views/quiz/_live_code.html.erb b/app/views/quiz/_live_code.html.erb index 91814dd..cce5495 100644 --- a/app/views/quiz/_live_code.html.erb +++ b/app/views/quiz/_live_code.html.erb @@ -45,6 +45,17 @@ +
+ + @@ -71,6 +83,7 @@ <% # removes the no-js message %> document.getElementById("nojs<%= question.question_id %>").style.display = "none"; document.getElementById("answer<%= question.question_id %>").style.display = ""; + document.getElementById("accordion<%= question.question_id %>").style.display = ""; <% # we want the coders disabled until JS is confirmed, so form post is easier to validate %> var coders = document.querySelectorAll("[data-id=live-coder-answer] textarea");