1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 01:12:03 +00:00

optimized onsearched handle

This commit is contained in:
shanshuirenjia
2019-04-26 11:34:11 +08:00
parent 3f67bd62e4
commit b176873974
3 changed files with 17 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import { mediaUrl, gettext, serviceURL } from './constants';
import { mediaUrl, gettext, serviceURL, siteRoot } from './constants';
import { strChineseFirstPY } from './pinyin-by-unicode';
export const Utils = {
@@ -801,4 +801,16 @@ export const Utils = {
return message;
},
handleSearchedItemClick: function(searchedItem) {
if (searchedItem.is_dir === true) {
let url = siteRoot + 'library/' + searchedItem.repo_id + '/' + searchedItem.repo_name + searchedItem.path;
let newWindow = window.open('about:blank');
newWindow.location.href = url;
} else {
let url = siteRoot + 'lib/' + searchedItem.repo_id + '/file' + Utils.encodePath(searchedItem.path);
let newWindow = window.open('about:blank');
newWindow.location.href = url;
}
},
};