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

Feature: Show ontology data by one language - part 2 #225

Merged
merged 34 commits into from
Mar 27, 2023
Merged
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
04f0af1
show ontologies lang dynamically
haddadzineddine Mar 17, 2023
96a1143
Merge branch 'development' into feat/filter-ontologies-by-lang
haddadzineddine Mar 20, 2023
1a2c56c
Merge branch 'development' into feat/filter-ontologies-by-lang
haddadzineddine Mar 21, 2023
c96339f
change the ui when change language
haddadzineddine Mar 21, 2023
a7ab06c
show concepts dynamically based on requested_lang
haddadzineddine Mar 23, 2023
92797bc
Refactor history controller
haddadzineddine Mar 23, 2023
dfed0d4
refacto tubo_frame controller and update views
haddadzineddine Mar 23, 2023
b37447e
on language change load new content [ concept ]
haddadzineddine Mar 25, 2023
1f2f883
Merge branch 'development' into feature/update-ontology-data-by-lang
syphax-bouazzouni Mar 26, 2023
4526ef6
update turbo_frame component to not use "src" attribute if nil
syphax-bouazzouni Mar 26, 2023
bfa29fa
refactor transform_langs_to_select_options to be an ontology helper
syphax-bouazzouni Mar 26, 2023
92842cf
add request_lang helper
syphax-bouazzouni Mar 26, 2023
4ea7592
use request_lang in "get_class" for getting ontology roots
syphax-bouazzouni Mar 26, 2023
e39f1b6
use request_lang in show concept details and concept children
syphax-bouazzouni Mar 26, 2023
5f1f963
use request_lang in concept_label to show the correct language label
syphax-bouazzouni Mar 26, 2023
eaa6edd
use request_lang in the tree view to link to the correct language
syphax-bouazzouni Mar 26, 2023
849e1ad
Refactor language selector, update concept details and tree on langua…
haddadzineddine Mar 26, 2023
c3c5af7
move history controller to parent container, removing the duplication
syphax-bouazzouni Mar 26, 2023
ccd5770
use request_lang in the collection show_members endpoint
syphax-bouazzouni Mar 26, 2023
61b712e
make 'EN' as the default request_lang
syphax-bouazzouni Mar 26, 2023
da2e5a7
use request_lang in the in collections and schemes calls
syphax-bouazzouni Mar 27, 2023
a2a899a
recfactor turbo frame controller to window.location as default urlValue
syphax-bouazzouni Mar 26, 2023
057b71a
extract the header and permalink partials from ontology_viewer layout
syphax-bouazzouni Mar 27, 2023
9643b2d
use TurboFrameComponent in collections, schemes, visualize and concept
syphax-bouazzouni Mar 27, 2023
fec0e0d
use request_lang in the concepts sorted_by_date_url
syphax-bouazzouni Mar 27, 2023
2f14c40
extract link_to_section helper
syphax-bouazzouni Mar 27, 2023
2b479e6
rename language-change, onChange method name to dispatchLangChangeEvent
syphax-bouazzouni Mar 27, 2023
94ca0b7
Merge branch 'feat/filter-ontologies-by-lang' into feature/show-ontol…
syphax-bouazzouni Mar 27, 2023
2c4c120
rename and update tab-change stimulus controller
syphax-bouazzouni Mar 27, 2023
f703f9a
add ontology_data_section? ontology helper
syphax-bouazzouni Mar 27, 2023
d324b43
use link_to_section and update language selector UI in ontology viewer
syphax-bouazzouni Mar 27, 2023
267092d
extract section_data, language_selector_tag and language_selector_hid…
syphax-bouazzouni Mar 27, 2023
eea67f7
refactor and simplify HistoryService
syphax-bouazzouni Mar 27, 2023
13c263f
update Gemfile.lock
syphax-bouazzouni Mar 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/helpers/ontologies_helper.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@ module OntologiesHelper

REST_URI = $REST_URL
API_KEY = $API_KEY
LANGUAGE_FILTERABLE_SECTIONS = ['classes', 'schemes', 'collections']



def additional_details
return "" if $ADDITIONAL_ONTOLOGY_DETAILS.nil? || $ADDITIONAL_ONTOLOGY_DETAILS[@ontology.acronym].nil?
@@ -393,6 +396,10 @@ def selected_section?(section_title)
current_section.eql?(section_title)
end

def allowed_to_show_language_filter?(section)
LANGUAGE_FILTERABLE_SECTIONS.include?(section)
end

def lazy_load_section(section_title, &block)
if current_section.eql?(section_title)
block.call
2 changes: 1 addition & 1 deletion app/javascript/controllers/application.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { Application } from "@hotwired/stimulus"
const application = Application.start()

// Configure Stimulus development experience
application.debug = true
application.debug = false
window.Stimulus = application


3 changes: 3 additions & 0 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
@@ -46,6 +46,9 @@ application.register("simple-tree", SimpleTreeController)
import SkosCollectionColorsController from "./skos_collection_colors_controller"
application.register("skos-collection-colors", SkosCollectionColorsController)

import TabChangeController from "./tab_change_controller"
application.register("tab-change", TabChangeController)

import TooltipController from "./tooltip_controller"
application.register("tooltip", TooltipController)

35 changes: 35 additions & 0 deletions app/javascript/controllers/tab_change_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Controller } from "@hotwired/stimulus"
import { showLoader } from "../mixins/showLoader";

export default class extends Controller {


static targets = ["sections"]


onClick(event) {

const anchorElement = event.target.closest('a');

// add active class to the clicked tab

if (anchorElement) {

showLoader(this.sectionsTarget);

anchorElement.classList.add('active');

// remove active class from the other tabs
const otherTabs = anchorElement.parentElement.parentElement.querySelectorAll('a');
otherTabs.forEach(tab => {
if (tab !== anchorElement) {
tab.classList.remove('active');
}
});

const href = anchorElement.getAttribute('href');
Turbo.visit(href);
}

}
}