Add sdg manager section to admin

Allow a user to become an sdg manager
This commit is contained in:
taitus
2020-11-25 18:57:19 +01:00
committed by Javi Martín
parent fb5965fe63
commit 9fe24aec9d
24 changed files with 301 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<%= header %>
<%= render "admin/shared/user_search", url: admin_sdg_managers_path %>
<div id="sdg_managers">
<% if users.any? %>
<h3 class="margin"><%= page_entries_info users %></h3>
<table>
<thead>
<th scope="col"><%= SDG::Manager.human_attribute_name(:name) %></th>
<th scope="col"><%= SDG::Manager.human_attribute_name(:email) %></th>
<th scope="col"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% users.each do |user| %>
<tr>
<td>
<%= user.name %>
</td>
<td>
<%= user.email %>
</td>
<td>
<%= render Admin::Roles::TableActionsComponent.new(user.sdg_manager || user.build_sdg_manager) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate users %>
<% else %>
<div class="callout primary">
<%= t("admin.sdg_managers.index.no_sdg_managers") %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,15 @@
class Admin::SDG::Managers::IndexComponent < ApplicationComponent
include Admin::Header
attr_reader :users
def initialize(users)
@users = users
end
private
def title
SDG::Manager.model_name.human(count: 2).upcase_first
end
end