1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

fix getParentDectionaryUrl func (#2669)

This commit is contained in:
C_Q
2018-12-19 16:07:56 +08:00
committed by Daniel Pan
parent 2dd25b2ae7
commit 3bbb44602b
7 changed files with 34 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ class GroupItem extends React.Component {
return (
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<td>{item.group_info.name}</td>
<td>{Utils.sharePerms[item.permission]}</td>
<td>{Utils.sharePerms(item.permission)}</td>
<td>
<span
className={`sf2-icon-x3 sf2-x op-icon a-simulate ${this.state.isOperationShow ? '' : 'hide'}`}
@@ -128,7 +128,7 @@ class ShareToGroup extends React.Component {
});
} else if (e.target.value == 'Preview-Edit-on-Cloud') {
this.setState({
permission: 'clod-edit',
permission: 'cloud-edit',
});
} else if (e.target.value == 'Preview-on-Cloud') {
this.setState({

View File

@@ -33,7 +33,7 @@ class UserItem extends React.Component {
return (
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<td>{item.user_info.nickname}</td>
<td>{Utils.sharePerms[item.permission]}</td>
<td>{Utils.sharePerms(item.permission)}</td>
<td>
<span
className={`sf2-icon-x3 sf2-x op-icon a-simulate ${this.state.isOperationShow ? '' : 'hide'}`}
@@ -112,7 +112,7 @@ class ShareToUser extends React.Component {
});
} else if (e.target.value == 'Preview-Edit-on-Cloud') {
this.setState({
permission: 'clod-edit',
permission: 'cloud-edit',
});
} else if (e.target.value == 'Preview-on-Cloud') {
this.setState({

View File

@@ -2,8 +2,10 @@ import React from 'react';
import SeafileEditor from '@seafile/seafile-editor';
import 'whatwg-fetch';
import { SeafileAPI } from 'seafile-js';
import { Utils } from './utils/utils';
import cookie from 'react-cookies';
let repoID = window.app.pageOptions.repoID;
let repoName = window.app.pageOptions.repoName;
let filePath = window.app.pageOptions.filePath;
let fileName = window.app.pageOptions.fileName;
let siteRoot = window.app.config.siteRoot;
@@ -66,7 +68,9 @@ class EditorUtilities {
getParentDectionaryUrl() {
let parentPath = this.filePath.substring(0, this.filePath.lastIndexOf('/'));
return this.serviceUrl + '/#common/lib/' + this.repoID + parentPath;
let libName = encodeURIComponent(repoName);
let path = Utils.encodePath(parentPath);
return this.serviceUrl + '/library/' + this.repoID + '/' + libName + path + '/';
}
_getImageURL(fileName) {

View File

@@ -198,14 +198,14 @@ class Item extends Component {
}
data.cur_perm = share_permission;
data.cur_perm_text = Utils.sharePerms[data.cur_perm];
data.cur_perm_text = Utils.sharePerms(data.cur_perm);
let iconVisibility = this.state.showOpIcon ? '' : ' invisible';
let editIconClassName = 'perm-edit-icon sf2-icon-edit op-icon' + iconVisibility;
let unshareIconClassName = 'unshare op-icon sf2-icon-delete' + iconVisibility;
let permOption = function(options) {
return <option value={options.perm}>{Utils.sharePerms[options.perm]}</option>;
return <option value={options.perm}>{Utils.sharePerms(options.perm)}</option>;
};
const item = (

View File

@@ -204,14 +204,14 @@ class Item extends Component {
if (data.show_admin && is_admin) {
data.cur_perm = 'admin';
}
data.cur_perm_text = Utils.sharePerms[data.cur_perm];
data.cur_perm_text = Utils.sharePerms(data.cur_perm);
let iconVisibility = this.state.showOpIcon ? '' : ' invisible';
let editIconClassName = 'perm-edit-icon sf2-icon-edit op-icon' + iconVisibility;
let unshareIconClassName = 'unshare op-icon sf2-icon-delete' + iconVisibility;
let permOption = function(options) {
return <option value={options.perm}>{Utils.sharePerms[options.perm]}</option>;
return <option value={options.perm}>{Utils.sharePerms(options.perm)}</option>;
};
const item = (

View File

@@ -302,12 +302,26 @@ export const Utils = {
return title;
},
sharePerms: {
'rw': gettext("Read-Write"),
'r': gettext("Read-Only"),
'admin': gettext("Admin"),
'cloud-edit': gettext("Preview-Edit-on-Cloud"),
'preview': gettext("Preview-on-Cloud")
sharePerms: function(permission) {
var title;
switch(permission) {
case 'rw':
title = gettext("Read-Write");
break;
case 'r':
title = gettext("Read-Only");
break;
case 'admin':
title = gettext("Admin");
break;
case 'cloud-edit':
title = gettext("Preview-Edit-on-Cloud");
break;
case 'preview':
title = gettext("Preview-on-Cloud");
break;
}
return title;
},
formatSize: function(options) {

View File

@@ -20,6 +20,7 @@
},
pageOptions: {
repoID: '{{ repo.id }}',
repoName: '{{ repo.name|escapejs }}',
filePath: '{{ path|escapejs }}',
fileName: '{{ filename|escapejs }}',
domain: '{{ domain }}',