Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from yoshi3315/test_ajax
単語帳機能のajax部分の実装
- Loading branch information
Showing
4 changed files
with
54 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h2 class='text-body text-left mb-3'> | ||
<%= "第#{session[:number_of_questions] + 1}問(全50問)" %> | ||
</h2> | ||
|
||
<h2 class='text-body text-left mb-3'>問題</h2> | ||
|
||
<div class='mb-3'><%= @correct.question %></div> | ||
|
||
<h2 class='text-body text-left mt-3 mb-3'>選択肢</h2> | ||
|
||
<div class='mb-3'> | ||
<%= form_with url: tango_tests_path do |f| %> | ||
<% @choices.each.with_index(1) do |choice, index| %> | ||
<div class="form-check"> | ||
<% if index == 1%> | ||
<%= f.radio_button :answer_id, choice.id, class: 'form-check-input', checked: true %> | ||
<%= f.label choice.description, class: 'form-check-label' %> | ||
<% else %> | ||
<%= f.radio_button :answer_id, choice.id, class: 'form-check-input' %> | ||
<%= f.label choice.description, class: 'form-check-label' %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<%= hidden_field_tag :question_id, @correct.id %> | ||
<%= f.submit '解答', class: 'btn btn-primary' %> | ||
<% end %> | ||
</div> |
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,22 +1,5 @@ | ||
<h1>単語帳</h1> | ||
|
||
<h2 class='text-body text-left mb-3'>問題</h2> | ||
|
||
<div class='mb-3'><%= @correct.question %></div> | ||
|
||
<h2 class='text-body text-left mt-3 mb-3'>選択肢</h2> | ||
|
||
<div class='mb-3'> | ||
<%= form_with url: tango_tests_path do |f| %> | ||
<% @choices.each do |choice| %> | ||
<div class="form-check"> | ||
<%= f.radio_button :answer_id, choice.id, class: 'form-check-input' %> | ||
<%= f.label choice.description, class: 'form-check-label' %> | ||
</div> | ||
<% end %> | ||
<%= hidden_field_tag :question_id, @correct.id %> | ||
<%= f.submit '仮', class: 'btn btn-primary' %> | ||
<% end %> | ||
<div id='tango-test'> | ||
<%= render 'test_form' %> | ||
</div> |
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 @@ | ||
$('#tango-test').html("<%= escape_javascript(render('test_form')) %>"); |