admin: move <main> to layout
This commit is contained in:
parent
0058168c3e
commit
94ae3c9687
@ -1,21 +1,23 @@
|
||||
<main class="intro_tpl">
|
||||
<h1>Admin Login</h1>
|
||||
<%
|
||||
content_for :main_class, "intro_tpl"
|
||||
%>
|
||||
|
||||
<% if flash[:error].present? %>
|
||||
<div class="error"><%= flash[:error] %></div>
|
||||
<% end %>
|
||||
<h1>Admin Login</h1>
|
||||
|
||||
<%= form_for :auth, url: admin_login_path do |form| %>
|
||||
<div class="form-group">
|
||||
<%= form.label :email %>
|
||||
<%= form.email_field :email %>
|
||||
</div>
|
||||
<% if flash[:error].present? %>
|
||||
<div class="error"><%= flash[:error] %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="form-group">
|
||||
<%= form.label :password %>
|
||||
<%= form.password_field :password %>
|
||||
</div>
|
||||
<%= form_for :auth, url: admin_login_path do |form| %>
|
||||
<div class="form-group">
|
||||
<%= form.label :email %>
|
||||
<%= form.email_field :email %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag "Log in" %>
|
||||
<% end %>
|
||||
</main>
|
||||
<div class="form-group">
|
||||
<%= form.label :password %>
|
||||
<%= form.password_field :password %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag "Log in" %>
|
||||
<% end %>
|
||||
|
@ -2,17 +2,14 @@
|
||||
content_for :section_title, "Admin Dashboard"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<section>
|
||||
<h1>Quizzes</h1>
|
||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||
</section>
|
||||
<section>
|
||||
<h1>Quizzes</h1>
|
||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Users</h1>
|
||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
<section>
|
||||
<h1>Users</h1>
|
||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||
</section>
|
||||
|
@ -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 } %>
|
||||
|
@ -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 %>
|
||||
|
@ -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 } %>
|
||||
|
@ -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' }) %>
|
||||
|
@ -2,6 +2,4 @@
|
||||
content_for :section_title, "Edit: #{@quiz.name}"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>
|
||||
</main>
|
||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>
|
||||
|
@ -2,7 +2,5 @@
|
||||
content_for :section_title, "Quizzes"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||
</main>
|
||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||
|
@ -2,6 +2,4 @@
|
||||
content_for :section_title, "New Quiz"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>
|
||||
</main>
|
||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>
|
||||
|
@ -2,14 +2,10 @@
|
||||
content_for :section_title, "#{@quiz.name}"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<p><%= @quiz.name %></p>
|
||||
<p><%= @quiz.dept %></p>
|
||||
<p><%= @quiz.unit %></p>
|
||||
<%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: 'btn' }) %>
|
||||
</main>
|
||||
<p><%= @quiz.name %></p>
|
||||
<p><%= @quiz.dept %></p>
|
||||
<p><%= @quiz.unit %></p>
|
||||
<%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: 'btn' }) %>
|
||||
|
||||
<main class="summary_tpl">
|
||||
<%= render partial: 'admin/question/table_list', locals: { questions: @quiz.questions, disable: true } %>
|
||||
<%= link_to('New Question', admin_new_question_path, { class: 'btn' }) %>
|
||||
</main>
|
||||
<%= render partial: 'admin/question/table_list', locals: { questions: @quiz.questions, disable: true } %>
|
||||
<%= link_to('New Question', admin_new_question_path, { class: 'btn' }) %>
|
||||
|
@ -2,6 +2,4 @@
|
||||
content_for :section_title, "Edit: #{@user.name}"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>
|
||||
</main>
|
||||
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>
|
||||
|
@ -2,8 +2,6 @@
|
||||
content_for :section_title, "Users"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<h1>Users</h1>
|
||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||
</main>
|
||||
<h1>Users</h1>
|
||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||
|
@ -2,6 +2,4 @@
|
||||
content_for :section_title, "New User"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>
|
||||
</main>
|
||||
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>
|
||||
|
@ -2,9 +2,7 @@
|
||||
content_for :section_title, "#{@user.name}"
|
||||
%>
|
||||
|
||||
<main class="admin_tpl">
|
||||
<p><%= @user.name %></p>
|
||||
<p><%= mail_to(@user.email) %></p>
|
||||
<p><%= @user.role %></p>
|
||||
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %>
|
||||
</main>
|
||||
<p><%= @user.name %></p>
|
||||
<p><%= mail_to(@user.email) %></p>
|
||||
<p><%= @user.role %></p>
|
||||
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %>
|
||||
|
@ -30,7 +30,10 @@
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<%= yield %>
|
||||
<main class="<%= content_for?(:main_class) ? yield(:main_class) : "admin_tpl" %>">
|
||||
<%= render partial: "shared/generic_flash" %>
|
||||
<%= yield %>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user