Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Search twig-template #1758

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

joelit
Copy link
Contributor

@joelit joelit commented Jan 30, 2025

Reasons for creating this PR

Link to relevant issue(s), if any

Description of the changes in this PR

  • This PR implements the twig template for global search
  • In the absence of a search field, the result page can be tested by visiting [Skosmos-home]/en/search?clang=en&q=kissa

Known problems or uncertainties in this PR

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@joelit joelit added this to the 3.0 milestone Jan 30, 2025
@joelit joelit self-assigned this Jan 30, 2025
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.94%. Comparing base (53aa787) to head (9b1fcf4).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1758   +/-   ##
=========================================
  Coverage     70.94%   70.94%           
  Complexity     1650     1650           
=========================================
  Files            33       33           
  Lines          4330     4330           
=========================================
  Hits           3072     3072           
  Misses         1258     1258           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joelit joelit force-pushed the issue1745-global-search-twig branch from 0cb3322 to a308ba2 Compare January 30, 2025 16:05
Copy link

sonarqubecloud bot commented Jan 30, 2025

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@joelit
Copy link
Contributor Author

joelit commented Jan 30, 2025

Rebased the branch to main in order to allow automatic merging

Copy link
Member

@osma osma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave a few suggestions for minor code adjustments.

Looking at the search result page, I see several layout issues. The spacing between the icons and the text is sometimes nonexistent, and there are sometimes extra spaces before commas:

image

But this is not consistent as sometimes the result items are rendered just fine:

image

@@ -91,12 +91,13 @@ body {
margin: 0 5px;
}

#main-container.vocab-search .fa-arrow-right {
#main-container.searchpage .fa-arrow-right, #main-container.global-search .fa-arrow-right {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just got rid of .searchpage, now it's coming back again? Change it to .vocab-search

color: var(--vocab-text);
font-size: 12px;
}

#main-container.vocab-search .list-group .fa-solid, #main-container.vocab-search .list-group .fa-regular {
#main-container.searchpage .list-group .fa-solid, #main-container.searchpage .list-group .fa-regular,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, change .searchpage to .vocab-search

@@ -0,0 +1,21 @@
{% set pageType = 'global-search' %}
{% extends "base-template.twig" %}
{% block title %}'{{ term }}' - {{ "Search results" | trans }} - {{ GlobalConfig.serviceName }}{% endblock %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the current SEO spec for page titles and descriptions, the middle part "Search results" should be dropped. So the title should include just the search term and the service name.

it('Contains title and title metadata', () => {
cy.visit(`/en/search?clang=en&q=${term}`)

const expectedTitle = "'bass' - Search results - Skosmos being tested"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This of course needs to be changed as well if you change the title in the template above, as suggested.

@joelit
Copy link
Contributor Author

joelit commented Mar 11, 2025

OK, the inconsistency of the search results for search result property label spacing and property value spacing is pretty weird, and probably has further implications for the consistency of the twig template. I'll track this down to the root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Reviewed - further actions needed
Development

Successfully merging this pull request may close these issues.

Global Search twig-template
2 participants