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

HFP-3819 Allow sorting of panels by title #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion h5p-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ H5P.Accordion = (function ($) {
panels: []
}, params);

if (params.sortByLabels) {
this.params.panels = this.params.panels.sort((panel1, panel2) => {
if (panel1.title === panel2.title) {
return 0;
}
return (panel1.title < panel2.title) ? -1 : 1;
});
}

this.contentData = contentData;

this.instances = [];
Expand Down Expand Up @@ -129,7 +138,7 @@ H5P.Accordion = (function ($) {
}
}
},
// The class needs to be set programmatically as the title
// The class needs to be set programmatically as the title
// is not able to detect focus-visible on the button
'focus': function () {
if($titleButton.is(':focus-visible')) {
Expand Down
4 changes: 4 additions & 0 deletions language/.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
6 changes: 5 additions & 1 deletion language/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
6 changes: 5 additions & 1 deletion language/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "”H4“"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
76 changes: 40 additions & 36 deletions language/bg.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
{
"semantics": [
{
"label": "Панели",
"entity": "panel",
"field": {
"label": "Съдържание",
"entity": "content",
"fields": [
{
"label": "Заглавие"
},
{
"label": "Тип съдържание",
"entity": "content"
}
]
}
},
{
"label": "H тагове за етикети (не влияе на размера на етикета)",
"description": "H таг се използва за етикетите. Обикновено е H2, но ако се задава под H2 заглавие, да се използва H3. Не влияе на размера на етикетите, използва се единствено за семантични цели.",
"options": [
{
"label": "H2"
},
{
"label": "H3"
},
{
"label": "H4"
}
]
}
]
}
{
"semantics": [
{
"label": "Панели",
"entity": "panel",
"field": {
"label": "Съдържание",
"entity": "content",
"fields": [
{
"label": "Заглавие"
},
{
"label": "Тип съдържание",
"entity": "content"
}
]
}
},
{
"label": "H тагове за етикети (не влияе на размера на етикета)",
"description": "H таг се използва за етикетите. Обикновено е H2, но ако се задава под H2 заглавие, да се използва H3. Не влияе на размера на етикетите, използва се единствено за семантични цели.",
"options": [
{
"label": "H2"
},
{
"label": "H3"
},
{
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
36 changes: 20 additions & 16 deletions language/bs.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
{
"semantics":[
"semantics": [
{
"label":"Panels",
"entity":"panel",
"field":{
"label":"Content",
"entity":"content",
"fields":[
"label": "Panels",
"entity": "panel",
"field": {
"label": "Content",
"entity": "content",
"fields": [
{
"label":"Title"
"label": "Title"
},
{
"label":"Content type",
"entity":"content"
"label": "Content type",
"entity": "content"
}
]
}
},
{
"label":"H tags for labels (does not affect the size of the label)",
"description":"The h tag used on the labels. Normally H2 but if this belongs under an H2 heading use H3. Does not affect the size of the labels, only used for semantical purposes.",
"options":[
"label": "H tags for labels (does not affect the size of the label)",
"description": "The h tag used on the labels. Normally H2 but if this belongs under an H2 heading use H3. Does not affect the size of the labels, only used for semantical purposes.",
"options": [
{
"label":"H2"
"label": "H2"
},
{
"label":"H3"
"label": "H3"
},
{
"label":"H4"
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
6 changes: 5 additions & 1 deletion language/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
6 changes: 5 additions & 1 deletion language/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
36 changes: 20 additions & 16 deletions language/da.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
{
"semantics":[
"semantics": [
{
"label":"Panels",
"entity":"panel",
"field":{
"label":"Content",
"entity":"content",
"fields":[
"label": "Panels",
"entity": "panel",
"field": {
"label": "Content",
"entity": "content",
"fields": [
{
"label":"Title"
"label": "Title"
},
{
"label":"Content type",
"entity":"content"
"label": "Content type",
"entity": "content"
}
]
}
},
{
"label":"H tags for labels (does not affect the size of the label)",
"description":"The h tag used on the labels. Normally H2 but if this belongs under an H2 heading use H3. Does not affect the size of the labels, only used for semantical purposes.",
"options":[
"label": "H tags for labels (does not affect the size of the label)",
"description": "The h tag used on the labels. Normally H2 but if this belongs under an H2 heading use H3. Does not affect the size of the labels, only used for semantical purposes.",
"options": [
{
"label":"H2"
"label": "H2"
},
{
"label":"H3"
"label": "H3"
},
{
"label":"H4"
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
6 changes: 5 additions & 1 deletion language/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
38 changes: 21 additions & 17 deletions language/el.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
{
"semantics":[
"semantics": [
{
"label":"Αναδιπλούμενα Πλαίσια",
"entity":"πλαισιου",
"field":{
"label":"Περιεχόμενο",
"entity":"περιεχομενου",
"fields":[
"label": "Αναδιπλούμενα Πλαίσια",
"entity": "πλαισιου",
"field": {
"label": "Περιεχόμενο",
"entity": "περιεχομενου",
"fields": [
{
"label":"Τίτλος"
"label": "Τίτλος"
},
{
"label":"Τύπος περιεχομένου",
"entity":"περιεχομενου"
"label": "Τύπος περιεχομένου",
"entity": "περιεχομενου"
}
]
}
},
{
"label":"Ετικέτες h για επικεφαλίδες (δεν επηρεάζει το μέγεθος της επικεφαλίδας)",
"description":"Η ετικέτα h που χρησιμοποιείται στις επικεφαλίδες. Κανονικά χρησιμοποιείται το H2 αλλά αν υπάγεται σε ένα H2 χρησιμοποιήστε το H3. Η ρύθμιση αυτή δεν επηρεάζει το μέγεθος των επικεφαλίδων, χρησιμοποιείται μόνο για σημασιολογικούς σκοπούς.",
"options":[
"label": "Ετικέτες h για επικεφαλίδες (δεν επηρεάζει το μέγεθος της επικεφαλίδας)",
"description": "Η ετικέτα h που χρησιμοποιείται στις επικεφαλίδες. Κανονικά χρησιμοποιείται το H2 αλλά αν υπάγεται σε ένα H2 χρησιμοποιήστε το H3. Η ρύθμιση αυτή δεν επηρεάζει το μέγεθος των επικεφαλίδων, χρησιμοποιείται μόνο για σημασιολογικούς σκοπούς.",
"options": [
{
"label":"H2"
"label": "H2"
},
{
"label":"H3"
"label": "H3"
},
{
"label":"H4"
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
6 changes: 5 additions & 1 deletion language/es-mx.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
6 changes: 5 additions & 1 deletion language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"label": "H4"
}
]
},
{
"label": "Sort panels by title",
"description": "If checked, the panels will be displayed in alphabetical order based on the panel title."
}
]
}
}
Loading