admin can assign reviewrs to quiz

This commit is contained in:
Mark Moser 2016-09-15 16:11:44 -05:00
parent 3bd9d3364c
commit 96250c4521
3 changed files with 16 additions and 1 deletions

View File

@ -45,7 +45,7 @@ module Admin
private private
def user_params def user_params
params.require(:user).permit(:name, :email, :role, :password) params.require(:user).permit(:name, :email, :role, :password, quiz_ids: [])
end end
end end
end end

View File

@ -15,5 +15,12 @@
<%= form.select :role, admin_role_options(user.role), include_blank: false %> <%= form.select :role, admin_role_options(user.role), include_blank: false %>
</div> </div>
<%= form.collection_check_boxes(:quiz_ids, Quiz.all, :id, :name, {}, {class: 'checkbox'}) do | quiz | %>
<div class="form-group-multiples">
<%= quiz.check_box( checked: user.quizzes.include?(quiz.object)) %>
<%= quiz.label %>
</div>
<% end %>
<%= form.submit %> <%= form.submit %>
<% end %> <% end %>

View File

@ -5,4 +5,12 @@
<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>
<p>Quizzes:</p>
<ul>
<% @user.quizzes.each do |quiz| %>
<li><%= quiz.name %></li>
<% end %>
</ul>
<%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %> <%= link_to('Edit', admin_edit_user_path(@user.to_i), { class: 'btn' }) %>