admin: move <main> to layout
This commit is contained in:
parent
0058168c3e
commit
94ae3c9687
@ -1,11 +1,14 @@
|
|||||||
<main class="intro_tpl">
|
<%
|
||||||
<h1>Admin Login</h1>
|
content_for :main_class, "intro_tpl"
|
||||||
|
%>
|
||||||
|
|
||||||
<% if flash[:error].present? %>
|
<h1>Admin Login</h1>
|
||||||
|
|
||||||
|
<% if flash[:error].present? %>
|
||||||
<div class="error"><%= flash[:error] %></div>
|
<div class="error"><%= flash[:error] %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_for :auth, url: admin_login_path do |form| %>
|
<%= form_for :auth, url: admin_login_path do |form| %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= form.label :email %>
|
<%= form.label :email %>
|
||||||
<%= form.email_field :email %>
|
<%= form.email_field :email %>
|
||||||
@ -17,5 +20,4 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= submit_tag "Log in" %>
|
<%= submit_tag "Log in" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</main>
|
|
||||||
|
@ -2,17 +2,14 @@
|
|||||||
content_for :section_title, "Admin Dashboard"
|
content_for :section_title, "Admin Dashboard"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<section>
|
||||||
<section>
|
|
||||||
<h1>Quizzes</h1>
|
<h1>Quizzes</h1>
|
||||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h1>Users</h1>
|
<h1>Users</h1>
|
||||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</main>
|
|
||||||
|
@ -2,8 +2,5 @@
|
|||||||
content_for :section_title, "Questions"
|
content_for :section_title, "Questions"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<h1><%= @question.quiz.name %></h1>
|
||||||
<h1><%= @question.quiz.name %></h1>
|
<%= render partial: 'form', locals: {question: @question, action: admin_update_question_path } %>
|
||||||
|
|
||||||
<%= render partial: 'form', locals: {question: @question, action: admin_update_question_path } %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
content_for :section_title, "Questions"
|
content_for :section_title, "Questions"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<% quizzes = @questions.group_by{ |q| q.quiz.name } %>
|
||||||
<% quizzes = @questions.group_by{ |q| q.quiz.name } %>
|
<% quizzes.each do |quiz, questions| %>
|
||||||
<% quizzes.each do |quiz, questions| %>
|
|
||||||
<h1><%= quiz %></h1>
|
<h1><%= quiz %></h1>
|
||||||
<%= render partial: 'admin/question/table_list', locals: { questions: questions } %>
|
<%= render partial: 'admin/question/table_list', locals: { questions: questions } %>
|
||||||
<%= link_to('Edit Quiz', admin_quiz_path(questions.first.quiz.to_i), { class: 'btn' }) %>
|
<%= link_to('Edit Quiz', admin_quiz_path(questions.first.quiz.to_i), { class: 'btn' }) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</main>
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
content_for :section_title, "New Question"
|
content_for :section_title, "New Question"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<%= render partial: 'form', locals: {question: @question, action: admin_create_question_path } %>
|
||||||
<%= render partial: 'form', locals: {question: @question, action: admin_create_question_path } %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
content_for :section_title, "Question for #{@question.quiz.name}"
|
content_for :section_title, "Question for #{@question.quiz.name}"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<table cellspacing="0" cellpadding="0">
|
||||||
<table cellspacing="0" cellpadding="0">
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Category</th>
|
<th>Category</th>
|
||||||
<td><%= @question.category %></td>
|
<td><%= @question.category %></td>
|
||||||
@ -23,16 +22,15 @@
|
|||||||
<%= label_tag 'question_active', 'Active' %>
|
<%= label_tag 'question_active', 'Active' %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<strong>Question</strong>
|
<strong>Question</strong>
|
||||||
<p><%= @question.question %></p>
|
<p><%= @question.question %></p>
|
||||||
|
|
||||||
<%= fields_for @question do |fields| %>
|
<%= fields_for @question do |fields| %>
|
||||||
<%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %>
|
<%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %>
|
||||||
<% end %>
|
<% 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' }) %>
|
<%= link_to('View Quiz', admin_quiz_path(@question.quiz_id), { class: 'btn' }) %>
|
||||||
</main>
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
content_for :section_title, "Edit: #{@quiz.name}"
|
content_for :section_title, "Edit: #{@quiz.name}"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>
|
||||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_update_quiz_path } %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,7 +2,5 @@
|
|||||||
content_for :section_title, "Quizzes"
|
content_for :section_title, "Quizzes"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
content_for :section_title, "New Quiz"
|
content_for :section_title, "New Quiz"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>
|
||||||
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,14 +2,10 @@
|
|||||||
content_for :section_title, "#{@quiz.name}"
|
content_for :section_title, "#{@quiz.name}"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<p><%= @quiz.name %></p>
|
||||||
<p><%= @quiz.name %></p>
|
<p><%= @quiz.dept %></p>
|
||||||
<p><%= @quiz.dept %></p>
|
<p><%= @quiz.unit %></p>
|
||||||
<p><%= @quiz.unit %></p>
|
<%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: 'btn' }) %>
|
||||||
<%= link_to('Edit', admin_edit_quiz_path(@quiz.to_i), { class: 'btn' }) %>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<main class="summary_tpl">
|
<%= render partial: 'admin/question/table_list', locals: { questions: @quiz.questions, disable: true } %>
|
||||||
<%= render partial: 'admin/question/table_list', locals: { questions: @quiz.questions, disable: true } %>
|
<%= link_to('New Question', admin_new_question_path, { class: 'btn' }) %>
|
||||||
<%= link_to('New Question', admin_new_question_path, { class: 'btn' }) %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
content_for :section_title, "Edit: #{@user.name}"
|
content_for :section_title, "Edit: #{@user.name}"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>
|
||||||
<%= render partial: 'form', locals: {user: @user, action: admin_update_user_path } %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
content_for :section_title, "Users"
|
content_for :section_title, "Users"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<h1>Users</h1>
|
||||||
<h1>Users</h1>
|
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
content_for :section_title, "New User"
|
content_for :section_title, "New User"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>
|
||||||
<%= render partial: 'form', locals: {user: @user, action: admin_create_user_path } %>
|
|
||||||
</main>
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
content_for :section_title, "#{@user.name}"
|
content_for :section_title, "#{@user.name}"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<main class="admin_tpl">
|
<p><%= @user.name %></p>
|
||||||
<p><%= @user.name %></p>
|
<p><%= mail_to(@user.email) %></p>
|
||||||
<p><%= mail_to(@user.email) %></p>
|
<p><%= @user.role %></p>
|
||||||
<p><%= @user.role %></p>
|
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %>
|
||||||
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %>
|
|
||||||
</main>
|
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<main class="<%= content_for?(:main_class) ? yield(:main_class) : "admin_tpl" %>">
|
||||||
|
<%= render partial: "shared/generic_flash" %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
</main>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user