Merge pull request #4277 from consul/admin_search
Refactor admin search forms
This commit is contained in:
17
app/assets/stylesheets/admin/search.css
Normal file
17
app/assets/stylesheets/admin/search.css
Normal file
@@ -0,0 +1,17 @@
|
||||
.admin [role=search] {
|
||||
display: flex;
|
||||
|
||||
[type="submit"] {
|
||||
@include button($background: $link);
|
||||
border-radius: 0;
|
||||
font-size: 1rem;
|
||||
|
||||
&[disabled] {
|
||||
@include button-disabled;
|
||||
}
|
||||
}
|
||||
|
||||
@include breakpoint(medium) {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
4
app/components/admin/search_component.html.erb
Normal file
4
app/components/admin/search_component.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<%= form_tag(url, options) do |f| %>
|
||||
<%= text_field_tag :search, search_terms.to_s, placeholder: label, "aria-label": label %>
|
||||
<%= submit_tag t("admin.shared.search.search") %>
|
||||
<% end %>
|
||||
23
app/components/admin/search_component.rb
Normal file
23
app/components/admin/search_component.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class Admin::SearchComponent < ApplicationComponent
|
||||
attr_reader :label, :form_options
|
||||
|
||||
def initialize(label:, url: nil, **form_options)
|
||||
@label = label
|
||||
@url = url
|
||||
@form_options = form_options
|
||||
end
|
||||
|
||||
def url
|
||||
@url || request.path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def search_terms
|
||||
params[:search]
|
||||
end
|
||||
|
||||
def options
|
||||
{ method: :get, role: "search" }.merge(form_options)
|
||||
end
|
||||
end
|
||||
@@ -6,7 +6,7 @@ class Admin::AdministratorsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.search(params[:name_or_email])
|
||||
@users = User.search(params[:search])
|
||||
.includes(:administrator)
|
||||
.page(params[:page])
|
||||
.for_render
|
||||
|
||||
@@ -6,7 +6,7 @@ class Admin::ManagersController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.search(params[:name_or_email])
|
||||
@users = User.search(params[:search])
|
||||
.includes(:manager)
|
||||
.page(params[:page])
|
||||
.for_render
|
||||
|
||||
@@ -6,7 +6,7 @@ class Admin::ModeratorsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.search(params[:name_or_email])
|
||||
@users = User.search(params[:search])
|
||||
.includes(:moderator)
|
||||
.page(params[:page])
|
||||
.for_render
|
||||
|
||||
@@ -4,7 +4,7 @@ class Admin::OfficialsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.search(params[:name_or_email]).page(params[:page]).for_render
|
||||
@users = User.search(params[:search]).page(params[:page]).for_render
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
@@ -12,7 +12,7 @@ class Admin::OrganizationsController < Admin::BaseController
|
||||
|
||||
def search
|
||||
@organizations = Organization.includes(:user)
|
||||
.search(params[:term])
|
||||
.search(params[:search])
|
||||
.order("users.created_at", :name, "users.email")
|
||||
.page(params[:page])
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Admin::Poll::OfficersController < Admin::Poll::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@user = User.find_by(email: params[:email])
|
||||
@user = User.find_by(email: params[:search])
|
||||
|
||||
respond_to do |format|
|
||||
if @user
|
||||
|
||||
@@ -7,8 +7,6 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
||||
|
||||
def index
|
||||
@polls = Poll.not_budget
|
||||
@search = search_params[:search]
|
||||
|
||||
@questions = @questions.search(search_params).page(params[:page]).order("created_at DESC")
|
||||
|
||||
@proposals = Proposal.successful.sort_by_confidence_score
|
||||
|
||||
@@ -10,7 +10,7 @@ class Admin::ValuatorsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.search(params[:name_or_email])
|
||||
@users = User.search(params[:search])
|
||||
.includes(:valuator)
|
||||
.page(params[:page])
|
||||
.for_render
|
||||
|
||||
@@ -4,7 +4,7 @@ class Admin::VerificationsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.incomplete_verification.search(params[:name_or_email])
|
||||
@users = User.incomplete_verification.search(params[:search])
|
||||
.page(params[:page])
|
||||
.for_render
|
||||
render :index
|
||||
|
||||
@@ -21,7 +21,7 @@ class Moderation::UsersController < Moderation::BaseController
|
||||
private
|
||||
|
||||
def load_users
|
||||
@users = User.with_hidden.search(params[:name_or_email]).page(params[:page]).for_render
|
||||
@users = User.with_hidden.search(params[:search]).page(params[:page]).for_render
|
||||
end
|
||||
|
||||
def block_user
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<h2><%= t("admin.debates.index.title") %></h2>
|
||||
|
||||
<% if @debates.any? %>
|
||||
<%= render "/admin/shared/debate_search", url: admin_debates_path %>
|
||||
<%= render Admin::SearchComponent.new(label: t("admin.shared.debate_search.placeholder")) %>
|
||||
|
||||
<h3 class="inline-block"><%= page_entries_info @debates %></h3>
|
||||
|
||||
|
||||
@@ -8,16 +8,10 @@
|
||||
new_admin_local_census_records_import_path,
|
||||
class: "button float-right hollow" %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= form_tag admin_local_census_records_path, method: :get, remote: true do %>
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :search, "", placeholder: t("admin.local_census_records.index.search.placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= submit_tag t("admin.local_census_records.index.search.search"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render Admin::SearchComponent.new(
|
||||
label: t("admin.local_census_records.index.search.placeholder"),
|
||||
remote: true
|
||||
) %>
|
||||
|
||||
<div id="local_census_records">
|
||||
<%= render "local_census_records" %>
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
<h2><%= t("admin.organizations.index.title") %></h2>
|
||||
|
||||
<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>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render Admin::SearchComponent.new(
|
||||
url: search_admin_organizations_path,
|
||||
label: t("admin.organizations.index.search_placeholder")
|
||||
) %>
|
||||
|
||||
<%= render "shared/filter_subnav", i18n_namespace: "admin.organizations.index" %>
|
||||
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
<h2><%= t("admin.organizations.search.title") %></h2>
|
||||
|
||||
<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>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render Admin::SearchComponent.new(label: t("admin.organizations.index.search_placeholder")) %>
|
||||
|
||||
<div id="search-results">
|
||||
<% if @organizations.any? %>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
@search,
|
||||
placeholder: t("admin.shared.booths_search.placeholder"), id: "search-booths" %>
|
||||
<div class="input-group-button">
|
||||
<%= submit_tag t("admin.shared.booths_search.button"), class: "button" %>
|
||||
<%= submit_tag t("admin.shared.search.search"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button float-right" %>
|
||||
<% end %>
|
||||
|
||||
<%= render "/admin/shared/booth_search", url: admin_booths_path %>
|
||||
<%= render Admin::SearchComponent.new(label: t("admin.shared.booths_search.placeholder")) %>
|
||||
|
||||
<% if @booths.empty? %>
|
||||
<div class="callout primary">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
@search,
|
||||
placeholder: t("admin.shared.poll_officers_search.placeholder"), id: "search-officers" %>
|
||||
<div class="input-group-button">
|
||||
<%= submit_tag t("admin.shared.poll_officers_search.button"), class: "button" %>
|
||||
<%= submit_tag t("admin.shared.search.search"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<p><%= t("admin.poll_officers.search.help") %></p>
|
||||
|
||||
<%= form_tag search_admin_officers_path, method: :get, remote: true do %>
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :email, "",
|
||||
placeholder: t("admin.poll_officers.search.email_placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= submit_tag t("admin.poll_officers.search.search"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render Admin::SearchComponent.new(
|
||||
url: search_admin_officers_path,
|
||||
label: t("admin.poll_officers.search.email_placeholder"),
|
||||
remote: true
|
||||
) %>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<h2><%= t("admin.poll_officers.index.title") %></h2>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= render "search" %>
|
||||
</div>
|
||||
<%= render "search" %>
|
||||
|
||||
<div id="search-result"></div>
|
||||
|
||||
|
||||
@@ -1,10 +1 @@
|
||||
<%= form_tag(admin_questions_path, method: :get) do |f| %>
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :search,
|
||||
@search,
|
||||
placeholder: t("admin.shared.poll_questions_search.placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= submit_tag t("admin.shared.poll_questions_search.button"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render Admin::SearchComponent.new(label: t("admin.shared.poll_questions_search.placeholder")) %>
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
<%= link_to t("admin.questions.index.create"), new_admin_question_path,
|
||||
class: "button float-right" %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= render "search" %>
|
||||
</div>
|
||||
<%= render "search" %>
|
||||
|
||||
<div class="tabs-content" data-tabs-content="questions-tabs">
|
||||
<%= render "filter_subnav" %>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<h2><%= t("admin.proposals.index.title") %></h2>
|
||||
|
||||
<% if @proposals.any? %>
|
||||
<%= render "/admin/shared/proposal_search", url: admin_proposals_path %>
|
||||
<%= render Admin::SearchComponent.new(label: t("admin.shared.proposal_search.placeholder")) %>
|
||||
|
||||
<h3><%= page_entries_info @proposals %></h3>
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<%= form_for(Poll::Booth.new, url: url, as: :booth, method: :get) do |f| %>
|
||||
<div class="small-12 medium-6">
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :search, params[:search], placeholder: t("admin.shared.booths_search.placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= f.submit t("admin.shared.booths_search.button"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,10 +0,0 @@
|
||||
<%= form_for(Debate.new, url: url, as: :debate, method: :get) do |f| %>
|
||||
<div class="small-12 medium-6">
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :search, "", placeholder: t("admin.shared.debate_search.placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= f.submit t("admin.shared.debate_search.button"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,10 +0,0 @@
|
||||
<%= form_for(Proposal.new, url: url, as: :proposal, method: :get) do |f| %>
|
||||
<div class="small-12 medium-6">
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :search, "", placeholder: t("admin.shared.proposal_search.placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= f.submit t("admin.shared.proposal_search.button"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,10 +1 @@
|
||||
<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>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render Admin::SearchComponent.new(url: url, label: t("admin.shared.user_search.placeholder")) %>
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
<h2><%= t("admin.users.index.title") %></h2>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= form_tag admin_users_path, method: :get, remote: true do %>
|
||||
<div class="input-group">
|
||||
<%= text_field_tag :search, "", placeholder: t("admin.users.search.placeholder") %>
|
||||
<div class="input-group-button">
|
||||
<%= submit_tag t("admin.users.search.search"), class: "button" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render Admin::SearchComponent.new(
|
||||
label: t("admin.users.search.placeholder"),
|
||||
remote: true
|
||||
) %>
|
||||
|
||||
<div id="users">
|
||||
<%= render "users" %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<main>
|
||||
<h2><%= t("management.proposals.index.title") %></h2>
|
||||
|
||||
<%= render "admin/shared/proposal_search", url: management_proposals_path %>
|
||||
<%= render Admin::SearchComponent.new(label: t("admin.shared.proposal_search.placeholder")) %>
|
||||
|
||||
<div class="management-list">
|
||||
<div class="proposals-list">
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
<h2><%= t("moderation.users.index.title") %></h2>
|
||||
|
||||
<%= form_for(User.new, url: moderation_users_path, as: :user, method: :get) do |f| %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= text_field_tag :name_or_email, "", placeholder: t("moderation.users.index.search_placeholder") %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.submit t("moderation.users.index.search"), class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render Admin::SearchComponent.new(label: t("moderation.users.index.search_placeholder")) %>
|
||||
|
||||
<% if @users.present? %>
|
||||
<h3><%= page_entries_info @users %></h3>
|
||||
|
||||
@@ -907,7 +907,6 @@ en:
|
||||
entry_name: officer
|
||||
search:
|
||||
email_placeholder: Search user by email
|
||||
search: Search
|
||||
user_not_found: User not found
|
||||
help: "To add or remove Poll officers use the search form below."
|
||||
poll_officer_assignments:
|
||||
@@ -1170,7 +1169,6 @@ en:
|
||||
no_organizations: There are no organizations.
|
||||
reject: Reject
|
||||
rejected: Rejected
|
||||
search: Search
|
||||
search_placeholder: Name, email or phone number
|
||||
title: Organisations
|
||||
verified: Verified
|
||||
@@ -1255,23 +1253,19 @@ en:
|
||||
shared:
|
||||
true_value: "Yes"
|
||||
false_value: "No"
|
||||
search:
|
||||
search: "Search"
|
||||
booths_search:
|
||||
button: Search
|
||||
placeholder: Search booth by name or location
|
||||
poll_officers_search:
|
||||
button: Search
|
||||
placeholder: Search poll officers
|
||||
poll_questions_search:
|
||||
button: Search
|
||||
placeholder: Search poll questions
|
||||
proposal_search:
|
||||
button: Search
|
||||
placeholder: Search proposals by title, code, description or question
|
||||
debate_search:
|
||||
button: Search
|
||||
placeholder: Search debates by title or description
|
||||
user_search:
|
||||
button: Search
|
||||
placeholder: Search user by name or email
|
||||
search_results: "Search results"
|
||||
no_search_results: "No results found."
|
||||
@@ -1440,7 +1434,6 @@ en:
|
||||
erased: Erased
|
||||
search:
|
||||
placeholder: Search user by email, name or document number
|
||||
search: Search
|
||||
verifications:
|
||||
index:
|
||||
phone_not_given: Phone not given
|
||||
@@ -1581,7 +1574,6 @@ en:
|
||||
postal_code: Postal code
|
||||
search:
|
||||
placeholder: Search by document number
|
||||
search: Search
|
||||
import: Import CSV
|
||||
new:
|
||||
creating: Creating new local census record
|
||||
|
||||
@@ -111,7 +111,6 @@ en:
|
||||
index:
|
||||
hidden: Blocked
|
||||
hide: Block
|
||||
search: Search
|
||||
search_placeholder: email or name of user
|
||||
title: Block users
|
||||
notice_hide: User blocked. All of this user's debates and comments have been hidden.
|
||||
|
||||
@@ -906,7 +906,6 @@ es:
|
||||
entry_name: presidente de mesa
|
||||
search:
|
||||
email_placeholder: Buscar usuario por email
|
||||
search: Buscar
|
||||
user_not_found: Usuario no encontrado
|
||||
help: "Para añadir o eliminar Presidentes de mesa utiliza el buscador a continuación."
|
||||
poll_officer_assignments:
|
||||
@@ -1169,7 +1168,6 @@ es:
|
||||
no_organizations: No hay organizaciones.
|
||||
reject: Rechazar
|
||||
rejected: Rechazada
|
||||
search: Buscar
|
||||
search_placeholder: Nombre, email o teléfono
|
||||
title: Organizaciones
|
||||
verified: Verificada
|
||||
@@ -1254,23 +1252,19 @@ es:
|
||||
shared:
|
||||
true_value: "Sí"
|
||||
false_value: "No"
|
||||
search:
|
||||
search: "Buscar"
|
||||
booths_search:
|
||||
button: Buscar
|
||||
placeholder: Buscar urna por nombre
|
||||
poll_officers_search:
|
||||
button: Buscar
|
||||
placeholder: Buscar presidentes de mesa
|
||||
poll_questions_search:
|
||||
button: Buscar
|
||||
placeholder: Buscar preguntas
|
||||
proposal_search:
|
||||
button: Buscar
|
||||
placeholder: Buscar propuestas por título, código, descripción o pregunta
|
||||
debate_search:
|
||||
button: Buscar
|
||||
placeholder: Buscar debates por título o descripción
|
||||
user_search:
|
||||
button: Buscar
|
||||
placeholder: Buscar usuario por nombre o email
|
||||
search_results: "Resultados de la búsqueda"
|
||||
no_search_results: "No se han encontrado resultados."
|
||||
@@ -1439,7 +1433,6 @@ es:
|
||||
erased: Borrados
|
||||
search:
|
||||
placeholder: Buscar usuario por email, nombre o DNI
|
||||
search: Buscar
|
||||
verifications:
|
||||
index:
|
||||
phone_not_given: No ha dado su teléfono
|
||||
@@ -1580,7 +1573,6 @@ es:
|
||||
postal_code: Código postal
|
||||
search:
|
||||
placeholder: Búsqueda por número de documento
|
||||
search: Buscar
|
||||
import: Importar CSV
|
||||
new:
|
||||
creating: Creando nuevo registro de censo local
|
||||
@@ -1605,4 +1597,4 @@ es:
|
||||
errored: Filas erróneas
|
||||
created: Registros creados
|
||||
local_census_records:
|
||||
no_records_found: No se han encontrado registros.
|
||||
no_records_found: No se han encontrado registros.
|
||||
|
||||
@@ -111,7 +111,6 @@ es:
|
||||
index:
|
||||
hidden: Bloqueado
|
||||
hide: Bloquear
|
||||
search: Buscar
|
||||
search_placeholder: email o nombre de usuario
|
||||
title: Bloquear usuarios
|
||||
notice_hide: Usuario bloqueado. Se han ocultado todos sus debates y comentarios.
|
||||
|
||||
@@ -7,9 +7,9 @@ describe Moderation::UsersController do
|
||||
it "keeps query parameters while using protected redirects" do
|
||||
user = create(:user, email: "user@consul.dev")
|
||||
|
||||
get :hide_in_moderation_screen, params: { id: user, name_or_email: "user@consul.dev", host: "evil.dev" }
|
||||
get :hide_in_moderation_screen, params: { id: user, search: "user@consul.dev", host: "evil.dev" }
|
||||
|
||||
expect(response).to redirect_to "/moderation/users?name_or_email=user%40consul.dev"
|
||||
expect(response).to redirect_to "/moderation/users?search=user%40consul.dev"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -223,7 +223,7 @@ describe "Admin activity" do
|
||||
scenario "Shows moderation activity from moderation screen" do
|
||||
user = create(:user)
|
||||
|
||||
visit moderation_users_path(name_or_email: user.username)
|
||||
visit moderation_users_path(search: user.username)
|
||||
|
||||
within("#moderation_users") do
|
||||
click_link "Block"
|
||||
|
||||
@@ -19,7 +19,7 @@ describe "Admin administrators" do
|
||||
end
|
||||
|
||||
scenario "Create Administrator", :js do
|
||||
fill_in "name_or_email", with: user.email
|
||||
fill_in "search", with: user.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content user.name
|
||||
@@ -66,7 +66,7 @@ describe "Admin administrators" do
|
||||
expect(page).to have_content(administrator1.name)
|
||||
expect(page).to have_content(administrator2.name)
|
||||
|
||||
fill_in "name_or_email", with: " "
|
||||
fill_in "search", with: " "
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Administrators: User search")
|
||||
@@ -79,10 +79,11 @@ describe "Admin administrators" do
|
||||
expect(page).to have_content(administrator1.name)
|
||||
expect(page).to have_content(administrator2.name)
|
||||
|
||||
fill_in "name_or_email", with: "Sumn"
|
||||
fill_in "search", with: "Sumn"
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Administrators: User search")
|
||||
expect(page).to have_field "search", with: "Sumn"
|
||||
expect(page).to have_content(administrator1.name)
|
||||
expect(page).not_to have_content(administrator2.name)
|
||||
end
|
||||
@@ -91,10 +92,11 @@ describe "Admin administrators" do
|
||||
expect(page).to have_content(administrator1.email)
|
||||
expect(page).to have_content(administrator2.email)
|
||||
|
||||
fill_in "name_or_email", with: administrator2.email
|
||||
fill_in "search", with: administrator2.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Administrators: User search")
|
||||
expect(page).to have_field "search", with: administrator2.email
|
||||
expect(page).to have_content(administrator2.email)
|
||||
expect(page).not_to have_content(administrator1.email)
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "Admin managers", :admin do
|
||||
end
|
||||
|
||||
scenario "Create Manager", :js do
|
||||
fill_in "name_or_email", with: user.email
|
||||
fill_in "search", with: user.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content user.name
|
||||
@@ -47,7 +47,7 @@ describe "Admin managers", :admin do
|
||||
expect(page).to have_content(manager1.name)
|
||||
expect(page).to have_content(manager2.name)
|
||||
|
||||
fill_in "name_or_email", with: " "
|
||||
fill_in "search", with: " "
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Managers: User search")
|
||||
@@ -60,10 +60,11 @@ describe "Admin managers", :admin do
|
||||
expect(page).to have_content(manager1.name)
|
||||
expect(page).to have_content(manager2.name)
|
||||
|
||||
fill_in "name_or_email", with: "Taylor"
|
||||
fill_in "search", with: "Taylor"
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Managers: User search")
|
||||
expect(page).to have_field "search", with: "Taylor"
|
||||
expect(page).to have_content(manager1.name)
|
||||
expect(page).not_to have_content(manager2.name)
|
||||
end
|
||||
@@ -72,10 +73,11 @@ describe "Admin managers", :admin do
|
||||
expect(page).to have_content(manager1.email)
|
||||
expect(page).to have_content(manager2.email)
|
||||
|
||||
fill_in "name_or_email", with: manager2.email
|
||||
fill_in "search", with: manager2.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Managers: User search")
|
||||
expect(page).to have_field "search", with: manager2.email
|
||||
expect(page).to have_content(manager2.email)
|
||||
expect(page).not_to have_content(manager1.email)
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "Admin moderators", :admin do
|
||||
end
|
||||
|
||||
scenario "Create Moderator", :js do
|
||||
fill_in "name_or_email", with: user.email
|
||||
fill_in "search", with: user.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content user.name
|
||||
@@ -47,7 +47,7 @@ describe "Admin moderators", :admin do
|
||||
expect(page).to have_content(moderator1.name)
|
||||
expect(page).to have_content(moderator2.name)
|
||||
|
||||
fill_in "name_or_email", with: " "
|
||||
fill_in "search", with: " "
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Moderators: User search")
|
||||
@@ -60,10 +60,11 @@ describe "Admin moderators", :admin do
|
||||
expect(page).to have_content(moderator1.name)
|
||||
expect(page).to have_content(moderator2.name)
|
||||
|
||||
fill_in "name_or_email", with: "Eliz"
|
||||
fill_in "search", with: "Eliz"
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Moderators: User search")
|
||||
expect(page).to have_field "search", with: "Eliz"
|
||||
expect(page).to have_content(moderator1.name)
|
||||
expect(page).not_to have_content(moderator2.name)
|
||||
end
|
||||
@@ -72,10 +73,11 @@ describe "Admin moderators", :admin do
|
||||
expect(page).to have_content(moderator1.email)
|
||||
expect(page).to have_content(moderator2.email)
|
||||
|
||||
fill_in "name_or_email", with: moderator2.email
|
||||
fill_in "search", with: moderator2.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Moderators: User search")
|
||||
expect(page).to have_field "search", with: moderator2.email
|
||||
expect(page).to have_content(moderator2.email)
|
||||
expect(page).not_to have_content(moderator1.email)
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ describe "Admin officials", :admin do
|
||||
|
||||
scenario "Create an official" do
|
||||
visit admin_officials_path
|
||||
fill_in "name_or_email", with: citizen.email
|
||||
fill_in "search", with: citizen.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_current_path(search_admin_officials_path, ignore_query: true)
|
||||
|
||||
@@ -36,7 +36,7 @@ describe "Admin::Organizations" do
|
||||
visit admin_organizations_path
|
||||
expect(page).to have_content("Get up, Stand up")
|
||||
|
||||
fill_in "term", with: " "
|
||||
fill_in "search", with: " "
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_current_path(search_admin_organizations_path, ignore_query: true)
|
||||
@@ -49,7 +49,7 @@ describe "Admin::Organizations" do
|
||||
visit search_admin_organizations_path
|
||||
expect(page).not_to have_content("Get up, Stand up")
|
||||
|
||||
fill_in "term", with: "Up, sta"
|
||||
fill_in "search", with: "Up, sta"
|
||||
click_button "Search"
|
||||
|
||||
within("#search-results") do
|
||||
@@ -61,7 +61,7 @@ describe "Admin::Organizations" do
|
||||
visit search_admin_organizations_path
|
||||
expect(page).not_to have_content("Get up, Stand up")
|
||||
|
||||
fill_in "term", with: user.email
|
||||
fill_in "search", with: user.email
|
||||
click_button "Search"
|
||||
|
||||
within("#search-results") do
|
||||
@@ -73,7 +73,7 @@ describe "Admin::Organizations" do
|
||||
visit search_admin_organizations_path
|
||||
expect(page).not_to have_content("Get up, Stand up")
|
||||
|
||||
fill_in "term", with: user.phone_number
|
||||
fill_in "search", with: user.phone_number
|
||||
click_button "Search"
|
||||
|
||||
within("#search-results") do
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "Admin poll officers", :admin do
|
||||
end
|
||||
|
||||
scenario "Create", :js do
|
||||
fill_in "email", with: user.email
|
||||
fill_in "search", with: user.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content user.name
|
||||
|
||||
@@ -22,7 +22,7 @@ describe "Admin valuators", :admin do
|
||||
end
|
||||
|
||||
scenario "Create", :js do
|
||||
fill_in "name_or_email", with: user.email
|
||||
fill_in "search", with: user.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content(user.name)
|
||||
@@ -72,7 +72,7 @@ describe "Admin valuators", :admin do
|
||||
expect(page).to have_content(valuator1.name)
|
||||
expect(page).to have_content(valuator2.name)
|
||||
|
||||
fill_in "name_or_email", with: " "
|
||||
fill_in "search", with: " "
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Valuators: User search")
|
||||
@@ -85,10 +85,11 @@ describe "Admin valuators", :admin do
|
||||
expect(page).to have_content(valuator1.name)
|
||||
expect(page).to have_content(valuator2.name)
|
||||
|
||||
fill_in "name_or_email", with: "Foster"
|
||||
fill_in "search", with: "Foster"
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Valuators: User search")
|
||||
expect(page).to have_field "search", with: "Foster"
|
||||
expect(page).to have_content(valuator1.name)
|
||||
expect(page).not_to have_content(valuator2.name)
|
||||
end
|
||||
@@ -97,10 +98,11 @@ describe "Admin valuators", :admin do
|
||||
expect(page).to have_content(valuator1.email)
|
||||
expect(page).to have_content(valuator2.email)
|
||||
|
||||
fill_in "name_or_email", with: valuator2.email
|
||||
fill_in "search", with: valuator2.email
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Valuators: User search")
|
||||
expect(page).to have_field "search", with: valuator2.email
|
||||
expect(page).to have_content(valuator2.email)
|
||||
expect(page).not_to have_content(valuator1.email)
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ describe "Incomplete verifications", :admin do
|
||||
|
||||
visit admin_verifications_path
|
||||
|
||||
fill_in "name_or_email", with: "juan"
|
||||
fill_in "search", with: "juan"
|
||||
click_button "Search"
|
||||
|
||||
expect(page).to have_content("Juan_anonymous")
|
||||
|
||||
@@ -58,7 +58,7 @@ describe "Moderate users" do
|
||||
visit moderation_users_path
|
||||
|
||||
expect(page).not_to have_content citizen.name
|
||||
fill_in "name_or_email", with: "Wanda"
|
||||
fill_in "search", with: "Wanda"
|
||||
click_button "Search"
|
||||
|
||||
within("#moderation_users") do
|
||||
|
||||
Reference in New Issue
Block a user