mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add "no results found" container
This commit is contained in:
@@ -14,9 +14,4 @@
|
||||
= render partial: 'admin/shared/v3/pagy', locals: { pagy: pagy, reflex: "click->Products#fetch" }
|
||||
- else
|
||||
#no-products
|
||||
= t('.no_products_found')
|
||||
#no-products-actions
|
||||
%a{ href: "/admin/products/new", class: "button icon-plus", icon: "icon-plus" }
|
||||
= t(:new_product)
|
||||
%a{ href: "/admin/products/import", class: "button icon-upload secondary", icon: "icon-upload" }
|
||||
= t(".import_products")
|
||||
= render partial: "no_products", locals: { search_term: search_term, producer_id: producer_id, category_id: category_id }
|
||||
|
||||
11
app/views/admin/products_v3/_no_products.html.haml
Normal file
11
app/views/admin/products_v3/_no_products.html.haml
Normal file
@@ -0,0 +1,11 @@
|
||||
- if search_term.present? || producer_id.present? || category_id.present?
|
||||
= t('.no_products_found_for_search')
|
||||
%a{ href: "#", class: "button disruptive", data: { reflex: "click->products#clear_search" } }
|
||||
= t("admin.products_v3.sort.pagination.clear_search")
|
||||
- else
|
||||
= t('.no_products_found')
|
||||
#no-products-actions
|
||||
%a{ href: "/admin/products/new", class: "button icon-plus", icon: "icon-plus" }
|
||||
= t(:new_product)
|
||||
%a{ href: "/admin/products/import", class: "button icon-upload secondary", icon: "icon-upload" }
|
||||
= t(".import_products")
|
||||
@@ -784,8 +784,10 @@ en:
|
||||
label: Categories
|
||||
search: Search
|
||||
content:
|
||||
no_products:
|
||||
no_products_found: No products found
|
||||
import_products: Import multiple products
|
||||
no_products_found_for_search: No products found for your search criteria
|
||||
product_import:
|
||||
title: Product Import
|
||||
file_not_found: File not found or could not be opened
|
||||
|
||||
@@ -131,6 +131,14 @@ describe 'As an admin, I can see the new product page' do
|
||||
expect_products_count_to_be 15
|
||||
end
|
||||
end
|
||||
|
||||
context "no results" do
|
||||
it "shows a message when there are no results" do
|
||||
search_for "no results"
|
||||
expect(page).to have_content "No products found for your search criteria"
|
||||
expect(page).to have_link "Clear search"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def expect_page_to_be(page)
|
||||
|
||||
Reference in New Issue
Block a user