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

Make property order configurable on concept page #992

Merged
merged 9 commits into from
Jun 12, 2020

Conversation

osma
Copy link
Member

@osma osma commented Jun 9, 2020

This draft PR implements the first steps of making the property order configurable on concept pages, defined in #554.

Three sorts of property order can be selected using the new, vocabulary-specific configuration setting skosmos:propertyOrder:

  1. Default/traditional property order, used in previous Skosmos releases
  2. ISO 25964 property order
  3. Custom property order

There are still several unresolved problems with this PR:

  • one unit test is failing, apparently because of a concept that doesn't know its vocabulary
  • the property order only affects the "core" properties in the middle of the concept page; it is not possible to adjust the order of "belongs to group", "in other languages" and "URI" properties near the bottom since their position is currently hardwired in the Twig templates
  • ISO 25964 only defines the order for some concept properties, not all of the common ones (e.g. dc:source); it's unclear what to do with these (try to find a sensible slot? leave them all at the bottom?)
  • the current code probably doesn't work too well when a custom order is given with URIs from namespaces not known to EasyRdf (e.g. RDA properties)

Opening a draft PR to get early feedback from QA tools.

Fixes #554

@osma osma added this to the 2.7 milestone Jun 9, 2020
@osma osma self-assigned this Jun 9, 2020
@osma osma force-pushed the issue554-property-order-config branch from c28d188 to 12a4cf2 Compare June 11, 2020 13:38
@osma
Copy link
Member Author

osma commented Jun 11, 2020

The order setting now affects also the group and array properties after the changes in commit
ca6ed67 . The location of these properties within the page can be specified using the property URIs skosmos:memberOf and skosmos:memberOfArray, respectively. By default, and in the ISO order, they are still at the bottom. The location of the "In other languages" and "URI" sections are still hardwired in the Twig template, it would take a lot more work to make their location configurable.

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #992 into master will increase coverage by 0.12%.
The diff coverage is 78.12%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #992      +/-   ##
============================================
+ Coverage     59.25%   59.38%   +0.12%     
- Complexity     1553     1566      +13     
============================================
  Files            32       32              
  Lines          4349     4380      +31     
============================================
+ Hits           2577     2601      +24     
- Misses         1772     1779       +7     
Impacted Files Coverage Δ Complexity Δ
model/Concept.php 79.65% <57.14%> (-0.85%) 197.00 <0.00> (+5.00) ⬇️
model/VocabularyConfig.php 93.18% <94.44%> (+0.11%) 89.00 <8.00> (+8.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af7729e...89532d5. Read the comment docs.

@osma osma marked this pull request as ready for review June 11, 2020 15:13
@osma osma requested review from kouralex and joelit June 11, 2020 15:13
"skos:note", "skos:scopeNote", "skos:historyNote", "rdfs:comment",
"dc11:source", "dc:source", "skosmos:memberOf", "skosmos:memberOfArray");

