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

Vocabulary search list Twig-templates #1470

Merged
merged 15 commits into from
Sep 28, 2023
Merged

Conversation

joelit
Copy link
Contributor

@joelit joelit commented May 31, 2023

Reasons for creating this PR

Twig template for vocabulary search

Link to relevant issue(s), if any

Fixes #1483

Description of the changes in this PR

This PR is built on the PR #1469 as it uses the same search-results.inc

Known problems or uncertainties in this PR

  • The header is lacking the search bar
  • The search result filter sidebar is still just a placeholder
  • Copy-to-clipboard component needs to be written
  • Colour scheme configuration component needs to be written to global configuration

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)

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 14 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (e00c2b6) 70.51% compared to head (a0ccea6) 70.51%.

Additional details and impacted files
@@             Coverage Diff              @@
##             skosmos-3    #1470   +/-   ##
============================================
  Coverage        70.51%   70.51%           
  Complexity        1642     1642           
============================================
  Files               32       32           
  Lines             4314     4314           
============================================
  Hits              3042     3042           
  Misses            1272     1272           

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

@joelit joelit added this to the 3.0 milestone Aug 24, 2023
@joelit
Copy link
Contributor Author

joelit commented Aug 24, 2023

Search-results.inc produces more or less similar html compared to the static examples

  • The whitespace control of foreign labes could be improved
  • Gettext translations are needed to display all of the properties for a given search result

@joelit joelit self-assigned this Aug 29, 2023
@joelit joelit marked this pull request as ready for review August 31, 2023 07:22
@joelit joelit mentioned this pull request Aug 31, 2023
4 tasks
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.

Looks like a good start, I gave some quick comments.

Please make sure the PR description is up to date.

cypress/e2e/vocab-search.cy.js Outdated Show resolved Hide resolved
src/view/global-search.twig Outdated Show resolved Hide resolved
src/view/global-search.twig Outdated Show resolved Hide resolved
src/view/search-results-filter.inc Outdated Show resolved Hide resolved
src/view/search-results.inc Outdated Show resolved Hide resolved
src/view/search-results.inc Outdated Show resolved Hide resolved
src/view/vocab-search.twig Outdated Show resolved Hide resolved
src/view/base-template.twig Outdated Show resolved Hide resolved
@osma
Copy link
Member

osma commented Aug 31, 2023

There's something wrong with this PR, there are now over 100 commits. I think it should be rebased on current skosmos-3 branch.

@joelit joelit force-pushed the issue1436-vocab-search-template branch from 7c1afa5 to f265f1e Compare September 1, 2023 08:16
@joelit joelit mentioned this pull request Sep 18, 2023
60 tasks
@osma
Copy link
Member

osma commented Sep 19, 2023

