live coder labels & accordion helper
This commit is contained in:
@ -45,6 +45,17 @@
|
||||
</noscript>
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="accordion<%= question.question_id %>" style="display: none;">
|
||||
<input type="checkbox" class="accordion__toggle" id="accordion-toggle-live-coder" />
|
||||
<label class="accordion__label" for="accordion-toggle-live-coder">How to use the live coder</label>
|
||||
<p class="accordion__copy">
|
||||
This is our own nifty creation, and it works similarly to CodePen. To use: type any HTML, CSS,
|
||||
or JS inside their corresponding boxes, and watch the Results window below the boxes update
|
||||
with your changes. Once you’re happy with your code and how it renders in the Results window,
|
||||
move on to the next question!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="answer<%= question.question_id %>" data-id="live-coder-answer" style="display: none;">
|
||||
<label for="answer_answer_hash_text">Enter answer here</label>
|
||||
<%= text_area_tag 'answer[answer_hash][text]', value_text, { disabled: true, data: {last: answers['text']}} %>
|
||||
@ -64,6 +75,7 @@
|
||||
<%= text_area_tag 'answer[answer_hash][js]', value_js, { disabled: true, data: {id: 'code-js', last: answers['js']}, class: 'code-answer code-js' } %>
|
||||
</div>
|
||||
|
||||
<label class="code-results">Results</label>
|
||||
<div class="results" data-id="results"></div>
|
||||
</div>
|
||||
|
||||
@ -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");
|
||||
|
Reference in New Issue
Block a user