forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add to the ontology viewer tabs a language selector pinned to the right
- Loading branch information
1 parent
72cf400
commit 5cbff05
Showing
4 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
52 changes: 28 additions & 24 deletions
52
app/components/tabs_container_component/tabs_container_component_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
import { Controller } from "@hotwired/stimulus"; | ||
import {Controller} from "@hotwired/stimulus"; | ||
import {HistoryService} from "../../javascript/mixins/useHistory"; | ||
|
||
export default class extends Controller { | ||
|
||
connect() { | ||
this.event = null | ||
} | ||
connect() { | ||
this.event = null | ||
} | ||
|
||
|
||
selectTab(event) { | ||
this.event = event | ||
if(this.#parameter()){ | ||
this.#updateURL() | ||
selectTab(event) { | ||
this.event = event | ||
if (this.#parameter()) { | ||
this.#updateURL() | ||
} | ||
this.element.dispatchEvent(new CustomEvent("tab-selected", { | ||
bubbles: true, | ||
detail: {data: {selectedTab: this.#pageId()}} | ||
})) | ||
} | ||
} | ||
|
||
#pageId(){ | ||
return this.event.currentTarget.getAttribute("data-tab-id") | ||
} | ||
#pageId() { | ||
return this.event.currentTarget.getAttribute("data-tab-id") | ||
} | ||
|
||
#title(){ | ||
return this.event.currentTarget.getAttribute("data-tab-title") | ||
} | ||
#title() { | ||
return this.event.currentTarget.getAttribute("data-tab-title") | ||
} | ||
|
||
#parameter(){ | ||
return this.event.currentTarget.getAttribute("data-url-parameter") | ||
} | ||
#parameter() { | ||
return this.event.currentTarget.getAttribute("data-url-parameter") | ||
} | ||
|
||
|
||
#url(){ | ||
return `?${this.#parameter()}=${this.#pageId()}` | ||
} | ||
#url() { | ||
return `?${this.#parameter()}=${this.#pageId()}` | ||
} | ||
|
||
#updateURL(){ | ||
(new HistoryService()).pushState({[this.#parameter()]: this.#pageId()}, this.#title(), this.#url()); | ||
} | ||
#updateURL() { | ||
(new HistoryService()).pushState({[this.#parameter()]: this.#pageId()}, this.#title(), this.#url()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters