Add Administrator management views and en/es translations
This commit is contained in:
@@ -95,6 +95,10 @@
|
|||||||
<strong><%= t("admin.menu.title_profiles") %></strong>
|
<strong><%= t("admin.menu.title_profiles") %></strong>
|
||||||
</a>
|
</a>
|
||||||
<ul <%= "class=is-active" if menu_profiles? %>>
|
<ul <%= "class=is-active" if menu_profiles? %>>
|
||||||
|
<li <%= "class=active" if controller_name == "administrators" %>>
|
||||||
|
<%= link_to t("admin.menu.administrators"), admin_administrators_path %>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li <%= "class=active" if controller_name == "organizations" %>>
|
<li <%= "class=active" if controller_name == "organizations" %>>
|
||||||
<%= link_to t("admin.menu.organizations"), admin_organizations_path %>
|
<%= link_to t("admin.menu.organizations"), admin_organizations_path %>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
26
app/views/admin/administrators/_administrator.html.erb
Normal file
26
app/views/admin/administrators/_administrator.html.erb
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<div class="small-12 column">
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= administrator.name %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= administrator.email %>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<% if administrator.persisted? %>
|
||||||
|
<%= link_to t('admin.administrators.administrator.delete'),
|
||||||
|
admin_administrator_path(administrator),
|
||||||
|
method: :delete,
|
||||||
|
class: "button hollow alert" %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to t('admin.administrators.administrator.add'),{ controller: "admin/administrators", action: :create, user_id: administrator.user_id },
|
||||||
|
method: :post,
|
||||||
|
class: "button success" %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
46
app/views/admin/administrators/index.html.erb
Normal file
46
app/views/admin/administrators/index.html.erb
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<h2 class="inline-block"><%= t("admin.administrators.index.title") %></h2>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<%= form_tag search_admin_administrators_path, method: :get, remote: true do %>
|
||||||
|
<div class="small-12 medium-6 column">
|
||||||
|
<%= text_field_tag :email, '', placeholder: t('admin.administrators.search.email_placeholder') %>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-6 column">
|
||||||
|
<%= submit_tag t('admin.administrators.search.search'), class: 'button' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="search-result" class="row"></div>
|
||||||
|
|
||||||
|
<h3><%= page_entries_info @administrators %></h3>
|
||||||
|
|
||||||
|
<table id="administrators">
|
||||||
|
<% @administrators.each do |administrator| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= administrator.name %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= administrator.email %>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<% if administrator.persisted? %>
|
||||||
|
<%= link_to t('admin.administrators.administrator.delete'),
|
||||||
|
admin_administrator_path(administrator),
|
||||||
|
method: :delete,
|
||||||
|
class: "button hollow alert"
|
||||||
|
%>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to t('admin.administrators.administrator.add'),
|
||||||
|
{ controller: "admin/administrators", action: :create,
|
||||||
|
user_id: administrator.user_id },
|
||||||
|
method: :post,
|
||||||
|
class: "button success" %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%= paginate @administrators %>
|
||||||
1
app/views/admin/administrators/search.js.erb
Normal file
1
app/views/admin/administrators/search.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$("#search-result").html("<%= j render 'administrator', administrator: @administrator %>");
|
||||||
1
app/views/admin/administrators/user_not_found.js.erb
Normal file
1
app/views/admin/administrators/user_not_found.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$("#search-result").html("<div class=\"small-12 column\"><div class=\"callout alert\"><%= j t('admin.administrators.search.user_not_found') %></div></div>");
|
||||||
@@ -226,6 +226,16 @@ en:
|
|||||||
title_profiles: Profiles
|
title_profiles: Profiles
|
||||||
title_banners: Banners
|
title_banners: Banners
|
||||||
title_site_customization: Site customization
|
title_site_customization: Site customization
|
||||||
|
administrators:
|
||||||
|
index:
|
||||||
|
title: Administrators
|
||||||
|
moderator:
|
||||||
|
add: Add
|
||||||
|
delete: Delete
|
||||||
|
search:
|
||||||
|
email_placeholder: Search user by email
|
||||||
|
search: Search
|
||||||
|
user_not_found: User not found
|
||||||
moderators:
|
moderators:
|
||||||
index:
|
index:
|
||||||
title: Moderators
|
title: Moderators
|
||||||
|
|||||||
@@ -181,6 +181,16 @@ es:
|
|||||||
with_confirmed_hide: Confirmados
|
with_confirmed_hide: Confirmados
|
||||||
without_confirmed_hide: Pendientes
|
without_confirmed_hide: Pendientes
|
||||||
title: Debates ocultos
|
title: Debates ocultos
|
||||||
|
administrators:
|
||||||
|
index:
|
||||||
|
title: Administradores
|
||||||
|
manager:
|
||||||
|
add: Añadir como Administrador
|
||||||
|
delete: Borrar
|
||||||
|
search:
|
||||||
|
email_placeholder: Buscar usuario por email
|
||||||
|
search: Buscar
|
||||||
|
user_not_found: Usuario no encontrado
|
||||||
managers:
|
managers:
|
||||||
index:
|
index:
|
||||||
title: Gestores
|
title: Gestores
|
||||||
|
|||||||
Reference in New Issue
Block a user