mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-29 00:27:37 +00:00
Wiki optimized third (#2406)
This commit is contained in:
committed by
Daniel Pan
parent
5cffd4cb69
commit
3ab4cbff4f
@@ -12,6 +12,7 @@ class EditorUtilities {
|
||||
isExpanded: item.type === 'dir' ? true : false,
|
||||
parent_path: item.parent_dir,
|
||||
last_update_time: item.last_update_time,
|
||||
permission: item.permission,
|
||||
size: item.size
|
||||
};
|
||||
});
|
||||
@@ -28,6 +29,7 @@ class EditorUtilities {
|
||||
isExpanded: item.type === 'dir' ? true : false,
|
||||
parent_path: item.parent_dir,
|
||||
last_update_time: item.mtime,
|
||||
permission: item.permission,
|
||||
size: item.size
|
||||
};
|
||||
});
|
||||
@@ -104,6 +106,19 @@ class EditorUtilities {
|
||||
publishDraft(id) {
|
||||
return seafileAPI.publishDraft(id);
|
||||
}
|
||||
|
||||
zipDownload(parent_dir, dirents) {
|
||||
return seafileAPI.zipDownload(repoID, parent_dir, dirents);
|
||||
}
|
||||
|
||||
queryZipProgress(zip_token) {
|
||||
return seafileAPI.queryZipProgress(zip_token);
|
||||
}
|
||||
|
||||
cancelZipTask(zip_token) {
|
||||
return seafileAPI.cancelZipTask(zip_token)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const editorUtilities = new EditorUtilities();
|
||||
|
@@ -1,32 +1,20 @@
|
||||
const siteRoot = window.app.config.siteRoot;
|
||||
const repoID = window.fileHistory.pageOptions.repoID;
|
||||
|
||||
import {siteRoot, historyRepoID, fileServerRoot } from '../components/constants';
|
||||
import { encodePath } from '../components/utils';
|
||||
class URLDecorator {
|
||||
|
||||
static getUrl(options) {
|
||||
let url = '';
|
||||
let params = '';
|
||||
switch (options.type) {
|
||||
case 'user_profile':
|
||||
url = siteRoot + 'profile/' + options.username + '/';
|
||||
break;
|
||||
case 'common_lib':
|
||||
url = siteRoot + '#common/lib/' + repoID + options.path;
|
||||
break;
|
||||
case 'view_lib_file':
|
||||
url = siteRoot + 'lib/' + repoID + '/file' + options.filePath;
|
||||
break;
|
||||
case 'download_historic_file':
|
||||
params = 'p=' + options.filePath;
|
||||
url = siteRoot + 'repo/' + repoID + '/' + options.objID + '/download?' + params;
|
||||
url = siteRoot + 'repo/' + historyRepoID + '/' + options.objID + '/download?' + params;
|
||||
break;
|
||||
case 'view_historic_file':
|
||||
params = 'obj_id=' + options.objID + '&commit_id=' + options.commitID + '&p=' + options.filePath;
|
||||
url = siteRoot + 'repo/' + options.repoID + 'history/files/?' + params;
|
||||
case 'download_dir_zip_url':
|
||||
url = fileServerRoot + 'zip/' + options.token;
|
||||
break;
|
||||
case 'diff_historic_file':
|
||||
params = 'commit_id=' + options.commitID + '&p=' + options.filePath;
|
||||
url = siteRoot + 'repo/text_diff/' + repoID + '/?' + params;
|
||||
case 'download_file_url':
|
||||
url = siteRoot + 'lib/' + options.repoID + "/file" + encodePath(options.filePath) + "?dl=1";
|
||||
break;
|
||||
default:
|
||||
url = '';
|
||||
|
Reference in New Issue
Block a user