admin: move <main> to layout

This commit is contained in:
Mark Moser
2016-08-24 12:17:00 -05:00
parent 0058168c3e
commit 94ae3c9687
15 changed files with 89 additions and 114 deletions

View File

@ -2,8 +2,5 @@
content_for :section_title, "Questions"
%>
<main class="admin_tpl">
<h1><%= @question.quiz.name %></h1>
<%= render partial: 'form', locals: {question: @question, action: admin_update_question_path } %>
</main>
<h1><%= @question.quiz.name %></h1>
<%= render partial: 'form', locals: {question: @question, action: admin_update_question_path } %>

View File

@ -2,11 +2,9 @@
content_for :section_title, "Questions"
%>
<main class="admin_tpl">
<% quizzes = @questions.group_by{ |q| q.quiz.name } %>
<% quizzes.each do |quiz, questions| %>
<h1><%= quiz %></h1>
<%= render partial: 'admin/question/table_list', locals: { questions: questions } %>
<%= link_to('Edit Quiz', admin_quiz_path(questions.first.quiz.to_i), { class: 'btn' }) %>
<% end %>
</main>
<% quizzes = @questions.group_by{ |q| q.quiz.name } %>
<% quizzes.each do |quiz, questions| %>
<h1><%= quiz %></h1>
<%= render partial: 'admin/question/table_list', locals: { questions: questions } %>
<%= link_to('Edit Quiz', admin_quiz_path(questions.first.quiz.to_i), { class: 'btn' }) %>
<% end %>

View File

@ -2,6 +2,4 @@
content_for :section_title, "New Question"
%>
<main class="admin_tpl">
<%= render partial: 'form', locals: {question: @question, action: admin_create_question_path } %>
</main>
<%= render partial: 'form', locals: {question: @question, action: admin_create_question_path } %>

View File

@ -2,37 +2,35 @@
content_for :section_title, "Question for #{@question.quiz.name}"
%>
<main class="admin_tpl">
<table cellspacing="0" cellpadding="0">
<tr>
<th>Category</th>
<td><%= @question.category %></td>
</tr>
<tr>
<th>Type</th>
<td><%= @question.input_type %></td>
</tr>
<tr>
<th>Sort</th>
<td><%= @question.sort %></td>
</tr>
<tr>
<th></th>
<td>
<%= check_box_tag 'question_active', nil, @question.active?, {disabled: true} %>
<%= label_tag 'question_active', 'Active' %>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0">
<tr>
<th>Category</th>
<td><%= @question.category %></td>
</tr>
<tr>
<th>Type</th>
<td><%= @question.input_type %></td>
</tr>
<tr>
<th>Sort</th>
<td><%= @question.sort %></td>
</tr>
<tr>
<th></th>
<td>
<%= check_box_tag 'question_active', nil, @question.active?, {disabled: true} %>
<%= label_tag 'question_active', 'Active' %>
</td>
</tr>
</table>
<strong>Question</strong>
<p><%= @question.question %></p>
<strong>Question</strong>
<p><%= @question.question %></p>
<%= fields_for @question do |fields| %>
<%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %>
<% end %>
<%= fields_for @question do |fields| %>
<%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %>
<% end %>
<%= link_to('Edit', admin_edit_question_path(@question.to_i), { class: 'btn' }) %>
<%= link_to('Edit', admin_edit_question_path(@question.to_i), { class: 'btn' }) %>
<%= link_to('View Quiz', admin_quiz_path(@question.quiz_id), { class: 'btn' }) %>
</main>
<%= link_to('View Quiz', admin_quiz_path(@question.quiz_id), { class: 'btn' }) %>