mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
fix getParentDectionaryUrl func (#2669)
This commit is contained in:
@@ -34,7 +34,7 @@ class GroupItem extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
|
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
|
||||||
<td>{item.group_info.name}</td>
|
<td>{item.group_info.name}</td>
|
||||||
<td>{Utils.sharePerms[item.permission]}</td>
|
<td>{Utils.sharePerms(item.permission)}</td>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
className={`sf2-icon-x3 sf2-x op-icon a-simulate ${this.state.isOperationShow ? '' : 'hide'}`}
|
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') {
|
} else if (e.target.value == 'Preview-Edit-on-Cloud') {
|
||||||
this.setState({
|
this.setState({
|
||||||
permission: 'clod-edit',
|
permission: 'cloud-edit',
|
||||||
});
|
});
|
||||||
} else if (e.target.value == 'Preview-on-Cloud') {
|
} else if (e.target.value == 'Preview-on-Cloud') {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@@ -33,7 +33,7 @@ class UserItem extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
|
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
|
||||||
<td>{item.user_info.nickname}</td>
|
<td>{item.user_info.nickname}</td>
|
||||||
<td>{Utils.sharePerms[item.permission]}</td>
|
<td>{Utils.sharePerms(item.permission)}</td>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
className={`sf2-icon-x3 sf2-x op-icon a-simulate ${this.state.isOperationShow ? '' : 'hide'}`}
|
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') {
|
} else if (e.target.value == 'Preview-Edit-on-Cloud') {
|
||||||
this.setState({
|
this.setState({
|
||||||
permission: 'clod-edit',
|
permission: 'cloud-edit',
|
||||||
});
|
});
|
||||||
} else if (e.target.value == 'Preview-on-Cloud') {
|
} else if (e.target.value == 'Preview-on-Cloud') {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@@ -2,8 +2,10 @@ import React from 'react';
|
|||||||
import SeafileEditor from '@seafile/seafile-editor';
|
import SeafileEditor from '@seafile/seafile-editor';
|
||||||
import 'whatwg-fetch';
|
import 'whatwg-fetch';
|
||||||
import { SeafileAPI } from 'seafile-js';
|
import { SeafileAPI } from 'seafile-js';
|
||||||
|
import { Utils } from './utils/utils';
|
||||||
import cookie from 'react-cookies';
|
import cookie from 'react-cookies';
|
||||||
let repoID = window.app.pageOptions.repoID;
|
let repoID = window.app.pageOptions.repoID;
|
||||||
|
let repoName = window.app.pageOptions.repoName;
|
||||||
let filePath = window.app.pageOptions.filePath;
|
let filePath = window.app.pageOptions.filePath;
|
||||||
let fileName = window.app.pageOptions.fileName;
|
let fileName = window.app.pageOptions.fileName;
|
||||||
let siteRoot = window.app.config.siteRoot;
|
let siteRoot = window.app.config.siteRoot;
|
||||||
@@ -66,7 +68,9 @@ class EditorUtilities {
|
|||||||
|
|
||||||
getParentDectionaryUrl() {
|
getParentDectionaryUrl() {
|
||||||
let parentPath = this.filePath.substring(0, this.filePath.lastIndexOf('/'));
|
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) {
|
_getImageURL(fileName) {
|
||||||
|
@@ -198,14 +198,14 @@ class Item extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.cur_perm = share_permission;
|
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 iconVisibility = this.state.showOpIcon ? '' : ' invisible';
|
||||||
let editIconClassName = 'perm-edit-icon sf2-icon-edit op-icon' + iconVisibility;
|
let editIconClassName = 'perm-edit-icon sf2-icon-edit op-icon' + iconVisibility;
|
||||||
let unshareIconClassName = 'unshare op-icon sf2-icon-delete' + iconVisibility;
|
let unshareIconClassName = 'unshare op-icon sf2-icon-delete' + iconVisibility;
|
||||||
|
|
||||||
let permOption = function(options) {
|
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 = (
|
const item = (
|
||||||
|
@@ -204,14 +204,14 @@ class Item extends Component {
|
|||||||
if (data.show_admin && is_admin) {
|
if (data.show_admin && is_admin) {
|
||||||
data.cur_perm = '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 iconVisibility = this.state.showOpIcon ? '' : ' invisible';
|
||||||
let editIconClassName = 'perm-edit-icon sf2-icon-edit op-icon' + iconVisibility;
|
let editIconClassName = 'perm-edit-icon sf2-icon-edit op-icon' + iconVisibility;
|
||||||
let unshareIconClassName = 'unshare op-icon sf2-icon-delete' + iconVisibility;
|
let unshareIconClassName = 'unshare op-icon sf2-icon-delete' + iconVisibility;
|
||||||
|
|
||||||
let permOption = function(options) {
|
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 = (
|
const item = (
|
||||||
|
@@ -302,12 +302,26 @@ export const Utils = {
|
|||||||
return title;
|
return title;
|
||||||
},
|
},
|
||||||
|
|
||||||
sharePerms: {
|
sharePerms: function(permission) {
|
||||||
'rw': gettext("Read-Write"),
|
var title;
|
||||||
'r': gettext("Read-Only"),
|
switch(permission) {
|
||||||
'admin': gettext("Admin"),
|
case 'rw':
|
||||||
'cloud-edit': gettext("Preview-Edit-on-Cloud"),
|
title = gettext("Read-Write");
|
||||||
'preview': gettext("Preview-on-Cloud")
|
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) {
|
formatSize: function(options) {
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
},
|
},
|
||||||
pageOptions: {
|
pageOptions: {
|
||||||
repoID: '{{ repo.id }}',
|
repoID: '{{ repo.id }}',
|
||||||
|
repoName: '{{ repo.name|escapejs }}',
|
||||||
filePath: '{{ path|escapejs }}',
|
filePath: '{{ path|escapejs }}',
|
||||||
fileName: '{{ filename|escapejs }}',
|
fileName: '{{ filename|escapejs }}',
|
||||||
domain: '{{ domain }}',
|
domain: '{{ domain }}',
|
||||||
|
Reference in New Issue
Block a user