feat: Implemented search results page functionality (#11086)

# Pull Request Template

## Description
Implemented search results page functionality. Now you can press "Enter"
to search by term and display results in a results page. Also now you
can link to /hc/{account}/en/search?query=XXXXXX to view search results
for XXXXXX query.

fixes: https://github.com/chatwoot/chatwoot/issues/10945

## Screenshots

Classic layout search results:
<img width="3840" height="2160" alt="classic-results"
src="https://github.com/user-attachments/assets/3bbb3272-33ca-4eb4-b80a-76ed77442088"
/>

Classic layout pagination:
<img width="3840" height="2160" alt="classic-page-two"
src="https://github.com/user-attachments/assets/062b09d3-7c58-4d3b-8611-b94375e7db51"
/>

Classic layout empty search:
<img width="3840" height="2160" alt="no-results"
src="https://github.com/user-attachments/assets/c5e3f47a-cd9a-4e14-ae92-ccba00c89e98"
/>

Documentation layout search results:
<img width="3840" height="2160" alt="documentation-results"
src="https://github.com/user-attachments/assets/9e45d8d9-c975-4589-b6c6-3bc7bb3c588e"
/>

Documentation layout dark theme:
<img width="3840" height="2160" alt="documentation-dark"
src="https://github.com/user-attachments/assets/cdb6ed63-4241-4b32-9f79-7d92ed479fc8"
/>

Plain embedded dark layout:
<img width="3840" height="2160" alt="plain-embedded-dark"
src="https://github.com/user-attachments/assets/7deb02b9-9f24-48fb-8979-a2ecd7002c05"
/>

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
Co-authored-by: Pranav <pranav@chatwoot.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Vinay Keerthi <11478411+stonecharioteer@users.noreply.github.com>
This commit is contained in:
Alex
2026-06-02 15:19:23 +05:30
committed by GitHub
co-authored by Shivam Mishra Sojan Jose Pranav Muhsin Keloth Vinay Keerthi
parent 88e2661ca6
commit ecd9c26c8c
24 changed files with 385 additions and 45 deletions
+6 -6
View File
@@ -140,7 +140,7 @@ describe PortalHelper do
context 'when theme is not present' do
it 'returns the correct link' do
expect(helper.generate_home_link('portal_slug', 'en', nil, true)).to eq(
'/hc/portal_slug/en'
'/hc/portal_slug/en?show_plain_layout=true'
)
end
end
@@ -148,7 +148,7 @@ describe PortalHelper do
context 'when theme is present and plain layout is enabled' do
it 'returns the correct link' do
expect(helper.generate_home_link('portal_slug', 'en', 'dark', true)).to eq(
'/hc/portal_slug/en?theme=dark'
'/hc/portal_slug/en?show_plain_layout=true&theme=dark'
)
end
end
@@ -172,7 +172,7 @@ describe PortalHelper do
theme: nil,
is_plain_layout_enabled: true
)).to eq(
'/hc/portal_slug/en/categories/category_slug'
'/hc/portal_slug/en/categories/category_slug?show_plain_layout=true'
)
end
end
@@ -186,7 +186,7 @@ describe PortalHelper do
theme: 'dark',
is_plain_layout_enabled: true
)).to eq(
'/hc/portal_slug/en/categories/category_slug?theme=dark'
'/hc/portal_slug/en/categories/category_slug?show_plain_layout=true&theme=dark'
)
end
end
@@ -210,7 +210,7 @@ describe PortalHelper do
context 'when theme is not present' do
it 'returns the correct link' do
expect(helper.generate_article_link('portal_slug', 'article_slug', nil, true)).to eq(
'/hc/portal_slug/articles/article_slug'
'/hc/portal_slug/articles/article_slug?show_plain_layout=true'
)
end
end
@@ -218,7 +218,7 @@ describe PortalHelper do
context 'when theme is present and plain layout is enabled' do
it 'returns the correct link' do
expect(helper.generate_article_link('portal_slug', 'article_slug', 'dark', true)).to eq(
'/hc/portal_slug/articles/article_slug?theme=dark'
'/hc/portal_slug/articles/article_slug?show_plain_layout=true&theme=dark'
)
end
end
+9
View File
@@ -20,6 +20,15 @@ RSpec.describe Article do
expect(article).not_to be_valid
expect(article.errors[:content]).to include("can't be blank")
end
it 'rejects reserved slugs that collide with help center routes' do
Article::RESERVED_SLUGS.each do |reserved_slug|
article = build(:article, portal_id: portal_1.id, author_id: user.id, category_id: category_1.id,
title: reserved_slug, slug: reserved_slug, content: 'content')
expect(article).not_to be_valid
expect(article.errors[:slug]).to include('is reserved')
end
end
end
describe 'associations' do