I tested this locally. Some quick comments:

  1. The color-scheme-*.css files are unnecessary in this PR and should be removed. (We will need them later, but let's keep that out of scope for this PR)
  2. You should make sure that the Cypress test works now that PR Use dockerized Skosmos for Cypress tests #1509 was merged. Probably you will at least need to switch the test to use another test vocabulary since we don't currently have a yso vocabulary for the phpunit/cypress tests. (Alternatively, you could wait until we have a YSO subset vocabulary in place for the tests.)

Layout issues

I found some layout issues in the templates:

When searching YSA for kissa, the first result looks like this:

image

Problems:

  1. The header font looks smaller than the rest of the text. I didn't check what it should be but I would expect it to be at least as large.
  2. This concept has no labels in other languages, yet the globe icon is displayed.
  3. The mappings to Allärs and YSO are displayed, but shouldn't there be an icon next to them?

I did the same search for KOKO and got this:

image

Problems:

  1. The types are not separated by commas.

I also searched YSO for flunssa and got this:

image

Problems:

  1. I would expect that the matching label "flunssa" would be displayed in the same font as "nuhakuume" (EB Garamond).

@joelit joelit force-pushed the issue1436-vocab-search-template branch from a50f656 to cbae060 Compare September 21, 2023 17:12
@joelit
Copy link
Contributor Author

joelit commented Sep 21, 2023

Good points @osma ! I should have tested the template with vocabularies other than YSO. I resolved all of the above, and made some minor tweaks.

Global search implemented

Updated property icons

Initial commit

Layout for the vocabulary search page

hard-coded colour scheme css

CSS tweaks

Overhaul of search-results.inc

Fixed a typo

Removed debug info

CSS tweaks

Fixed a HTML tag

Remove colour definitions from the Twig layer

Added cypress tests for vocab search

Added a missing newline to the end of the file

Added Skosmos variant color sheme CSS files

CSS font size tweak

Vocab search translations

Global search twig template

Global search implemented

Updated property icons

Initial commit

Layout for the vocabulary search page

CSS tweaks

Overhaul of search-results.inc

Removed debug info

CSS tweaks

Fixed a HTML tag

Remove colour definitions from the Twig layer

Translation templates

Working cypress test for the search result list

CSS tweaks

Fixed bugs in the twig template logic
@joelit joelit force-pushed the issue1436-vocab-search-template branch from cbae060 to 003179a Compare September 26, 2023 08:16
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.

Getting better. A few brief comments:

  1. There seems to be something wrong with the commit history. I see duplicated commits and I cannot merge this from the command line (although GitHub doesn't indicate a merge conflict). I suggest doing a rebase+squash, combining all current work into a single commit against the current skosmos-3 branch.
  2. The title of the page doesn't reflect that a search has been performed. E.g. on Skosmos 2, the page title is constructed as Finto: YSO 'kissa' (service name, vocabulary and search term). A similar title should be used.
  3. I gave you slightly wrong advice on the header font for matched terms (e.g. flunssa) in the previous review. The font of the matching label should be the one used for regular text, same size and styling.
  4. The arrows for broader/narrower do not match the layout spec. They should be rotated. Also, the alignment of icons is currently problematic, I think that center-align could be better.
  5. Long lines are wrapped in an ugly way. They should be truncated, with a possibility to click them to reveal the full line. (This could be turned into a separate issue.)
  6. For terms in other languages, the prefLabel should be emphasized (bold style, different color).
  7. The HTML contains many span elements and uses of versal class. These are remnants from Skosmos 2 which are unnecessary. IMHO we should try to use simpler HTML structure, as in the static example.
  8. The copy to clipboard button should be white
  9. The URI text/icon is too large

@joelit
Copy link
Contributor Author

joelit commented Sep 27, 2023

The latest update of the PR contains:

  • Squashed the commit history
  • Fixed the page title to be similar to Skosmos 2.x (e.g. Finto: YSO 'kissa')
  • Fixed the prefLabel emphasis to link color
  • Fixed the altLabel emphasis to italics within the list items
  • Fixed the font of the altLabels in the tilte row for each search result
  • Fixed the broader and narrower arrows to reflect the examples of the layout secification documents instead of the static example page
  • Center aligned the FA icons
  • Made an issue Long search result lines should be truncated #1528 about the long search result lines
  • Removed superfluous CSS classes that were there "just in case"
  • Tidied the intendation and spacing of the output HTML code
  • Fixed the copy to clipboard icon
  • Fixed the URI icon-text

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.

Again getting much better. But I do have more comments!

PR title

Could you change the PR title to something a bit more informative?

global-search.inc

Is this file actually needed in this PR? It seems like a preliminary version of the global search template (e.g. doesn't include translations).

General page layout

There's a lot of empty space above the search result content:

image

Compare this with the Finto spec:

image

Extra language tags & untranslated types

I searched YSO for "vaatteet" and got this:

image

For some reason, there are (fi) language tags (without a preceding space) on the third narrower concept and all later ones, but not the first and second. (This happens with Skosmos 2 as well). I don't think they should be there or at least it should be consistent.

Also, the types isothes:ThesaurusArray and skos:Collection are not properly translated. (This is a regression compared to Skosmos 2.)

Extra whitespace and padding

The result for "kisat" looks like this:

image

I've selected the altlabels to show that there is an extra space before "kilvat". The same happens with all other property values as well. It would be better to omit this space (removing unnecessary whitespace from the template or using twig whitespace control).

But I think there should be slightly more padding between the icon and the text (best added after removing the whitespace). Compare with the Finto spec:

image

Possibly unnecessary functionality in the template

I've pointed out in the comments a couple of if clauses which I think are unlikely to be ever true (deprecated concepts & submembers). Unless there is a known use for these, I think these should be left out. (And if there is a use, a Cypress test to verify the functionality would be great!)

Cypress tests

The current test is very minimal. I suggested in a comment some additional test cases that could be implemented. I realize that making the tests may require the "mini YSO" test vocabulary that is currently being developed (see #1516).

src/view/global-search.twig Outdated Show resolved Hide resolved
src/view/search-results.inc Outdated Show resolved Hide resolved
src/view/search-results.inc Outdated Show resolved Hide resolved
src/view/search-results.inc Outdated Show resolved Hide resolved
src/view/search-results.inc Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

This is a pretty minimal test for what is a fairly advanced page type. Could we come up with more tests?

Examples:

  • the "X results for Y" text is there, with the correct values for X and Y
  • the search returns the correct number of search-result DIV elements
  • for one of the search results, verify the basic information, e.g.
    • heading information (also check that the link points where it should)
    • prefLabels in all languages
    • altLabels
    • broader / narrower / related
    • group
    • URI
  • same as above for non-Concept types e.g. ThesaurusArray ("vaatteet vuodenajan mukaan")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added more texts for the search result properties. We should maye wait for test-yso before writing tests for the non-concept types.

@joelit joelit changed the title Issue1436 vocab search template Vocabulary search list Twig-templates Sep 28, 2023
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 17 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

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.

LGTM

@joelit joelit merged commit 408ae61 into skosmos-3 Sep 28, 2023
9 of 12 checks passed
@joelit joelit deleted the issue1436-vocab-search-template branch September 28, 2023 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (verified in test.dev.finto.fi, set Milestone 3.0 for both issue & PR)
Development

Successfully merging this pull request may close these issues.

2 participants