Skip to content

Commit

Permalink
Fix: losing context when changing language in concepts page (#642)
Browse files Browse the repository at this point in the history
* fix: home annotator block redirection to annotator page with empty text (#629)

* Fix: Download button in summary export metadata (#628)

* fix xml download button in summary page, export metadata

* adjust the position of the export metadata download button and make the hover cursor pointer for it

* Fix: the contexual json icon  for to the concept adapt to the select tab (#539)

* refactor concepts json code and put it in a stimulus controller

* adjust the position of the concepts json link

* remove non related code to concepts json PR

* remove non related code to contextual json pull request

* pass base class URL directly to concepts json stimulus controller

* clean concepts json stimulus code

* remove undesired code from concepts json button PR

* fix typo in agent_search_input_component.html.haml

* rename concepts json button stimulus controller

* clean concepts json button controller code

* clean concepts json button related code

---------

Co-authored-by: Syphax bouazzouni <[email protected]>
Co-authored-by: Bilel KIHAL <[email protected]>
Co-authored-by: @SirineMhedhbi

* feature: make view of clickable in summary page header (#643)

* feature: use the ontologies selector by name and acronym in edit groups and categories (#641)

* Fix: Reject the current ontology from appearing in the ontologies selector in editing the submission's relations (#640)

* reject current ontology from the ontologies selector in relations section - edit submission

* pass reject ontology as a param in generate ontology seect input method

* Feature: Make text area resisable in upload ontology and edit submission forms (#644)

* make text areas resisable in upload ontology and edit submission forms

* make forms list input text areas resisable

* Fix: The issue when the agent has no acronym (#645)

* fix the issue when the agent has no acronym

* clean agent affiliations combination

* fix: the concepts chips links redirecting to the wrong destination  (#638)

* Feature: Scroll to the selected term in the tree view  component (#646)

* scroll to the selected term in the tree view

* prevent the whole page scrolling when centring the scroll to the selected tree view element

* fix: change local test "URL" to "URI" in check resolvability components (#651)

* Feature: Add content negotiation redirection tests (#622)

* Add uri redirection for /ontologies/:acronym/:id to the appropriate page

* small fixes: remove binding.pry and return resource_id in find_type_by_search

* Add copy agroportal link functionality

- this functionality is using the ClipboardComponent because it works the same but differ only in the content and icon
- the clipboard component has been changed to accept title and icon

* redirect to content finder page when no type is valid

* Updated route to use redirect action instead of show_redirection

* Use default icon and title arguments in the Clipboard Component

* rename and internationalize clipboard component titles

* small fix: remove % from svg icon

* Add the copy title to the components section in en.yml and fr.yml

* Show the generated uri when user hover over the copy link icon

* Make the dynamic route content negotiable

- based on the accept header we will
  - if "text/html" we will redirect to the agroportal page
  - else we will call the api and get the content serialized in the format specified and return it

* update serialize content to return accept_header

* translate copy_original_uri and copy_portal_uri to french

* reuse search content concern in uri redirection concern

* remove duplicate link_last_part method

* Add htaccess functionality

* Add apache and nginx instruction for htaccess redirection

* Clean te code in the view file

* Add OntologiesRedirectionController

- remove redirect and generate_htaccess from ontologies_controller
- clean code the generate_htaccess method
- add "ontology_portal_uri" in @Identifiers

* Regroupe routes

* Make ontologies_redirection controller and refactor generate_htaccess code

* Internationalization of redirection rewrite rules modal

* Add note for url that has #

* link contact support button to the feedback page

* Change regex to redirect only url of type: /path/resource_id

- for urls that has the # it will redirect to the ontology page

* Add ontology redirection based on the accept header format

* move the ontology redirection route to the bottom to have less priority

* Change rewrite rules note using alert component

* Add /ontologies/ACRONYM/download?format=FORMAT route

* ontology redirection  based on the accept header using /ontologies/acronym/download route

* Add redirect assertion in ontologies controller test

* Fix content serialization when calling /ontologies/:acronym/:id

* create private function for accept header and remove ontology redirection

* remove generate_rewrite_rules function

* remove redirect assertion in ontologies controller test

* change htaccess route to /ontologies/:acronym/htaccess

* fix copy internal links in LinkFieldComponent

* add raw to copy internal links in identifiers card

* return all response and add text/n3 format in content serializer

* escape id when redirecting to content_finder

* choose the right result from the results of search content

* add algorithm to choose the right accept header, not_acceptable if no format valid

* add an additional security to the uri redirection to have an exact match

* make the check resolvability icon clickable & redirect to the tool page

* make the check resolvability extend to accept equivalent formats

* move the redirection function from ontologies_controller to uri concern

* fix check_resolvability_tool to redirect to the full url not only the path

- the problem was because everytime it is redirecting to the uri.path and uri.path does not include the ?format parameter
- add the octet-stream accept header in the accepted format for xml

* add reference to the url of the original file when format not acceptable

* put again the resolvability timeout to 5 secondes

* setup content negotiation and redirection tests

* remove redirection when request ontology with format

- the redirection is removed when request ontology in any format, by making request to the api and forward the result

* add ids to the resource format icons and modal

* assert the content type for html and json

- the xml and csv is returning 500 internal server error from the api, but it's working locally

* refactor content_redirection tests

- still not completed

* add multiple response status for ontology xml and csv format

* add test for the content format of the resource

* add turtle format based on hasOntologySyntax field

* assert success and not_acceptable in turtle format

it depends on hasOntologySyntax

* add NTriples format for ontologies based on hasOntologySyntax field

* test content negotiation for ontology resources

* fix redirection url for resource html format

* fix ontologies controller test indentation

* assert redirection location in resource html format

* update the admin user  creation in tests possible only  by an admin now

---------

Co-authored-by: Syphax bouazzouni <[email protected]>

* Feature: add Annotator UI tests (#627)

* setup annotator page UI tests

* check if all the inputs and filters are present in annotator page test

* add annotator http requests to test fixtures

* test annotator results and count them

* test annotator empty illustration

* add comments in annotator page tests

* use dynamic api in recommender tests

* test that we have the exact correct annotations in the annotator test

* undo adding ids for elements to run annotator tests

* add a default ANNOTATOR_URL value for test config

---------

Co-authored-by: Syphax bouazzouni <[email protected]>

* Fix: multiple highlighted terms in concepts date view (#657)

* Fix multiple highlighted terms in the date view

* refactor concepts by date method code

* Fix: concept details table layout max-with when long strings (#649)

* fix concepts table layout when we put very long strings

* fix concepts json button position

* use a css class intead of an id for the concepts_json_button

* move concepts_json_button css class from concept details file to concepts file

* remvoe #concepts_json_link unsued style

---------

Co-authored-by: Syphax Bouazzouni <[email protected]>

* Feature: Clean no more used gems  and code (#658)

* remove cube ruby

* remove not used gems and add documentation to the Gemfile

* remove miniprofiler

* remove bpdi resolver and redirect_to_new_api

* remove ajax proxy and no more used helpers

* remove no more used helpers

* handle the case reset_agents in edit submissions error state are already Agents (#663)

* Feature: Add issues and requests link to the footer and feedback form (#665)

* add issues and requests link to the footer and feedback form

* add $GITHUB_ISSUES to sample config file

* Fix a typo in bioportal_config_env.rb.sample

* fix: upload ontology on errors non returned values and no default values (#625)

* move pry gem outside development block in gemfile (#671)

* Feature: Add back slices (#598)

* Add slices section to home page

* Update the design of the slice top notice bar

* fix home slice name styles

* fix slices error on home page, when there are no slices available

* make the annotator support slices

* make browse page compatible with slices

* update home slices section to include the number of ontologies per slice and the description

* make mappings page supports slices

* rearrange home page sections to be in this order: slices, ontoportal instances then collaborations

* remove unnecessary code in submission filter file

* Adjust the slice link to comply with the production URL

* update home page slices section style

* add a description to the home page slice section

* update home page slices section style

* update ontoportal instances and support home sections styles

* change the button of add new slice to suggest a new group/slice in the home page

* update slices descriptive texti in the home page

* add a description for ontoportal instances in the home page

* move home_ontoportal_tooltip to home helper

* add ontoportal links in config file

* remove http from slice link to make it work with https

* add slice notice to lang local files

* remove mappings statistics slices support in the UI cause it's already done in the back

* update ontoportal website links to be upper case

* fix slices https issue

---------

Co-authored-by: Syphax bouazzouni <[email protected]>

* fix docker compose to make local env dev work in port 3000

* Fix: submissions properties selector labels and include ontologies properties (#669)

* add ontologies properties to the submission properties selector

* show submission attributes label instead of the keys in the selector

* make slices open in the same tab not in a new tab

* put the ontoportal instances directly before the logos instead of a tooltip

* Fix: Redirect to the login page when accessing private ontology while being not authenticated (#673)

* Feature: Distinguish reused terms in tree view (#650)

* distinguish reused properties in the tree view

* use preferredNamespaceUri to distinguish reused terms in the tree view if uriRegexPattern is not present

* use preferredNamespaceUri to distinguish reused properties in the tree view

* distinguish reuses for instances tree

* clean terms reuses code

* extract is_reused to a separate function in components helper

* add concepts reuses to the date view

* pass submission directly instead of ontology_uri_pattern

* pass direcly the submission instead of passing by a function in terms reuses

* Clean terms reuses concern code

* add reuses to schemes tree

* add reuses to schemes tree when we perform a search

* add reuses for collections tree

* add reuses to properties tree when we perform a search

* add reuses for concepts list view

* Clean terms reuses code

* extract submission variable form the concept date render  helper

* remove binding.pry comments left in the code

---------

Co-authored-by: Syphax Bouazzouni <[email protected]>

* Fix: run production mode (#679)

* remove duplicate from gemfile

* add port 3000 for production to use it with ontoportal_docker

* add commands to run production correctly

* Fix: json file extention in export metadata summary page (#683)

* hide analytics features if not enabled (#691)

* add search placeholder to data table component (#688)

* fix browse page contact titleizing (#689)

* fix mappings concept link not opening empty pages (#690)

* Fix docker compose to make tests work (#695)

* Fix: check resolvability tool redirection (#694)

* Feature: add rewrite condition in URI redirection rules (#684)

* add rewrite condition in the rewrite rules

* refactor and clean code of htaccess and nginx redirection rules

* Fix: User ontologies custom set updating (#685)

* Fix ontologies custom set feature

* enhance custom set feature style

* remove duplicated action in home controller account, which is the same as show in users controller

* clean application helper ontologies selector code

* remove unecessary server calls in account page

* Remove JQuery code in accounts page

* remove repeated server call in custom ontologies features

* fix the login flow test after deleting the repeated action related to `/acount`

* Feauture: add acronym column in the agents table in the admin page (#704)

* Fix: subscribe button issues (#681)

* fix clicking on subscribe button while being not logged in

* remove non related code to fix subscribe button issues PR

* fix subscribe button displays wrong values when using french

* replace UnWatch by unwatch

* clean subscriptions method code in ontologies controller

* Fix the color of the loader component spinning loader

* remove duplicated code in subscription button fix

* disable cache for subscription button calls

* remove invalidate cache for the user calls

* Feature: add response time calculation in check resolvability tool (#717)

* add response time calculation in check resolvability tool

* add other format equivalents to handle most cases of request accept header

* move the AVG time to check_resolvability_message instead of appending it

* remove the usage of  inexistent variable  in that block scope

* remove comment as the variable name is already clear

---------

Co-authored-by: Syphax Bouazzouni <[email protected]>

* Feature: add ontology viewOf to the summary page relation network (#716)

* Feature: Remove subject values from the project and usage block in summary page (#719)

* Feature: Add cookie banner (#702)

* add cookies action to show and save cookie state in a session

* add link button component helper

* add cookie modal view

* enhance the style of the cookies banner

---------

Co-authored-by: Bilel KIHAL <[email protected]>

* Fix: update summary page categories display to show acronym with tooltip (#713)

* update summary page categories display to show acronym with tooltip

* fix submission flow system tests after changing their display

* make show_category return the full domain if not a category

* update the show category name to use clickable state if not a category and is a link

* fix remove agent usages (#697)

* Feature: Enhance agents search input component (#703)

* make agents search field component results unlimited to only 4

* make agents cherchable by acronym, affiliations, email and home page

* Update the agent search input to display the result in this format Orga name (ACRONYM) – ROR:003vg9w96 and for persons Person Name – ORCID:0000-1524-5487-5487

* chagne display mode value type from string to boolean in search input component

* remove agents search logic from UI side and limit it to only name, acronym and identifiers

* use the endpoint '/search/agents' for the agents search input component

* Fix: saving and cancel button locals text capitalization (#724)

* Feature: add qf param in agents search (#727)

* Fix: Hide affiliations when agent is organization in agent form (#696)

* Hide affiliations when the agent is an organization in the agents form

* Change the name of the function affliations? to is_organization? to make it more clear

* fix submission flows test after the fix of the PR #713

* fix agent tests after changing the behavior of displaying affiliations

---------

Co-authored-by: Syphax <[email protected]>

* Feature: Make agent indentifiers field set by default based on agent type (#721)

* remove the restriction for certain submission fields to create only organization type or person type agents

* make orcid or ror default input based on agent type in agent form

* fix disappeared signup form icons

* fix nested agents creation

* fix agent form not filling saved identifier values

* create an agent identifier input helper

* disable cookie banner in development and test  mode

* fix agent tests after enforcing ROR for organizations

---------

Co-authored-by: Syphax <[email protected]>

* Fix: propertyid param auto added to summary page URL (#723)

* Fix propertyId param auto added to summary page URL

* remove added PropertyId param to the URL when opening summary page

* Fix auto added propertyId to the summary page URL

* Fix auto added instanceid to the summary page URL

* Fix auto added propertyId to the summary page URL

* add back the constraint of making frames loading lazy while env.development

* make by default properties section displays the first property

* make by default instances section displays the first instance

* change the name of the function instances_tree_first_id by search_first_instance_id

* add a clarification comment in search_first_instance_id method

* move get_property function to properties controller

---------

Co-authored-by: Syphax <[email protected]>

* fix losing context when changing language in concepts page

* fix concept not added to browser URL param issue

* refrech the whole page when we change concepts language

* fix not saving the current url context when changing the language

* Revert "Merge remote-tracking branch 'origin/fix/change-language-lost-context' into fix/change-language-lost-context"

This reverts commit c7b6d08, reversing
changes made to cb3b7ba.

* update turbo frame controller to handle ontology viewer special case

---------

Co-authored-by: SirineMhedhbi <[email protected]>
Co-authored-by: Syphax bouazzouni <[email protected]>
Co-authored-by: Imad Bourouche <[email protected]>
  • Loading branch information
4 people authored Aug 26, 2024
1 parent 00ba8a1 commit 7647929
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
37 changes: 35 additions & 2 deletions app/javascript/controllers/turbo_frame_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,41 @@ export default class extends Controller {
this.frame.innerHTML = this.placeHolderValue
} else {
this.frame.innerHTML = ""
this.urlValue = new HistoryService().getUpdatedURL(this.urlValue, data)
this.frame.src = this.urlValue

if(this.#isCurrentPage()){
this.urlValue = this.#currentPageUrl()
}

this.urlValue = this.#updatedPageUrl(data)

this.frame.src = this.urlValue

}
}

#isCurrentPage(){

let currentDisplayedUrl = new URL(this.#currentPageUrl(), document.location.origin)

let initUrl = new URL(this.urlValue, document.location.origin)

if (currentDisplayedUrl.toString().includes(this.urlValue)){
return true
} else if (currentDisplayedUrl.searchParams.get('p') === initUrl.searchParams.get('p')){
// this is a custom fix for only the ontology viewer page,
// that use the parameter ?p=section to tell which section is displayed
return true
}

return false
}


#currentPageUrl(){
return document.location.pathname + document.location.search
}

#updatedPageUrl(newUrlParams){
return new HistoryService().getUpdatedURL(this.urlValue, newUrlParams)
}
}
6 changes: 3 additions & 3 deletions app/javascript/mixins/useHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export class HistoryService {
return newState
}

#updateURLFromState(urlParams, state) {
Object.entries(state).forEach(([key, val]) => {
if (key !== 'p'){
#updateURLFromState(urlParams, oldState) {
Object.entries(oldState).forEach(([key, val]) => {
if (key !== 'p' && !urlParams.has(key)) {
urlParams.set(key, val)
}
})
Expand Down

0 comments on commit 7647929

Please sign in to comment.