const ISO25964_PROPERTY_ORDER = array("rdf:type", "dc:isReplacedBy",
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be a good idea to mention this reasoning (like grouping skos:definition together with the other text fields) in the Skosmos wiki, too.

Copy link
Contributor

@joelit joelit left a comment

Choose a reason for hiding this comment

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

Works as expected and I appreciate the inclusion of custom ordering.

It would be a good idea to explain the general idea of the choice of the ordering (currently only the ISO 25964-1 and the default Skosmos order, but there might come more) in the Skosmos wiki to help Skosmos users choose a suitable ordering for themselves.

@osma
Copy link
Member Author

osma commented Jun 12, 2020

It would be a good idea to explain the general idea of the choice of the ordering (currently only the ISO 25964-1 and the default Skosmos order, but there might come more) in the Skosmos wiki to help Skosmos users choose a suitable ordering for themselves.

I agree, will document this when explaining the property

@osma
Copy link
Member Author

osma commented Jun 12, 2020

Hmm, meanwhile some conflicts have emerged, need to fix those before merging this

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 5 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@osma osma removed the request for review from kouralex June 12, 2020 13:41
@osma osma merged commit 04de7f3 into master Jun 12, 2020
@osma osma deleted the issue554-property-order-config branch June 12, 2020 13:54
Comment on lines -148 to +114
{% set foreignLabels = concept.foreignLabels %}
{% if foreignLabels %}
{% if concept.foreignLabels %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here one has made a bit too eager conflict resolve as twig variable foreignLabels is used later on in the template. I will fix this in a separate commit, pushed directly to master.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @kouralex, good catch! I did the merge in GitHub UI as I thought it was trivial, but I didn't pay enough attention to this change.

tfrancart added a commit to tfrancart/Skosmos that referenced this pull request Jan 4, 2021
* PhpStorm: declare variable

* PhpStorm: improve jquery efficiency, by avoiding locating elements multiple times

* PhpStorm: remove duplicate keys in .jshintrc (same value too)

* PhpStorm: typos

* enhancement for passing plugin parameters from config.ttl

* Initial implementation of shortening property value lists

* Added a missing line

* Fix shortening property value lists after ajax page load and other special cases

* Translations for "show all # values" message + fix msgid for similar paths message

* Added tests, simplified array handing in twig

* updated translations

* Increase property value cutoff limit from 10 to 15

* optimize jQuery expressions

* Add Danish translation by Sebastian Esp Nielsen and A I

* Updated translations

* Avoid displaying empty type field in search result list. Fixes NatLibFi#942

* Add indexLetters REST method, with test. Part of NatLibFi#599

* Add Portuguese translation by Bruno Almeida and Laureano Macedo

* Add indexConcepts REST method, with test. Part of NatLibFi#599

* Updated Portuguese translation after revision by @kinow

* Implement limit and offset parameters for REST index method. Part of NatLibFi#599

* simplify limit determination (and don't default to 250)

* avoid unnecessary repeated calls to getQueryParam

* Add Brazilian Portuguese translation

* Add Swagger documentation for index/ REST method (indexLetters)

* Add Swagger documentation for index/<letter> REST method (indexConcepts)

* more specific definition of indexConcepts return type

* Move modified date related methods to Controller

* Move skosmos:useModifiedDate to global configuration, instead of per vocabulary

* Simplify signature of GlobalConfiguration::getUseModifiedDate

* Add helper method notModified in Controller class

* Add 304 for global and vocabulary methods

* Add 304 for global and concept methods

* Update tests for the new code

* Make Vocabulary and Concept Modifiables

* Use vocabulary modified date

* Move flag for enabling 304 back to VocabularyConfig, and make it available to Modifiables

* Updating tests for latest changes

* Fix scrutinizer errors

* fix unit test that broke during merge conflict resolution

* Use timestamp of default concept scheme as modified date for Vocabulary + tests

* Fall back to Vocabulary->getModified if concept doesn't have a modified date

* Remove unused method getConceptModifiedDate and corresponding tests (snif!)

* attempt to fix some errors reported by Scrutinizer

* Annotate the $modifiedResource as a possible DateTime literal, and check for its type using instanceof

* Use Literal\Date (its getValue() returns a PHP DateTime too) and replace deprecated @ExpectedException annotation

* Add swagger information for 304 response in REST methods

* Add swagger information for the vocid/mappings REST endpoint (includes 304 not modified information)

* Enhancement for listing altLabels and hiddenLabels for a REST API method

* Added tests for GenericSparql

* generate the label list with a single sparql query instead of two

* Refactored code, no change in overall functionality

* Simplified the way labels are passed by queryAllConceptLabels to RestController from GenericSparql

* Differentiate between nonexistent concept and concept without prefLabel

* Initial implementation of global REST label method. Fixes NatLibFi#952

* Add swagger spec for global labels method (and fix up some descriptions)

* Proper HTTP date format (RFC 1123); read If-Modified-Since header using filter_input

* initial draft for the REST API methods returning new and modified concepts for a vocabulary

* Separated the functionality of WebController and RestController when forming the change list

* Amended tests to reflect the change in functionality

* Timestamps passed from vocabulary as native PHP dateTimes, then processed by each controller to the format they need

* Added handling of malformed date strings and tests

* Fixed a method argument

* Fixed a method argument

* using a PHP 7.1 compatible way for formating DateTime object

* Numerous style tweaks. Added a limit parameter to parameterize the size of the list of changed concepts.

* Additional documentation for mappings-method

* fixed a parameter name

* fix typo in test name

* foreign language/explicit language detection improved;fixes NatLibFi#903

* initial draft for the REST API methods returning new and modified concepts for a vocabulary

* Separated the functionality of WebController and RestController when forming the change list

* Amended tests to reflect the change in functionality

* Timestamps passed from vocabulary as native PHP dateTimes, then processed by each controller to the format they need

* Added handling of malformed date strings and tests

* Fixed a method argument

* Fixed a method argument

* using a PHP 7.1 compatible way for formating DateTime object

* Numerous style tweaks. Added a limit parameter to parameterize the size of the list of changed concepts.

* Refactored methods, added swagger documentation

* implement language-aware sorting for altLabels; fixes NatLibFi#835

* add tests; fix mergeing arrays

* initial test data for NatLibFi#554 configurable property order feature

* initial support for ISO 25964 property order

* initial support for defining a custom property order

* Render concept groups and arrays using the same template used for other properties

* fix sorting of concept properties in unknown URI namespaces

* handle case when concept vocab is unknown; switch to class constants for order definitions

* Fix and test for bad/unknown property order case

* Ensure ISO 25964 order definition contains all common concept properties even though not all are mentioned in the ISO standard

* Fix the font definitions for timestamps and linked vocabulary names, mentioned in NatLibFi#974

* update the testing assertions to address issues related to updating the test vocab

* cleaning up the code

* Show tooltips (rdfs:comment or skos:definition) for custom properties. Fixes NatLibFi#824

* Add missing variable declaration & change variable name to tooltip

* Add unit test for custom property tooltip/description

* Added tests. Fixed abiguity between the namespace prefixes dc, dct, dc11.

* created & modified properties moved to the correct namespace

* Add unit test for custom property missing a description

* add missing phpdoc parameter declarations

* simplify template a little bit by cutting an else expression

* Handling and tests for malformed dates

* Minor library dependency updates

* fix accidental merge conflict resolve bug

* fixes NatLibFi#990 via introducting new global js variable

* Fixed PHPDoc comments

* search result listing now correctly shows foreign labels (fix regression introduced by NatLibFi#993

* introduce a space between notation and prefLabel in mappings

* Fix loading spinner that broke in refactoring commit 4fbfdce

* Declare required PHP extensions using Composer

* Fix double display of concept group on result page (caused by PR NatLibFi#992)

* mappings: fix issue with explicitLanguageTags set to true and label is just shortened property; fix property text help

* Upgrade bootstrap-multiselect and uri.js to versions that are actually available

* rollback few libraries that require more testing

* mark the start of 2.8 development

* fix NatLibFi#1018 by explicitly declaring the UI locale in getDate()

* Fixes NatLibFi#1027 by commenting out css file path

* Fix error in swagger spec for search method return value

The `results` field, which contains the search results, was incorrectly called `vocabularies` in the swagger spec - looks like a copy-paste error.

* Add HTML classes for properties so they can be targeted in JS and CSS. Fixes NatLibFi#1034

* Focus should not be forced in the search field through js

* Set the skip to main element link to cover both the page's main content and the side bar

* Add property-specific classes also for mapping properties

* remove dead code: the renderPropertyMappingValues function is never used

* translations and tweaks

* restored an id attribute

* update twig; references NatLibFi#918

* Moved the main element deeper in the DOM tree

* add screen reader class

* changed concept and vocab info to flex boxes from the old table implementation

* element closing order fixed

* tweaks to the property divider on vocab info page

* tweaked paddings for the dynamic layout of concept and vocabulary info

* layout tweaks to concept page and vocabulary info page

* Don't hide outlines of active links, which cause accessibility problems

* Make it possible to use the Help link using keyboard only

* reenable outlines to make it possible to do keyboard only tab navigation

* Show the skip to content link when it receives keyboard focus

* Add an outline offset to make the outlines look a bit nicer

* Set an explicit outline, to ensure similar rendering across browsers

* changed concept and vocab info to flex boxes from the old table implementation

* tweaks to the property divider on vocab info page

* tweaked paddings for the dynamic layout of concept and vocabulary info

* layout tweaks to concept page and vocabulary info page

* adjust position of skip to content link

* replicating the vocab info spacer bar position of the old layout

* Add an outline also to the content language selection when active

* Add outline to multi-vocabulary selection on front page

* Give the search button an outline when active; adjust background active color as well

* Make outline visible on vocabulary headline (display: block prevented it)

* Add tabindex=-1 to the main content element, to benefit eg screen readers

* WCAG: fix front page heading structure

* fix issue with focus (tested with Edge + Windows Narrator

* fix focus outline issues on front page

* fixes focus z-index; fixes topbar focus on ontology page

* add screen reader only heading to search

* incorporating headings into vocabulary info page; started implementing headings to sidebar

* Changed a class name that caused conflicts between bootstrap and Skosmos css

* Added a missing class attribute

* main sidebar + alphabetical listing now support heading navigation; yet missing translations

* fix color and border issues in sidebar buttons

* changes subpage now support headings

* add support for headings in groupings

* add headings to vocab.twig

* relocated .sidebar-grey heading so that jstree does not interfere with it

* fix regressions encountered on vocabulary search page

* fix css problem with '!*' in alphabetical listing spanning over two lines

* add accessibility headings to search result page; addresses NatLibFi#1039

* fix regressions in vocabulary page; fix a bug introduced by using headings in alphabetical listing

* concept info page to use headings; addresses NatLibFi#1038

* fix screen reader explanation for changes tab

* minor adjustments to about page

* remove unused code

* adjust about page layout + css a bit

* revert topbar #service-name height settings set by NatLibFi#1060

* somewhat working front page

* intermediate testing phase for topbar layout

* similar functionality in headerbar in both vocabulary and front page

* fix responsivity issues with header-float

* fix topbar margin/padding issue when under 1260px width; positional uiLanguageDropdown instead of fixed

* New translation strings for screen reader helper texts in fi, en, sv

* Assort replaced with list

* Adjust focus CSS styles: dotted outline, which is not shown for main content block

* CSS fix: Make sure concept info area extends to the full available width

* Fix position of concept spinner, which was broken by a -moz-fit-width rule.

* tweaked header font size

* fixed translation template names

* criteria -> criterion

* Fixed event listener for alphabetical concept listing

* fix focused pagination letter background color

* Show short name of vocabulary for property values from another vocab

* Fix typo in swagger.json offset description

* Use GRAPH, not FROM in alphabetical letters query - much faster on Fuseki

* use GRAPH, not FROM in single alphabetical letter query - much faster on Fuseki

Co-authored-by: Bruno P. Kinoshita <[email protected]>
Co-authored-by: Osma Suominen <[email protected]>
Co-authored-by: Joeli Takala <[email protected]>
Co-authored-by: joelit <[email protected]>
Co-authored-by: Bruno Almeida <[email protected]>
Co-authored-by: kouralex <[email protected]>
Co-authored-by: Ahonen Mika J <[email protected]>
Co-authored-by: Vainonen <[email protected]>
Co-authored-by: Minttu Hurme <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable order of properties in Concept pages
3 participants