show info of hidden users in admin/organizations
This commit is contained in:
@@ -9,7 +9,7 @@ class Admin::OrganizationsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@organizations = Organization.search(params[:term]).page(params[:page])
|
||||
@organizations = Organization.includes(:user).search(params[:term]).page(params[:page])
|
||||
end
|
||||
|
||||
def verify
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
<h3><%= 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><%= organization.name %></td>
|
||||
<td><%= organization.email %></td>
|
||||
@@ -54,4 +56,6 @@
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= t("admin.organizations.index.hidden_count", count: hidden) if hidden > 0 %>
|
||||
|
||||
<%= paginate @organizations %>
|
||||
|
||||
@@ -34,6 +34,9 @@ en:
|
||||
pending: Pending
|
||||
verified: Verified
|
||||
rejected: Rejected
|
||||
hidden_count:
|
||||
one: "There is %{count} organization without user or with the user banned"
|
||||
other: "There is %{count} organizations without user or with the user banned"
|
||||
search:
|
||||
title: "Search Organizations"
|
||||
actions:
|
||||
|
||||
@@ -34,6 +34,9 @@ es:
|
||||
pending: Pendientes
|
||||
verified: Verificadas
|
||||
rejected: Rechazadas
|
||||
hidden_count:
|
||||
one: "Hay además una organización sin usuario o con el usuario bloqueado"
|
||||
other: "Hay %{count} organizaciones sin usuario o con el usuario bloqueado"
|
||||
search:
|
||||
title: "Buscar Organizaciones"
|
||||
actions:
|
||||
|
||||
@@ -9,6 +9,23 @@ feature 'Admin::Organizations' do
|
||||
login_as(administrator)
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
scenario "shows info on organizations with hidden users" do
|
||||
troll = create(:user, email: "trol@troller.com")
|
||||
create(:organization, user: troll, name: "Greentroll")
|
||||
org = create(:organization, name: "Human Rights")
|
||||
troll.hide
|
||||
|
||||
visit admin_organizations_path
|
||||
|
||||
expect(page).to have_content("Human Rights")
|
||||
expect(page).to have_content(org.user.email)
|
||||
expect(page).to_not have_content("Greentroll")
|
||||
expect(page).to_not have_content("trol@troller.com")
|
||||
expect(page).to have_content("There is 1 organization without user or with the user banned")
|
||||
end
|
||||
end
|
||||
|
||||
context "Search" do
|
||||
|
||||
background do
|
||||
|
||||
Reference in New Issue
Block a user