-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new and create actions for multiple choice questions
- Loading branch information
Showing
7 changed files
with
182 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
|
||
<main role="main" class="container"> | ||
|
||
<h1>Answer This Question</h1> | ||
|
||
<p> | ||
<%= @multiple_choice_question.question %> | ||
</p> | ||
|
||
<%= form_tag do %> | ||
<% | ||
order = [0, 1, 2, 3, 4].shuffle | ||
order.each do |a| | ||
%> | ||
<% if a == 0 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '0') %> | ||
<%= label_tag(:guess_0, @multiple_choice_question.answer) %> | ||
</p> | ||
|
||
<% elsif a == 1 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '1') %> | ||
<%= label_tag(:guess_1, @multiple_choice_question.distractor_1) %> | ||
</p> | ||
|
||
<% elsif a == 2 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '2') %> | ||
<%= label_tag(:guess_2, @multiple_choice_question.distractor_2) %> | ||
</p> | ||
|
||
<% elsif a == 3 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '3') %> | ||
<%= label_tag(:guess_3, @multiple_choice_question.distractor_3) %> | ||
</p> | ||
|
||
<% elsif a == 4 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '4') %> | ||
<%= label_tag(:guess_4, @multiple_choice_question.distractor_4) %> | ||
</p> | ||
<h1>Answer This Question</h1> | ||
|
||
<p> | ||
<%= @multiple_choice_question.question %> | ||
</p> | ||
|
||
<%= form_tag do %> | ||
<% | ||
order = [0, 1, 2, 3, 4].shuffle | ||
order.each do |a| | ||
%> | ||
<% if a == 0 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '0') %> | ||
<%= label_tag(:guess_0, @multiple_choice_question.answer) %> | ||
</p> | ||
|
||
<% elsif a == 1 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '1') %> | ||
<%= label_tag(:guess_1, @multiple_choice_question.distractor_1) %> | ||
</p> | ||
|
||
<% elsif a == 2 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '2') %> | ||
<%= label_tag(:guess_2, @multiple_choice_question.distractor_2) %> | ||
</p> | ||
|
||
<% elsif a == 3 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '3') %> | ||
<%= label_tag(:guess_3, @multiple_choice_question.distractor_3) %> | ||
</p> | ||
|
||
<% elsif a == 4 %> | ||
<p> | ||
<%= radio_button_tag(:guess, '4') %> | ||
<%= label_tag(:guess_4, @multiple_choice_question.distractor_4) %> | ||
</p> | ||
|
||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= submit_tag("Submit Answer") %> | ||
<%= submit_tag("Submit Answer") %> | ||
<% end %> | ||
<% end %> | ||
|
||
</main><!-- /.container --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
|
||
<h1>Multiple Choice Questions</h1> | ||
<main role="main" class="container"> | ||
|
||
<table class="table table-sm"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Question</th> | ||
<th scope="col">Answer</th> | ||
<th scope="col">Distractor 1</th> | ||
<th scope="col">Distractor 2</th> | ||
<th scope="col">Distractor 3</th> | ||
<th scope="col">Distractor 4</th> | ||
<th scope="col"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @multiple_choice_questions.each do |question| %> | ||
<h1>Multiple Choice Questions</h1> | ||
|
||
<table class="table table-sm"> | ||
<thead> | ||
<tr> | ||
<td><%= question.question %></td> | ||
<td><%= question.answer %></td> | ||
<td><%= question.distractor_1 %></td> | ||
<td><%= question.distractor_2 %></td> | ||
<td><%= question.distractor_3 %></td> | ||
<td><%= question.distractor_4 %></td> | ||
<td><%= link_to 'Show', multiple_choice_question_path(question) %></td> | ||
<th scope="col">Question</th> | ||
<th scope="col">Answer</th> | ||
<th scope="col">Distractor 1</th> | ||
<th scope="col">Distractor 2</th> | ||
<th scope="col">Distractor 3</th> | ||
<th scope="col">Distractor 4</th> | ||
<th scope="col"></th> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</thead> | ||
<tbody> | ||
<% @multiple_choice_questions.each do |question| %> | ||
<tr> | ||
<td><%= question.question %></td> | ||
<td><%= question.answer %></td> | ||
<td><%= question.distractor_1 %></td> | ||
<td><%= question.distractor_2 %></td> | ||
<td><%= question.distractor_3 %></td> | ||
<td><%= question.distractor_4 %></td> | ||
<td><%= link_to 'Show', multiple_choice_question_path(question) %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<p> | ||
<%= link_to 'New Multiple Choice Question', new_multiple_choice_question_path %> | ||
</p> | ||
|
||
</main><!-- /.container --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
<main role="main" class="container"> | ||
|
||
<h1>New Multiple Choice Question</h1> | ||
|
||
<%= form_with model: @multiple_choice_question, local: true do |form| %> | ||
<div class="field"> | ||
<%= form.label :question %> | ||
<%= form.text_field :question, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="field"> | ||
<%= form.label :answer %> | ||
<%= form.text_field :answer, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="field"> | ||
<%= form.label :distractor_1 %> | ||
<%= form.text_field :distractor_1, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="field"> | ||
<%= form.label :distractor_2 %> | ||
<%= form.text_field :distractor_2, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="field"> | ||
<%= form.label :distractor_3 %> | ||
<%= form.text_field :distractor_3, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="field"> | ||
<%= form.label :distractor_4 %> | ||
<%= form.text_field :distractor_4, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="actions"> | ||
<%= form.submit 'Create Multiple Choice Question', class: 'btn btn-primary' %> | ||
</div> | ||
<% end %> | ||
|
||
<p> | ||
<%= link_to 'Back', multiple_choice_questions_path %> | ||
</p> | ||
|
||
</main><!-- /.container --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
|
||
<p> | ||
<b>Question:</b> <%= @multiple_choice_question.question %> | ||
</p> | ||
<main role="main" class="container"> | ||
|
||
<p> | ||
<b>Answer:</b> <%= @multiple_choice_question.answer %> | ||
</p> | ||
<p> | ||
<b>Question:</b> <%= @multiple_choice_question.question %> | ||
</p> | ||
|
||
<p> | ||
<b>Distractor 1:</b> <%= @multiple_choice_question.distractor_1 %> | ||
</p> | ||
<p> | ||
<b>Answer:</b> <%= @multiple_choice_question.answer %> | ||
</p> | ||
|
||
<p> | ||
<b>Distractor 2:</b> <%= @multiple_choice_question.distractor_2 %> | ||
</p> | ||
<p> | ||
<b>Distractor 1:</b> <%= @multiple_choice_question.distractor_1 %> | ||
</p> | ||
|
||
<p> | ||
<b>Distractor 3:</b> <%= @multiple_choice_question.distractor_3 %> | ||
</p> | ||
<p> | ||
<b>Distractor 2:</b> <%= @multiple_choice_question.distractor_2 %> | ||
</p> | ||
|
||
<p> | ||
<b>Distractor 4:</b> <%= @multiple_choice_question.distractor_4 %> | ||
</p> | ||
<p> | ||
<b>Distractor 3:</b> <%= @multiple_choice_question.distractor_3 %> | ||
</p> | ||
|
||
<p> | ||
<%= link_to 'Back', multiple_choice_questions_path %> | ||
</p> | ||
<p> | ||
<b>Distractor 4:</b> <%= @multiple_choice_question.distractor_4 %> | ||
</p> | ||
|
||
<p> | ||
<%= link_to 'Back', multiple_choice_questions_path %> | ||
</p> | ||
|
||
</main><!-- /.container --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters