Skip to content

Commit

Permalink
Merge pull request TongchengOpenSource#693 from chenqi146/master
Browse files Browse the repository at this point in the history
fix: fix interface url rules in search js
  • Loading branch information
shalousun authored Dec 19, 2023
2 parents 7ef2a46 + be632fe commit 938b647
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/main/resources/template/js/search.js.btl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ api.push({
<%for(doc in api.list) {%>
api[${apiLP.dataIndex}].list.push({
order: '${doc.order}',
methodId: '${doc.methodId}',
desc: '${removeLineBreaks(doc.desc)}',
});
<%}%>
Expand Down Expand Up @@ -92,11 +93,11 @@ function buildAccordion(apiData, liClass, display) {
if (apiData.length > 0) {
for (let j = 0; j < apiData.length; j++) {
html += '<li class="'+liClass+'">';
html += '<a class="dd" href="' + apiData[j].alias + '.html#header">' + apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
html += '<a class="dd" href="#' + apiData[j].alias + '">' + apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
html += '<ul class="sectlevel2" style="'+display+'">';
let doc = apiData[j].list;
for (let m = 0; m < doc.length; m++) {
html += '<li><a href="' + apiData[j].alias + '.html#_' + apiData[j].order + '_' + doc[m].order + '_' + doc[m].desc + '">' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + doc[m].desc + '</a> </li>';
html += '<li><a href="#' + doc[m].methodId + '">' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + doc[m].desc + '</a> </li>';
}
html += '</ul>';
html += '</li>';
Expand Down
11 changes: 7 additions & 4 deletions src/main/resources/template/js/search_all.js.btl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ api[${apiGroupLP.dataIndex}].list[${apiLP.dataIndex}].list.push({
order: '${doc.order}',
deprecated: '${doc.deprecated}',
url: '${doc.url}',
methodId: '${doc.methodId}',
desc: '${strUtil.replace(removeLineBreaks(doc.desc), "\'", "\\'")}',
});
<%}%>
Expand Down Expand Up @@ -46,6 +47,7 @@ function keyDownSearch(e) {
order: apiData.order,
desc: apiData.desc,
link: apiData.link,
alias: apiData.alias,
list: apiData.list
});
} else {
Expand All @@ -64,6 +66,7 @@ function keyDownSearch(e) {
order: apiData.order,
desc: apiData.desc,
link: apiData.link,
alias: apiData.alias,
list: methodListTemp
};
searchArr.push(data);
Expand Down Expand Up @@ -126,7 +129,7 @@ function buildAccordion(apiGroups, liClass, display) {
let order = apiGroups[0].order;
for (let j = 0; j < apiData.length; j++) {
html += '<li class="'+liClass+'">';
html += '<a class="dd" href="#_'+order+'_'+apiData[j].order+'_' + apiData[j].link + '">' + apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
html += '<a class="dd" href="#' + apiData[j].alias + '">' + apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
html += '<ul class="sectlevel2" style="'+display+'">';
let doc = apiData[j].list;
for (let m = 0; m < doc.length; m++) {
Expand All @@ -136,7 +139,7 @@ function buildAccordion(apiGroups, liClass, display) {
} else {
spanString='<span>';
}
html += '<li><a href="#_'+order+'_' + apiData[j].order + '_' + doc[m].order + '_' + doc[m].desc + '">' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + spanString + doc[m].desc + '<span></a> </li>';
html += '<li><a href="#' + doc[m].methodId + '">' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + spanString + doc[m].desc + '<span></a> </li>';
}
html += '</ul>';
html += '</li>';
Expand All @@ -151,7 +154,7 @@ function buildAccordion(apiGroups, liClass, display) {
let apiData = apiGroup.list;
for (let j = 0; j < apiData.length; j++) {
html += '<li class="'+liClass+'">';
html += '<a class="dd" href="#_'+apiGroup.order+'_'+ apiData[j].order + '_'+ apiData[j].link + '">' +apiGroup.order+'.'+ apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
html += '<a class="dd" href="#' + apiData[j].alias + '">' +apiGroup.order+'.'+ apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
html += '<ul class="sectlevel2" style="'+display+'">';
let doc = apiData[j].list;
for (let m = 0; m < doc.length; m++) {
Expand All @@ -161,7 +164,7 @@ function buildAccordion(apiGroups, liClass, display) {
} else {
spanString='<span>';
}
html += '<li><a href="#_'+apiGroup.order+'_' + apiData[j].order + '_' + doc[m].order + '_' + doc[m].desc + '">'+apiGroup.order+'.' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + spanString + doc[m].desc + '<span></a> </li>';
html += '<li><a href="#' + doc[m].methodId + '">'+apiGroup.order+'.' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + spanString + doc[m].desc + '<span></a> </li>';
}
html += '</ul>';
html += '</li>';
Expand Down

0 comments on commit 938b647

Please sign in to comment.