Merge pull request #2089 from consul/admin-profiles

Admin profiles
This commit is contained in:
Alberto García
2017-10-25 19:48:50 +02:00
committed by GitHub
27 changed files with 715 additions and 403 deletions

View File

@@ -29,7 +29,7 @@ module AdminHelper
end
def menu_profiles?
["administrators", "organizations", "officials", "moderators", "valuators", "managers", "users"].include? controller_name
["administrators", "organizations", "officials", "moderators", "valuators", "managers", "users", "activity"].include? controller_name
end
def menu_banners?

View File

@@ -120,7 +120,7 @@
<%= link_to t("admin.menu.officials"), admin_officials_path %>
</li>
<li <%= "class=active" if controller_name == "moderators" %>>
<li <%= "class=active" if controller_name == "moderators" || controller_name == "activity" %>>
<%= link_to t('admin.menu.moderators'), admin_moderators_path%>
</li>

View File

@@ -1,43 +1,56 @@
<%= back_link_to admin_moderators_path %>
<h2><%= t("admin.activity.show.title") %></h2>
<%= render 'shared/filter_subnav', i18n_namespace: "admin.activity.show" %>
<h3><%= page_entries_info @activity %></h3>
<% if @activity.any? %>
<h3 class="margin"><%= page_entries_info @activity %></h3>
<table>
<tr>
<th><%= t("admin.activity.show.type") %></th>
<th><%= t("admin.activity.show.action") %></th>
<th class="text-left"><%= t("admin.activity.show.content") %></th>
<th><%= t("admin.activity.show.by") %></th>
</tr>
<% @activity.each do |activity| %>
<tr id="<%= dom_id(activity) %>">
<td>
<%= activity.actionable_type.constantize.model_name.human %><br>
<span class="date"><%= l activity.actionable.created_at.to_date %></span>
</td>
<td>
<%= t("admin.activity.show.actions.#{activity.action}") %><br>
<span class="date"><%= l activity.created_at.to_date %></span>
</td>
<td>
<% case activity.actionable_type %>
<% when "User" %>
<%= activity.actionable.username %> (<%= activity.actionable.email %>)
<% when "Comment" %>
<%= activity.actionable.body %>
<% else %>
<strong><%= activity.actionable.title %></strong>
<br>
<div class="proposal-description">
<%= activity.actionable.description %>
</div>
<% end %>
</td>
<td><%= activity.user.name %> (<%= activity.user.email %>)</td>
</tr>
<% end %>
</table>
<table>
<thead>
<tr>
<th scope="col"><%= t("admin.activity.show.type") %></th>
<th scope="col"><%= t("admin.activity.show.action") %></th>
<th scope="col" class="small-6"><%= t("admin.activity.show.content") %></th>
<th scope="col"><%= t("admin.activity.show.by") %></th>
</tr>
</thead>
<tbody>
<% @activity.each do |activity| %>
<tr id="<%= dom_id(activity) %>">
<td class="align-top">
<strong><%= activity.actionable_type.constantize.model_name.human %></strong><br>
<span class="date"><%= l activity.actionable.created_at.to_date %></span>
</td>
<td class="align-top">
<%= t("admin.activity.show.actions.#{activity.action}") %><br>
<span class="date"><%= l activity.created_at.to_date %></span>
</td>
<td class="align-top">
<% case activity.actionable_type %>
<% when "User" %>
<%= activity.actionable.username %> (<%= activity.actionable.email %>)
<% when "Comment" %>
<%= activity.actionable.body %>
<% else %>
<strong><%= activity.actionable.title %></strong>
<br>
<div class="proposal-description">
<%= activity.actionable.description %>
</div>
<% end %>
<td class="align-top">
<%= activity.user.name %> (<%= activity.user.email %>)
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @activity %>
<%= paginate @activity %>
<% else %>
<div class="callout primary">
<%= t("admin.activity.show.no_activity") %>
</div>
<% end %>

View File

