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 () {
//Create a side menu category structure
var categoryListElement = $('#categoryListMenu');
categoryListElement.empty();
//sort group master list by level low to hight
OL.operationGroupMaster.sort(function (a, b) {
if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1;
if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1;
return 1;
});
let allChecked = '';
if (typeof OL.operationGroupMasterId === 'undefined' || OL.operationGroupMasterId == 0) {
allChecked = ' checked';
}
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);
//create category(operationGroupMaster) structure
......@@ -327,12 +327,22 @@ OL.createCategoryList = function () {
}
let groupSpan = $('<span>' + item.operationGroupMasterName + '</span>');
inputLabel.append(inputRadio);
inputLabel.append(' ');
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 headingId = 'heading' + 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 linkA = $('<a class="list-menu-link" />');
let collapseButton = $('<button type="button" class="collapsed" data-toggle="collapse" aria-expanded="true" />');
......@@ -342,26 +352,19 @@ OL.createCategoryList = function () {
linkA.append(collapseButton);
linkA.append(inputLabel);
headingDiv.append(linkA);
categoryParentElm.append(headingDiv);
categoryListElement.append(categoryParentElm);
//collapse
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 {
let li = $('<li>');
li.append(inputLabel);
let parentElm = $('#collapse' + item.parentOperationGroupMasterId + ' > ul');
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);
}
parentElement.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