Adds moderators config to admin console
This commit is contained in:
18
app/views/admin/moderators/_moderator.html.erb
Normal file
18
app/views/admin/moderators/_moderator.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
<% if moderator %>
|
||||
<span><%= moderator.name %></span>
|
||||
<span class="bullet"> • </span>
|
||||
<span><%= moderator.email %></span>
|
||||
<% if moderator.moderator? %>
|
||||
<%= link_to t('admin.moderators.moderator.delete'),
|
||||
toggle_admin_moderator_path(moderator),
|
||||
method: :post,
|
||||
class: "button tiny radius alert right" %>
|
||||
<% else %>
|
||||
<%= link_to t('admin.moderators.moderator.add'),
|
||||
toggle_admin_moderator_path(moderator),
|
||||
method: :post,
|
||||
class: "button tiny radius success right" %>
|
||||
<% end %>
|
||||
<% else%>
|
||||
<span><%= t('admin.moderators.search.user_not_found') %></span>
|
||||
<% end %>
|
||||
25
app/views/admin/moderators/index.html.erb
Normal file
25
app/views/admin/moderators/index.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<h2><%= t("admin.moderators.index.title") %></h2>
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<%= form_tag search_admin_moderators_path, method: :get, remote: true do %>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= text_field_tag :email, '', placeholder: t('admin.moderators.search.email_placeholder') %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= submit_tag t('admin.moderators.search.search'), class: 'button radius' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="search-result" class="small">
|
||||
</div>
|
||||
<h3><%= page_entries_info @moderators %></h3>
|
||||
<ul class="admin-list">
|
||||
<% @moderators.each do |moderator| %>
|
||||
<li>
|
||||
<%= render 'moderator', moderator: moderator %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= paginate @moderators %>
|
||||
1
app/views/admin/moderators/search.js.erb
Normal file
1
app/views/admin/moderators/search.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#search-result").html("<div class=\"panel\"><%= j render 'moderator', moderator: @user %></div>");
|
||||
Reference in New Issue
Block a user