Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 4 years ago
parent
commit
8a943285db
3 changed files with 28 additions and 10 deletions
  1. +26
    -8
      public/home/search.js
  2. +1
    -1
      templates/base/head_navbar_fluid.tmpl
  3. +1
    -1
      templates/base/head_navbar_pro.tmpl

+ 26
- 8
public/home/search.js View File

@@ -35,8 +35,8 @@ var itemType={
var sortBy={
"11":"updated_unix.keyword",
"12":"num_watches",
"13":"num_stars.keyword",
"14":"num_forks.keyword",
"13":"num_stars",
"14":"num_forks",
"21":"updated_unix.keyword",
"31":"created_unix.keyword",
"32":"name.keyword",
@@ -79,7 +79,7 @@ function initPageInfo(){
}

function searchItem(type,sortType){
console.log("enter here 2.");
console.log("enter item 2.");
currentSearchKeyword = document.getElementById("keyword_input").value;
if(!isEmpty(currentSearchKeyword)){
initPageInfo();
@@ -113,8 +113,16 @@ function search(){
}
}

function searchLabel(){

function searchLabel(tableName,keyword,sortBy="",ascending=false){
console.log("enter label search.");
currentSearchKeyword = keyword;
initPageInfo();
currentSearchTableName = tableName;
currentSearchSortBy = sortBy;
currentSearchAscending = ascending;
OnlySearchLabel =true;
page(currentPage);
}

function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){
@@ -459,8 +467,8 @@ function displayRepoResult(page,jsonResult,onlyReturnNum,keyword){
html += " <div class=\"ui tags\">";
if(!isEmpty(recordMap["topics"]) && recordMap["topics"] !="null"){
for(var j = 0; j < recordMap["topics"].length;j++){
//function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy){
html +=" <a href=\"javascript:doSearch('repository','" + recordMap["topics"][j] + "',1,15,false,'updated_unix.keyword',true);\"><div class=\"ui small label topic\">"+ recordMap["topics"][j] + "</div></a>";
//function searchLabel(tableName,keyword,sortBy="",ascending=false)
html +=" <a href=\"javascript:searchLabel('repository','" + recordMap["topics"][j] + "','updated_unix.keyword',false);\"><div class=\"ui small label topic\">"+ recordMap["topics"][j] + "</div></a>";
}
}
html +=" </div>";
@@ -631,4 +639,14 @@ function page(current){
goPage();
}
});
}
}


document.onreadystatechange = function() {
if (document.readyState === "complete") {
var keyword = $('#keyword_input').val();
if(!isEmpty(keyword)){
search();
}
}
}

+ 1
- 1
templates/base/head_navbar_fluid.tmpl View File

@@ -93,7 +93,7 @@

{{if .IsSigned}}
<div class="right stackable menu">
<form class="fourteen wide mobile ten wide tablet ten wide computer column ui form ignore-dirty" style="margin:auto" action="/explore/repos">
<form class="fourteen wide mobile ten wide tablet ten wide computer column ui form ignore-dirty" style="margin:auto" action="/all/search/">
<div class="ui fluid action input" style="background:#363840 ;border-radius: 5px;width: 200px;height:30px;border: #888888 solid 1px;">
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search_pro"}}..."
style="transition: background-color 5000s ease-in-out 0s;-webkit-text-fill-color:#888888;background:#363840 ;color:#888888;border: none;outline: none;">


+ 1
- 1
templates/base/head_navbar_pro.tmpl View File

@@ -96,7 +96,7 @@

{{if .IsSigned}}
<div class="right stackable menu">
<form class="fourteen wide mobile ten wide tablet ten wide computer column ui form ignore-dirty" style="margin:auto" action="/explore/repos">
<form class="fourteen wide mobile ten wide tablet ten wide computer column ui form ignore-dirty" style="margin:auto" action="/all/search/">
<div class="ui fluid action input" style="background:#363840 ;border-radius: 5px;width: 200px;height:30px;border: #888888 solid 1px;">
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search_pro"}}..."
style="transition: background-color 5000s ease-in-out 0s;-webkit-text-fill-color:#888888;background:#363840 ;color:#888888;border: none;outline: none;">


Loading…
Cancel
Save