@@ -1,31 +1,48 @@
<h2 class="inline-block"><%= t("admin.administrators.index.title") %></h2>
<h2><%= t("admin.administrators.index.title") %></h2>
<%= render 'admin/shared/user_search', url: search_admin_administrators_path %>
<h3><%= page_entries_info @administrators %></h3>
<div id="administrators">
<% if @administrators.any? %>
<h3 class="margin"><%= 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>
<table>
<thead>
<th scope="col"><%= t("admin.administrators.index.name") %></th>
<th scope="col"><%= t("admin.administrators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<% @administrators.each do |administrator| %>
<tr>
<td>
<%= administrator.name %>
</td>
<td>
<%= administrator.email %>
</td>
<td>
<% if administrator.persisted? %>
<%= link_to t('admin.administrators.administrator.delete'),
admin_administrator_path(administrator),
method: :delete,
class: "button hollow alert expanded"
%>
<% else %>
<%= link_to t('admin.administrators.administrator.add'),
{ controller: "admin/administrators", action: :create,
user_id: administrator.user_id },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</table>
<%= paginate @administrators %>
<% else %>
<div class="callout primary margin">
<%= t("admin.administrators.index.no_administrators") %>
</div>
<% end %>
</table>
<%= paginate @administrators %>
</div>

View File

@@ -2,28 +2,43 @@
<%= render 'admin/shared/user_search', url: search_admin_administrators_path %>
<h3><%= page_entries_info @users %></h3>
<div id="administrators">
<% if @users.any? %>
<h3 class="margin"><%= page_entries_info @users %></h3>
<table id="administrators">
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td class="text-right">
<% if user.administrator? && user.administrator.persisted? %>
<%= link_to t('admin.administrators.administrator.delete'),
admin_administrator_path(user),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.administrators.administrator.add'),
{ controller: "admin/administrators",
action: :create,
user_id: user },
method: :post,
class: "button success" %>
<table>
<thead>
<th scope="col"><%= t("admin.administrators.index.name") %></th>
<th scope="col"><%= t("admin.administrators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td class="text-right">
<% if user.administrator? && user.administrator.persisted? %>
<%= link_to t('admin.administrators.administrator.delete'),
admin_administrator_path(user),
method: :delete,
class: "button hollow alert expanded" %>
<% else %>
<%= link_to t('admin.administrators.administrator.add'),
{ controller: "admin/administrators",
action: :create,
user_id: user },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</td>
</tr>
</tbody>
</table>
<% else %>
<div class="callout alert margin">
<%= t("admin.shared.no_search_results") %>
</div>
<% end %>
</table>
</div>

View File

@@ -2,30 +2,50 @@
<%= render 'admin/shared/user_search', url: search_admin_managers_path %>
<h3><%= page_entries_info @managers %></h3>
<div id="managers">
<% if @managers.any? %>
<h3 class="margin"><%= page_entries_info @managers %></h3>
<table id="managers">
<% @managers.each do |manager| %>
<tr>
<td><%= manager.name %></td>
<td><%= manager.email %></td>
<td class="text-right">
<% if manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(manager),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.managers.manager.add'),
{ controller: "admin/managers",
action: :create,
user_id: manager.user_id },
method: :post,
class: "button success" %>
<table>
<thead>
<th scope="col"><%= t("admin.managers.index.name") %></th>
<th scope="col"><%= t("admin.managers.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @managers.each do |manager| %>
<tr>
<td>
<%= manager.name %>
</td>
<td>
<%= manager.email %>
</td>
<td>
<% if manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(manager),
method: :delete,
class: "button hollow alert expanded"
%>
<% else %>
<%= link_to t('admin.managers.manager.add'),
{ controller: "admin/managers",
action: :create,
user_id: manager.user_id },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</td>
</tr>
<% end %>
</table>
</tbody>
</table>
<%= paginate @managers %>
<%= paginate @managers %>
<% else %>
<div class="callout primary">
<%= t("admin.managers.index.no_managers") %>
</div>
<% end %>
</div>

View File

@@ -2,28 +2,43 @@
<%= render 'admin/shared/user_search', url: search_admin_managers_path %>
<h3><%= page_entries_info @users %></h3>
<div id="managers">
<% if @users.any? %>
<h3><%= page_entries_info @users %></h3>
<table id="managers">
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td class="text-right">
<% if user.manager? && user.manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(user),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.managers.manager.add'),
{ controller: "admin/managers",
action: :create,
user_id: user },
method: :post,
class: "button success" %>
<% end %>
</td>
</tr>
<table>
<thead>
<th scope="col"><%= t("admin.managers.index.name") %></th>
<th scope="col"><%= t("admin.managers.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td>
<% if user.manager? && user.manager.persisted? %>
<%= link_to t('admin.managers.manager.delete'),
admin_manager_path(user),
method: :delete,
class: "button hollow alert expanded" %>
<% else %>
<%= link_to t('admin.managers.manager.add'),
{ controller: "admin/managers",
action: :create,
user_id: user },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="callout alert margin">
<%= t("admin.shared.no_search_results") %>
</div>
<% end %>
</table>
</div>

View File

@@ -4,31 +4,49 @@
<%= render 'admin/shared/user_search', url: search_admin_moderators_path %>
<h3><%= page_entries_info @moderators %></h3>
<div id="moderators">
<% if @moderators.any? %>
<h3 class="margin"><%= page_entries_info @moderators %></h3>
<table id="moderators">
<% @moderators.each do |moderator| %>
<tr>
<td><%= moderator.name %></td>
<td><%= moderator.email %></td>
<td class="text-right">
<% if moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(moderator),
method: :delete,
class: "button hollow alert"
%>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),
{ controller: "admin/moderators",
action: :create,
user_id: moderator.user_id },
method: :post,
class: "button success" %>
<table>
<thead>
<th scope="col"><%= t("admin.moderators.index.name") %></th>
<th scope="col" class="small-6"><%= t("admin.moderators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @moderators.each do |moderator| %>
<tr>
<td>
<%= moderator.name %>
</td>
<td>
<%= moderator.email %>
</td>
<td>
<% if moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(moderator),
method: :delete,
class: "button hollow alert expanded"
%>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),
{ controller: "admin/moderators", action: :create,
user_id: moderator.user_id },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</td>
</tr>
<% end %>
</table>
</tbody>
</table>
<%= paginate @moderators %>
<%= paginate @moderators %>
<% else %>
<div class="callout primary">
<%= t("admin.moderators.index.no_moderators") %>
</div>
<% end %>
</div>

View File

@@ -2,28 +2,42 @@
<%= render 'admin/shared/user_search', url: search_admin_moderators_path %>
<h3><%= page_entries_info @users %></h3>
<div id="moderators">
<% if @users.any? %>
<h3 class="margin"><%= page_entries_info @users %></h3>
<table id="moderators">
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td class="text-right">
<% if user.moderator? && user.moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(user),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),
{ controller: "admin/moderators",
action: :create,
user_id: user },
method: :post,
class: "button success" %>
<% end %>
</td>
</tr>
<table id="moderators">
<thead>
<th scope="col"><%= t("admin.moderators.index.name") %></th>
<th scope="col" class="small-6"><%= t("admin.moderators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td>
<% if user.moderator? && user.moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),
admin_moderator_path(user),
method: :delete,
class: "button hollow alert expanded" %>
<% else %>
<%= link_to t('admin.moderators.moderator.add'),
{ controller: "admin/moderators",
action: :create,
user_id: user },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% else %>
<div class="callout alert margin">
<%= t("admin.shared.no_search_results") %>
</div>
<% end %>
</table>
</div>

View File

@@ -1,20 +1,22 @@
<%= back_link_to %>
<%= back_link_to admin_officials_path %>
<div class="clear"></div>
<div class="official float-right"><strong><%= @user.name %></strong> (<%= @user.email %>)</div>
<h2 class="inline-block"><%= t("admin.officials.edit.title") %></h2>
<div class="row">
<div class="small-12 medium-6 column end">
<div class="callout highlight">
<strong><%= @user.name %></strong><br>
<%= @user.email %>
</div>
<div class="small-12 medium-6">
<%= form_for @user, url: admin_official_path(@user) do |f| %>
<%= f.text_field :official_position %>
<%= f.select :official_level, official_level_options %>
<%= f.submit class: "button" %>
<% if @user.official? %>
<%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'button hollow alert' %>
<br>
<%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'delete' %>
<% end %>
<%= f.submit class: "button hollow" %>
<% end %>
</div>
</div>

View File

@@ -2,26 +2,42 @@
<%= render 'admin/shared/user_search', url: search_admin_officials_path %>
<h3><%= page_entries_info @officials %></h3>
<% if @officials.any? %>
<h3 class="margin"><%= page_entries_info @officials %></h3>
<table>
<% @officials.each do |official| %>
<tr>
<td>
<%= link_to official.name, edit_admin_official_path(official) %>
</td>
<td>
<span class="label round level-<%= official.official_level %>">
<%= official.official_position %>
</span>
(<%= t("admin.officials.level_#{official.official_level}") %>)
</td>
<td class="text-right">
<%= link_to official.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"),
edit_admin_official_path(official), class: "button hollow" %>
</td>
</tr>
<% end %>
</table>
<table>
<thead>
<th scope="col"><%= t("admin.officials.index.name") %></th>
<th scope="col"><%= t("admin.officials.index.official_position") %></th>
<th scope="col"><%= t("admin.officials.index.official_level") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @officials.each do |official| %>
<tr>
<td>
<%= link_to official.name, edit_admin_official_path(official) %>
</td>
<td>
<span class="label level-<%= official.official_level %>">
<%= official.official_position %>
</span>
</td>
<td>
<%= t("admin.officials.level_#{official.official_level}") %>
</td>
<td>
<%= link_to official.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"),
edit_admin_official_path(official), class: "button hollow expanded" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @officials %>
<%= paginate @officials %>
<% else %>
<div class="callot primary">
<%= t("admin.officials.index.no_officials") %>
</div>
<% end %>

View File

@@ -2,24 +2,52 @@
<%= render 'admin/shared/user_search', url: search_admin_officials_path %>
<h3><%= page_entries_info @users %></h3>
<% if @users.any? %>
<table>
<% @users.each do |user| %>
<tr>
<td>
<%= link_to user.name, edit_admin_official_path(user) %>
</td>
<td>
<span class="label round level-<%= user.official_level %>">
<%= user.official_position %>
</span>
(<%= t("admin.officials.level_#{user.official_level}") %>)
</td>
<td class="text-right">
<%= link_to user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"),
edit_admin_official_path(user), class: "button hollow" %>
</td>
</tr>
<% end %>
</table>
<h3><%= page_entries_info @users %></h3>
<table>
<thead>
<th scope="col"><%= t("admin.officials.index.name") %></th>
<th scope="col"><%= t("admin.officials.index.official_position") %></th>
<th scope="col"><%= t("admin.officials.index.official_level") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td>
<%= link_to user.name, edit_admin_official_path(user) %>
</td>
<td>
<% if user.official? %>
<span class="label round level-<%= user.official_level %>">
<%= user.official_position %>
</span>
<% else %>
<%= t("admin.officials.level_0") %>
<% end %>
</td>
<td>
<%= t("admin.officials.level_#{user.official_level}") %>
</td>
<td>
<% if user.official? %>
<%= link_to t("admin.officials.search.edit_official"),
edit_admin_official_path(user),
class: "button hollow expanded" %>
<% else %>
<%= link_to t("admin.officials.search.make_official"),
edit_admin_official_path(user),
class: "button expanded" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="callout alert">
<%= t("admin.officials.search.no_results") %>
</div>
<% end %>

View File

@@ -1,67 +1,79 @@
<h2><%= t("admin.organizations.index.title") %></h2>
<!-- Search organizations -->
<%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<div class="small-12 medium-6">
<%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %>
<div class="input-group">
<%= text_field_tag :term, "", placeholder: t("admin.organizations.index.search_placeholder") %>
<div class="input-group-button">
<%= f.submit t("admin.organizations.index.search"), class: "button" %>
</div>
</div>
<div class="form-inline small-12 medium-6 column">
<%= f.submit t("admin.organizations.index.search"), class: "button success" %>
</div>
</div>
<% end %>
<!-- /. Search organizations -->
<% end %>
</div>
<%= render 'shared/filter_subnav', i18n_namespace: "admin.organizations.index" %>
<h3><%= page_entries_info @organizations %></h3>
<% if @organizations.any? %>
<h3 class="margin"><%= page_entries_info @organizations %></h3>
<table>
<% hidden = 0 %>
<% @organizations.each do |organization| %>
<% hidden += 1 and next if organization.user.nil? || organization.user.hidden? %>
<tr id="<%= dom_id(organization) %>">
<td><p><%= organization.name %></p></td>
<td><p><%= organization.email %></p></td>
<td><p><%= organization.phone_number %></p></td>
<td><p><%= organization.responsible_name %></p></td>
<% if organization.verified? %>
<td class="verified text-center">
<span class="icon-check"></span>
<%= t("admin.organizations.index.verified") %>
</td>
<% end %>
<% if can? :verify, organization %>
<table>
<% hidden = 0 %>
<thead>
<th scpope="col"><%= t("admin.organizations.index.name") %></th>
<th scpope="col"><%= t("admin.organizations.index.email") %></th>
<th scpope="col"><%= t("admin.organizations.index.phone_number") %></th>
<th scpope="col"><%= t("admin.organizations.index.responsible_name") %></th>
<th scpope="col"><%= t("admin.organizations.index.status") %></th>
<th scpope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @organizations.each do |organization| %>
<% hidden += 1 and next if organization.user.nil? || organization.user.hidden? %>
<tr id="<%= dom_id(organization) %>">
<td><%= organization.name %></td>
<td><%= organization.email %></td>
<td><%= organization.phone_number %></td>
<td><%= organization.responsible_name %></td>
<td>
<%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button success expanded"
%>
<% if organization.verified? %>
<span class="icon-check"></span>
<%= t("admin.organizations.index.verified") %>
<% elsif organization.rejected? %>
<span class="icon-x rejected"></span>
<%= t("admin.organizations.index.rejected") %>
<% else %>
<span class="icon-eye"></span>
<%= t("admin.organizations.index.pending") %>
<% end %>
</td>
<% end %>
<% if organization.rejected? %>
<td class="rejected text-center">
<span class="icon-x"></span>
<%= t("admin.organizations.index.rejected") %>
</td>
<% end %>
<% if can? :reject, organization %>
<td>
<%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button hollow alert expanded"
%>
</td>
<% end %>
</tr>
<% end %>
</table>
<% if can? :verify, organization %>
<%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button success small-5" %>
<% end %>
<% if hidden > 0 %>
<% if can? :reject, organization %>
<%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button hollow alert small-5"%>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if hidden > 0 %>
<div class="callout warning">
<%= t("admin.organizations.index.hidden_count_html", count: hidden) %>
</div>
<% end %>
<%= paginate @organizations %>
<% else %>
<div class="callout primary">
<%= t("admin.organizations.index.hidden_count_html", count: hidden) %>
<%= t("admin.organizations.index.no_organizations") %>
</div>
<% end %>
<%= paginate @organizations %>

View File

@@ -1,56 +1,70 @@
<h2><%= t("admin.organizations.search.title") %></h2>
<!-- Search organizations -->
<%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<div class="small-12 medium-6">
<%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %>
<div class="input-group">
<%= text_field_tag :term, "", placeholder: t("admin.organizations.index.search_placeholder") %>
<div class="input-group-button">
<%= f.submit t("admin.organizations.index.search"), class: "button" %>
</div>
</div>
<div class="form-inline small-12 medium-6 column">
<%= f.submit t("admin.organizations.index.search"), class: "button success" %>
<% end %>
</div>
<div id="search-results">
<% if @organizations.any? %>
<h3 class="margin"><%= page_entries_info @organizations %></h3>
<table>
<thead>
<th scpope="col"><%= t("admin.organizations.index.name") %></th>
<th scpope="col"><%= t("admin.organizations.index.email") %></th>
<th scpope="col"><%= t("admin.organizations.index.phone_number") %></th>
<th scpope="col"><%= t("admin.organizations.index.responsible_name") %></th>
<th scpope="col"><%= t("admin.organizations.index.status") %></th>
<th scpope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @organizations.each do |organization| %>
<tr>
<td><%= organization.name %></td>
<td><%= organization.email %></td>
<td><%= organization.phone_number %></td>
<td><%= organization.responsible_name %></td>
<td>
<% if organization.verified? %>
<span class="icon-check"></span>
<%= t("admin.organizations.index.verified") %>
<% elsif organization.rejected? %>
<span class="icon-x"></span>
<%= t("admin.organizations.index.rejected") %>
<% else %>
<span class="icon-eye"></span>
<%= t("admin.organizations.index.pending") %>
<% end %>
</td>
<td>
<% if can? :verify, organization %>
<%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button success small-5" %>
<% end %>
<% if can? :reject, organization %>
<%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button hollow alert small-5" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @organizations %>
<% else %>
<div class="callout alert">
<%= t("admin.organizations.search.no_results") %>
</div>
</div>
<% end %>
<!-- /. Search organizations -->
<h3><%= page_entries_info @organizations %></h3>
<table id="search-results">
<% @organizations.each do |organization| %>
<tr>
<td><p><%= organization.name %></p></td>
<td><p><%= organization.email %></p></td>
<td><p><%= organization.phone_number %></p></td>
<td><p><%= organization.responsible_name %></p></td>
<% if organization.verified? %>
<td class="verified text-center">
<span class="icon-check"></span>
<%= t("admin.organizations.index.verified") %>
</td>
<% end %>
<% if can? :verify, organization %>
<td>
<%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button success expanded"
%>
</td>
<% end %>
<% if organization.rejected? %>
<td class="rejected text-center">
<span class="icon-x"></span>
<%= t("admin.organizations.index.rejected") %>
</td>
<% end %>
<% if can? :reject, organization %>
<td><%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button hollow alert expanded"
%>
</td>
<% end %>
</tr>
<% end %>
</table>
<%= paginate @organizations %>
<% end %>
</div>

View File

@@ -1,10 +1,10 @@
<%= form_for(User.new, url: url, as: :user, method: :get) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<%= text_field_tag :name_or_email, "", placeholder: t("admin.shared.user_search.placeholder") %>
<div class="small-12 medium-6">
<%= form_for(User.new, url: url, as: :user, method: :get) do |f| %>
<div class="input-group">
<%= text_field_tag :name_or_email, "", placeholder: t("admin.shared.user_search.placeholder") %>
<div class="input-group-button">
<%= f.submit t("admin.shared.user_search.button"), class: "button" %>
</div>
</div>
<div class="form-inline small-12 medium-6 column">
<%= f.submit t("admin.shared.user_search.button"), class: "button success" %>
</div>
</div>
<% end %>
<% end %>
</div>

View File

@@ -1,24 +1,32 @@
<h3><%= page_entries_info @users %></h3>
<% if @users.any? %>
<h3 class="margin"><%= page_entries_info @users %></h3>
<table>
<thead>
<tr>
<th><%= t('admin.users.columns.name') %></th>
<th><%= t('admin.users.columns.email') %></th>
<th><%= t('admin.users.columns.document_number') %></th>
<th><%= t('admin.users.columns.roles') %></th>
<th><%= t('admin.users.columns.verification_level') %></th>
<th scope="col"><%= t("admin.users.columns.name") %></th>
<th scope="col"><%= t("admin.users.columns.email") %></th>
<th scope="col"><%= t("admin.users.columns.document_number") %></th>
<th scope="col"><%= t("admin.users.columns.roles") %></th>
<th scope="col"><%= t("admin.users.columns.verification_level") %></th>
</tr>
</thead>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td><%= user.document_number %></td>
<td><%= display_user_roles(user) %></td>
<td><%= user.user_type %></td>
</tr>
<% end %>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td><%= user.document_number %></td>
<td><%= display_user_roles(user) %></td>
<td><%= user.user_type %></td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @users %>
<%= paginate @users %>
<% else %>
<div class="callout primary">
<%= t("admin.users.index.no_users") %>
</div>
<% end %>

View File

@@ -1,16 +1,17 @@
<h2><%= t("admin.users.index.title") %></h2>
<div class="row">
<div class="small-12 medium-6">
<%= form_tag admin_users_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<div class="input-group">
<%= text_field_tag :search, '', placeholder: t('admin.users.search.placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.users.search.search'), class: 'button' %>
<div class="input-group-button">
<%= submit_tag t('admin.users.search.search'), class: 'button' %>
</div>
</div>
<% end %>
</div>
<div id="users">
<div id="users">
<%= render "users" %>
</div>

View File

@@ -2,16 +2,41 @@
<%= render 'admin/shared/user_search', url: search_admin_valuators_path %>
<h3><%= page_entries_info @valuators %></h3>
<div id="valuators">
<% if @valuators.any? %>
<h3 class="margin"><%= page_entries_info @valuators %></h3>
<table id="valuators">
<% @valuators.each do |valuator| %>
<tr>
<td><%= valuator.name %></td>
<td><%= valuator.email %></td>
<td><%= valuator.description if valuator.description.present? %></td>
</tr>
<table>
<thead>
<th scope="col"><%= t("admin.valuators.index.name") %></th>
<th scope="col"><%= t("admin.valuators.index.email") %></th>
<th scope="col"><%= t("admin.valuators.index.description") %></th>
</thead>
<tbody>
<% @valuators.each do |valuator| %>
<tr>
<td>
<%= valuator.name %>
</td>
<td>
<%= valuator.email %>
</td>
<td>
<% if valuator.description.present? %>
<%= valuator.description %>
<% else %>
<%= t("admin.valuators.index.no_description") %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @valuators %>
<% else %>
<div class="callout primary">
<%= t("admin.valuators.index.no_valuators") %>
</div>
<% end %>
</table>
<%= paginate @valuators %>
</div>

View File

@@ -2,26 +2,50 @@
<%= render 'admin/shared/user_search', url: search_admin_valuators_path %>
<h3><%= page_entries_info @users %></h3>
<div id="valuators">
<% if @users.any? %>
<h3 class="margin"><%= page_entries_info @users %></h3>
<table id="valuators">
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td class="float-right">
<% if user.valuator? && user.valuator.description.present? %>
<%= user.valuator.description %>
<% else %>
<%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %>
<%= f.text_field :description,
label: false,
placeholder: t("admin.valuators.valuator.description_placeholder") %>
<%= f.hidden_field :user_id %>
<%= f.submit t("admin.valuators.valuator.add"), class: "button success float-left" %>
<% end %>
<table>
<thead>
<th scope="col"><%= t("admin.valuators.index.name") %></th>
<th scope="col"><%= t("admin.valuators.index.email") %></th>
<th scope="col"><%= t("admin.valuators.index.description") %></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>
<% if user.valuator? %>
<% if user.valuator.description.present? %>
<%= user.valuator.description %>
<% else %>
<%= t("admin.valuators.index.no_description") %>
<% end %>
<% else %>
<%= t("admin.valuators.index.no_description") %>
<% end %>
<td>
<% unless user.valuator? %>
<%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %>
<%= f.text_field :description,
label: false,
placeholder: t("admin.valuators.valuator.description_placeholder") %>
<%= f.hidden_field :user_id %>
<%= f.submit t("admin.valuators.valuator.add"), class: "button success expanded" %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</td>
</tr>
</tbody>
</table>
<% else %>
<div class="callout alert margin">
<%= t("admin.shared.no_search_results") %>
</div>
<% end %>
</table>
</div>

View File

@@ -31,6 +31,12 @@ en:
administrator:
one: "Administrator"
other: "Administrators"
valuator:
one: "Evaluador"
other: "Evaluadores"
manager:
one: "Manager"
other: "Managers"
vote:
one: "Vote"
other: "Votes"

View File

@@ -62,6 +62,7 @@ en:
on_users: Users
title: Moderator activity
type: Type
no_activity: There ares no moderators activity.
budgets:
index:
title: Participatory budgets
@@ -382,6 +383,9 @@ en:
managers:
index:
title: Managers
name: Name
email: Email
no_managers: There are no managers.
manager:
add: Add
delete: Delete
@@ -431,15 +435,21 @@ en:
administrators:
index:
title: Administrators
name: Name
email: Email
no_administrators: There are no administrators.
administrator:
add: Add
delete: Delete
restricted_removal: "Sorry, you can't remove yourself from the administrators"
search:
title: 'Administrators: User search'
title: "Administrators: User search"
moderators:
index:
title: Moderators
name: Name
email: Email
no_moderators: There are no moderators.
moderator:
add: Add
delete: Delete
@@ -452,6 +462,11 @@ en:
valuators:
index:
title: Valuators
name: Name
email: Email
description: Description
no_description: No description
no_valuators: There are no valuators.
valuator:
description_placeholder: 'Description (optional)'
add: Add to valuators
@@ -694,6 +709,10 @@ en:
official_updated: Details of official saved
index:
title: Officials
no_officials: There are no officials.
name: Nombre
official_position: Official position
official_level: Level
level_0: Not official
level_1: Level 1
level_2: Level 2
@@ -704,6 +723,7 @@ en:
edit_official: Edit official
make_official: Make official
title: 'Official positions: User search'
no_results: Official positions not found.
organizations:
index:
filter: Filter
@@ -715,6 +735,12 @@ en:
hidden_count_html:
one: There is also <strong>one organisation</strong> with no users or with a hidden user.
other: There are <strong>%{count} organisations</strong> with no users or with a hidden user.
name: Name
email: Email
phone_number: Phone
responsible_name: Responsible
status: Status
no_organizations: There are no organizations.
reject: Reject
rejected: Rejected
search: Search
@@ -722,8 +748,10 @@ en:
title: Organisations
verified: Verified
verify: Verify
pending: Pending
search:
title: Search Organisations
no_results: No organizations found.
proposals:
index:
filter: Filter
@@ -939,6 +967,7 @@ en:
verification_level: Verification level
index:
title: User
no_users: There are no users.
search:
placeholder: Search user by email, name or document number
search: Search

View File

@@ -31,6 +31,12 @@ es:
administrator:
one: "Administrador"
other: "Administradores"
valuator:
one: "Evaluador"
other: "Evaluadores"
manager:
one: "Gestor"
other: "Gestores"
vote:
one: "Voto"
other: "Votos"

View File

@@ -60,8 +60,9 @@ es:
on_debates: Debates
on_proposals: Propuestas
on_users: Usuarios
title: Actividad de los Moderadores
title: Actividad de Moderadores
type: Tipo
no_activity: No hay actividad de moderadores.
budgets:
index:
title: Presupuestos participativos
@@ -382,15 +383,21 @@ es:
administrators:
index:
title: Administradores
name: Nombre
email: Email
no_administrators: No hay administradores.
administrator:
add: Añadir como Administrador
delete: Borrar
restricted_removal: "Lo sentimos, no puedes eliminarte a ti mismo de la lista"
search:
title: 'Administradores: Búsqueda de usuarios'
title: "Administradores: Búsqueda de usuarios"
managers:
index:
title: Gestores
name: Nombre
email: Email
no_managers: No hay gestores.
manager:
add: Añadir como Gestor
delete: Borrar
@@ -440,6 +447,9 @@ es:
moderators:
index:
title: Moderadores
name: Nombre
email: Email
no_moderators: No hay moderadores.
moderator:
add: Añadir como Moderador
delete: Borrar
@@ -452,6 +462,11 @@ es:
valuators:
index:
title: Evaluadores
name: Nombre
email: Email
description: Descripción
no_description: Sin descripción
no_valuators: No hay evaluadores.
valuator:
description_placeholder: "Descripción (opcional)"
add: Añadir como evaluador
@@ -696,6 +711,10 @@ es:
official_updated: Datos del cargo público guardados
index:
title: Cargos Públicos
no_officials: No hay cargos públicos.
name: Nombre
official_position: Cargo público
official_level: Nivel
level_0: No es cargo público
level_1: Nivel 1
level_2: Nivel 2
@@ -706,6 +725,7 @@ es:
edit_official: Editar cargo público
make_official: Convertir en cargo público
title: 'Cargos Públicos: Búsqueda de usuarios'
no_results: No se han encontrado cargos públicos.
organizations:
index:
filter: Filtro
@@ -717,6 +737,12 @@ es:
hidden_count_html:
one: Hay además <strong>una organización</strong> sin usuario o con el usuario bloqueado.
other: Hay <strong>%{count} organizaciones</strong> sin usuario o con el usuario bloqueado.
name: Nombre
email: Email
phone_number: Teléfono
responsible_name: Responsable
status: Estado
no_organizations: No hay organizaciones.
reject: Rechazar
rejected: Rechazada
search: Buscar
@@ -724,8 +750,10 @@ es:
title: Organizaciones
verified: Verificada
verify: Verificar
pending: Pendiente
search:
title: Buscar Organizaciones
no_results: No se han encontrado organizaciones.
proposals:
index:
filter: Filtro
@@ -941,6 +969,7 @@ es:
verification_level: Nivel de verficación
index:
title: Usuarios
no_users: No hay usuarios.
search:
placeholder: Buscar usuario por email, nombre o DNI
search: Buscar

View File

@@ -60,7 +60,7 @@ feature 'Admin administrators' do
click_button 'Search'
expect(page).to have_content('Administrators: User search')
expect(page).to have_content('users cannot be found')
expect(page).to have_content('No results found')
expect(page).to_not have_content(@administrator1.name)
expect(page).to_not have_content(@administrator2.name)
end

View File

@@ -52,7 +52,7 @@ feature 'Admin managers' do
click_button 'Search'
expect(page).to have_content('Managers: User search')
expect(page).to have_content('users cannot be found')
expect(page).to have_content('No results found')
expect(page).to_not have_content(@manager1.name)
expect(page).to_not have_content(@manager2.name)
end

View File

@@ -52,7 +52,7 @@ feature 'Admin moderators' do
click_button 'Search'
expect(page).to have_content('Moderators: User search')
expect(page).to have_content('users cannot be found')
expect(page).to have_content('No results found')
expect(page).to_not have_content(@moderator1.name)
expect(page).to_not have_content(@moderator2.name)
end

View File

@@ -47,7 +47,7 @@ feature 'Admin valuators' do
click_button 'Search'
expect(page).to have_content('Valuators: User search')
expect(page).to have_content('users cannot be found')
expect(page).to have_content('No results found')
expect(page).to_not have_content(@valuator1.name)
expect(page).to_not have_content(@valuator2.name)
end