Commit 4447a725 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev_son' into 'feature/1.0_check_web_dev'

Feature/1.0 check web dev son

See merge request !59
parents 403b0103 59ed52da
...@@ -301,18 +301,18 @@ OL.createCategoryList = function () { ...@@ -301,18 +301,18 @@ OL.createCategoryList = function () {
//Create a side menu category structure //Create a side menu category structure
var categoryListElement = $('#categoryListMenu'); var categoryListElement = $('#categoryListMenu');
categoryListElement.empty(); categoryListElement.empty();
//sort group master list by level low to hight
OL.operationGroupMaster.sort(function (a, b) { OL.operationGroupMaster.sort(function (a, b) {
if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1; if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1;
if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1; if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1;
return 1; return 1;
}); });
let allChecked = ''; let allChecked = '';
if (typeof OL.operationGroupMasterId === 'undefined' || OL.operationGroupMasterId == 0) { if (typeof OL.operationGroupMasterId === 'undefined' || OL.operationGroupMasterId == 0) {
allChecked = ' checked'; allChecked = ' checked';
} }
const allCategory = $( const allCategory = $(
'<ul><li><label><input type="radio" name="category" value="0"' + allChecked + '><span class="lang" lang="categoryAll">' + I18N.i18nText('categoryAll') + '</span></label></li></ul>', '<ul><li><label><input type="radio" name="category" value="0"' + allChecked + '> <span>' + I18N.i18nText('categoryAll') + '</span></label></li></ul>',
); );
categoryListElement.append(allCategory); categoryListElement.append(allCategory);
//create category(operationGroupMaster) structure //create category(operationGroupMaster) structure
...@@ -327,12 +327,22 @@ OL.createCategoryList = function () { ...@@ -327,12 +327,22 @@ OL.createCategoryList = function () {
} }
let groupSpan = $('<span>' + item.operationGroupMasterName + '</span>'); let groupSpan = $('<span>' + item.operationGroupMasterName + '</span>');
inputLabel.append(inputRadio); inputLabel.append(inputRadio);
inputLabel.append(' ');
inputLabel.append(groupSpan); inputLabel.append(groupSpan);
if (item.operationGroupMasterLevel == 0) { const isParent = OL.operationGroupMaster.find(function(child) {
return item.operationGroupMasterId == child.parentOperationGroupMasterId;
});
let parentElement = categoryListElement;
if (item.parentOperationGroupMasterId != 0) {
parentElement = $('#collapse' + item.parentOperationGroupMasterId + ' > ul');
}
if (isParent) {
//accordion
const accordionId = 'accordion' + item.operationGroupMasterId; const accordionId = 'accordion' + item.operationGroupMasterId;
const headingId = 'heading' + item.operationGroupMasterId; const headingId = 'heading' + item.operationGroupMasterId;
const collapseId = 'collapse' + item.operationGroupMasterId; const collapseId = 'collapse' + item.operationGroupMasterId;
let categoryParentElm = $('<li class="accordion" id="' + accordionId + '" />'); let accordionElm = $('<li class="accordion" id="' + accordionId + '" />');
//heading
let headingDiv = $('<div id="' + headingId + '" />'); let headingDiv = $('<div id="' + headingId + '" />');
let linkA = $('<a class="list-menu-link" />'); let linkA = $('<a class="list-menu-link" />');
let collapseButton = $('<button type="button" class="collapsed" data-toggle="collapse" aria-expanded="true" />'); let collapseButton = $('<button type="button" class="collapsed" data-toggle="collapse" aria-expanded="true" />');
...@@ -342,26 +352,19 @@ OL.createCategoryList = function () { ...@@ -342,26 +352,19 @@ OL.createCategoryList = function () {
linkA.append(collapseButton); linkA.append(collapseButton);
linkA.append(inputLabel); linkA.append(inputLabel);
headingDiv.append(linkA); headingDiv.append(linkA);
categoryParentElm.append(headingDiv); //collapse
categoryListElement.append(categoryParentElm); let collapseElm = $('<div id="' + collapseId + '" class="collapse">');
collapseElm.attr('data-parent', '#' + accordionId);
collapseElm.attr('aria-labelledby', headingId);
let ul = $('<ul>');
collapseElm.append(ul);
accordionElm.append(headingDiv);
accordionElm.append(collapseElm);
parentElement.append(accordionElm);
} else { } else {
let li = $('<li>'); let li = $('<li>');
li.append(inputLabel); li.append(inputLabel);
let parentElm = $('#collapse' + item.parentOperationGroupMasterId + ' > ul'); parentElement.append(li);
if (typeof parentElm === 'undefined' || !parentElm || parentElm.length < 1) {
const accordionParentId = 'accordion' + item.parentOperationGroupMasterId;
const headingParentId = 'heading' + item.parentOperationGroupMasterId;
const collapseParentId = 'collapse' + item.parentOperationGroupMasterId;
parentElm = $('<div id="' + collapseParentId + '" class="collapse">');
parentElm.attr('data-parent', '#' + accordionParentId);
parentElm.attr('aria-labelledby', headingParentId);
let ul = $('<ul>');
ul.append(li);
parentElm.append(ul);
$('#' + accordionParentId).append(parentElm);
} else {
parentElm.append(li);
}
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment