Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/1788/head
zouap 3 years ago
parent
commit
d3b7f15c7d
2 changed files with 21 additions and 8 deletions
  1. +20
    -7
      public/home/search.js
  2. +1
    -1
      routers/search.go

+ 20
- 7
public/home/search.js View File

@@ -143,6 +143,9 @@ function search(){
if(currentSearchTableName != "pr"){
doSearch("pr",currentSearchKeyword,1,pageSize,true,"",false);
}
}else{
initDiv(false);
document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty");
}
}

@@ -557,7 +560,7 @@ function setIssueOrPrInnerHtml(data,path){
html += " <p class=\"has-emoji\"> " + recordMap["content"] + "</p>";
html +=" <p class=\"time\">";
html +=" <i class=\"ri-code-box-line\"></i>";
html +=" <a class=\"am-text grey\" href=\"/" + recordMap["repoUrl"] +"/" + path + "/" + recordMap["index"] + "\" target=\"_blank\"> " + recordMap["repoUrl"] +"#" + recordMap["index"] + "</a>&nbsp;&nbsp;&nbsp;&nbsp;";
html +=" <a class=\"am-text grey\" href=\"/" + recordMap["repoUrl"] +"/" + path + "/" + recordMap["index"] + "\" target=\"_blank\"> " + addBlank(recordMap["repoUrl"]) +" #" + recordMap["index"] + "</a>&nbsp;&nbsp;&nbsp;&nbsp;";
html +=" <i class=\"ri-information-line am-ml-10\"></i>&nbsp;";
if(recordMap["is_closed"] != null && (!(recordMap["is_closed"]) || recordMap["is_closed"]=="f")){
html += getLabel(isZh,"search_open");
@@ -576,6 +579,14 @@ function setIssueOrPrInnerHtml(data,path){
document.getElementById("child_search_item").innerHTML=html;
}

function addBlank(url){
var tmps = url.split("/");
if(tmps.length == 2){
return tmps[0] + " / " + tmps[1];
}
return url;
}

function displayIssueResult(page,jsonResult,onlyReturnNum,keyword){
var data = jsonResult.Result;
var total = jsonResult.Total;
@@ -1194,7 +1205,8 @@ var zhCN={
"search_last_page":"末页",
"search_go_to":"前往",
"search_go_page":"页",
"find_title":"“<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>”相关{tablename}约为{total}个"
"find_title":"“<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>”相关{tablename}约为{total}个",
"search_empty":"请输入任意关键字开始搜索"
}
var esUN={
@@ -1207,14 +1219,14 @@ var zhCN={
"search_org":"Organization",
"search_finded":"Find",
"search_matched":"Best Match",
"search_matched_download":"Amount of downloads",
"search_matched_download":"Most downloads",
"search_lasted_update":"Last Updated ",
"search_letter_asc":"Alphabetical sort",
"search_letter_desc":"Alphabetical reverse sort",
"search_letter_asc":"Alphabetically",
"search_letter_desc":"Reverse alphabetically",
"search_lasted_create":"Recently created",
"search_early_create":"First created",
"search_add_by":"Join in",
"search_lasted":"Recent updates",
"search_lasted":"Recently updated",
"search_open":"Open",
"search_closed":"Closed",
"search_watched":"Watches",
@@ -1228,7 +1240,8 @@ var zhCN={
"search_last_page":"Last",
"search_go_to":"Go",
"search_go_page":"Page",
"find_title":" \"<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>\" related {tablename} maybe {total}"
"find_title":" \"<strong class=\"highlight\" id=\"keyword_desc\">{keyword}</strong>\" related {tablename} maybe {total}",
"search_empty":"Please enter any keyword to start the search"
}



+ 1
- 1
routers/search.go View File

@@ -36,7 +36,7 @@ func InitESClient() {
func EmptySearch(ctx *context.Context) {
log.Info("search template.")
ctx.Data["Keyword"] = ""
ctx.HTML(200, tplHome)
Home(ctx)
}

func Search(ctx *context.Context) {


Loading…
Cancel
Save