forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from ontoportal-lirmm/feature/migrate-fair-sc…
…ore-js-code Feature: Migrate fair score JS code to Stimulus controllers
- Loading branch information
Showing
10 changed files
with
80 additions
and
80 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import {FairScorePrincipleBar, FairScoreCriteriaRadar, FairScoreChartContainer} from "../mixins/useFairScore"; | ||
// Connects to data-controller="fair-score-home" | ||
export default class extends Controller { | ||
connect() { | ||
let fairScoreBar = new FairScorePrincipleBar( 'ont-fair-scores-canvas') | ||
let fairScoreRadar = new FairScoreCriteriaRadar( 'ont-fair-criteria-scores-canvas') | ||
let fairContainer = new FairScoreChartContainer('fair-score-charts-container' , [ fairScoreRadar , fairScoreBar]) | ||
let ontologies = jQuery("#ontology_ontologyId"); | ||
|
||
fairContainer.getFairScoreData("all") | ||
ontologies.change( (e) => { | ||
if(ontologies.val() !== null){ | ||
fairContainer.getFairScoreData(ontologies.val().join(',')) | ||
} else if(ontologies.val() === null){ | ||
fairContainer.getFairScoreData("all") | ||
} | ||
e.preventDefault() | ||
}) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/javascript/controllers/fair_score_landscape_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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import { FairScoreChartContainer, FairScoreCriteriaBar } from "../mixins/useFairScore"; | ||
// Connects to data-controller="fair-score-landscape" | ||
export default class extends Controller { | ||
connect() { | ||
let fairCriteriaBars = new FairScoreCriteriaBar('ont-fair-scores-criteria-bars-canvas') | ||
let fairContainer = new FairScoreChartContainer('fair-score-charts-container' , [fairCriteriaBars]) | ||
let ontologies = jQuery("#ontology_ontologyId"); | ||
|
||
fairContainer.getFairScoreData("all") | ||
ontologies.change( (e) => { | ||
if(ontologies.val() !== null){ | ||
fairContainer.getFairScoreData(ontologies.val().join(',')) | ||
} else if(ontologies.val() === null){ | ||
fairContainer.getFairScoreData("all") | ||
} | ||
e.preventDefault() | ||
}) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/javascript/controllers/fair_score_summary_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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import {FairScorePrincipleBar, FairScoreCriteriaRadar, FairScoreChartContainer} from "../mixins/useFairScore"; | ||
// Connects to data-controller="fair-score-summary" | ||
export default class extends Controller { | ||
connect() { | ||
let fairScoreBar = new FairScorePrincipleBar( 'ont-fair-scores-canvas') | ||
let fairScoreRadar = new FairScoreCriteriaRadar( 'ont-fair-criteria-scores-canvas') | ||
let fairContainer = new FairScoreChartContainer('fair-score-charts-container' , [ fairScoreRadar , fairScoreBar]) | ||
|
||
fairContainer.getFairScoreData(window.location.pathname.split('/')[2]) | ||
} | ||
} |
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
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