mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 23:29:49 +00:00
change wiki (#6052)
This commit is contained in:
@@ -3,7 +3,7 @@ import ReactDom from 'react-dom';
|
|||||||
import { Router, navigate } from '@gatsbyjs/reach-router';
|
import { Router, navigate } from '@gatsbyjs/reach-router';
|
||||||
import MediaQuery from 'react-responsive';
|
import MediaQuery from 'react-responsive';
|
||||||
import { Modal } from 'reactstrap';
|
import { Modal } from 'reactstrap';
|
||||||
import { siteRoot, canAddRepo } from './utils/constants';
|
import { siteRoot } from './utils/constants';
|
||||||
import { Utils } from './utils/utils';
|
import { Utils } from './utils/utils';
|
||||||
import SystemNotification from './components/system-notification';
|
import SystemNotification from './components/system-notification';
|
||||||
import SidePanel from './components/side-panel';
|
import SidePanel from './components/side-panel';
|
||||||
|
@@ -68,7 +68,7 @@ class WikiSelectDialog extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Modal isOpen={true} toggle={this.toggle}>
|
<Modal isOpen={true} toggle={this.toggle}>
|
||||||
<ModalHeader toggle={this.toggle}>{gettext('Publish a Library')}</ModalHeader>
|
<ModalHeader toggle={this.toggle}>{gettext('Create Wiki from existing library')}</ModalHeader>
|
||||||
<ModalBody className="dialog-list-container">
|
<ModalBody className="dialog-list-container">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@@ -222,9 +222,9 @@ class MainSideNav extends React.Component {
|
|||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<Link className={`nav-link ellipsis ${this.getActiveClass('published')}`} to={siteRoot + 'published/'} title={gettext('Published Libraries')} onClick={(e) => this.tabItemClick(e, 'published')}>
|
<Link className={`nav-link ellipsis ${this.getActiveClass('published')}`} to={siteRoot + 'published/'} title={gettext('Wikis')} onClick={(e) => this.tabItemClick(e, 'published')}>
|
||||||
<span className="sf2-icon-wiki-view" aria-hidden="true"></span>
|
<span className="sf2-icon-wiki-view" aria-hidden="true"></span>
|
||||||
<span className="nav-text">{gettext('Published Libraries')}</span>
|
<span className="nav-text">{gettext('Wikis')}</span>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
|
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
|
|||||||
import { Dropdown, DropdownToggle, DropdownItem } from 'reactstrap';
|
import { Dropdown, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { siteRoot, gettext } from '../../utils/constants';
|
import { siteRoot, gettext, username } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
// import { seafileAPI } from '../../utils/seafile-api';
|
// import { seafileAPI } from '../../utils/seafile-api';
|
||||||
// import Toast from '../toast';
|
// import Toast from '../toast';
|
||||||
@@ -136,6 +136,7 @@ class WikiListItem extends Component {
|
|||||||
let wiki = this.props.wiki;
|
let wiki = this.props.wiki;
|
||||||
let userProfileURL = `${siteRoot}profile/${encodeURIComponent(wiki.owner)}/`;
|
let userProfileURL = `${siteRoot}profile/${encodeURIComponent(wiki.owner)}/`;
|
||||||
let fileIconUrl = Utils.getDefaultLibIconUrl(false);
|
let fileIconUrl = Utils.getDefaultLibIconUrl(false);
|
||||||
|
const isWikiOwner = wiki.owner === username;
|
||||||
|
|
||||||
const desktopItem = (
|
const desktopItem = (
|
||||||
<tr
|
<tr
|
||||||
@@ -154,14 +155,16 @@ class WikiListItem extends Component {
|
|||||||
</td>
|
</td>
|
||||||
<td><a href={userProfileURL} target='_blank' rel="noreferrer">{wiki.owner_nickname}</a></td>
|
<td><a href={userProfileURL} target='_blank' rel="noreferrer">{wiki.owner_nickname}</a></td>
|
||||||
<td>{moment(wiki.updated_at).fromNow()}</td>
|
<td>{moment(wiki.updated_at).fromNow()}</td>
|
||||||
<td className="text-center cursor-pointer">
|
<td className="text-center cursor-pointer align-top">
|
||||||
|
{isWikiOwner &&
|
||||||
<span
|
<span
|
||||||
className={`iconfont icon-edit mr-4 action-icon ${this.state.highlight ? '' : 'invisible'}`}
|
className={`iconfont icon-edit mr-4 action-icon ${this.state.highlight ? '' : 'invisible'}`}
|
||||||
onClick={() => window.open(wiki.link.replace('/published/', '/edit-wiki/'))}
|
onClick={() => window.open(wiki.link.replace('/published/', '/edit-wiki/'))}
|
||||||
title={gettext('Edit')}
|
title={gettext('Edit')}
|
||||||
aria-label={gettext('Edit')}
|
aria-label={gettext('Edit')}
|
||||||
style={{color: '#999'}}
|
style={{color: '#999', fontSize: '20px'}}
|
||||||
></span>
|
></span>
|
||||||
|
}
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
role="button"
|
role="button"
|
||||||
|
@@ -348,6 +348,12 @@
|
|||||||
color: #8c8c8c;
|
color: #8c8c8c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dtable-dropdown-menu .dropdown-item .seafile-multicolor-icon.seafile-multicolor-icon-right-slide {
|
||||||
|
font-size: 12px;
|
||||||
|
transform: scale(0.8);
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.dtable-dropdown-menu .dropdown-item:hover .item-icon,
|
.dtable-dropdown-menu .dropdown-item:hover .item-icon,
|
||||||
.dtable-dropdown-menu .dropdown-item:hover .seafile-multicolor-icon {
|
.dtable-dropdown-menu .dropdown-item:hover .seafile-multicolor-icon {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import deepCopy from 'deep-copy';
|
import deepCopy from 'deep-copy';
|
||||||
import { gettext, siteRoot, repoID, slug, username, permission, mediaUrl, isEditWiki } from '../../utils/constants';
|
import { gettext, siteRoot, repoID, slug, username, permission, isEditWiki } from '../../utils/constants';
|
||||||
import toaster from '../../components/toast';
|
import toaster from '../../components/toast';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
// import TreeView from '../../components/tree-view/tree-view';
|
// import TreeView from '../../components/tree-view/tree-view';
|
||||||
@@ -385,11 +385,11 @@ class SidePanel extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { wiki_name, wiki_icon } = this.props.config;
|
const { wiki_name, wiki_icon } = this.props.config;
|
||||||
const src = wiki_icon ? getIconURL(repoID, wiki_icon) : `${mediaUrl}img/wiki/default.png`;
|
const src = getIconURL(repoID, wiki_icon);
|
||||||
return (
|
return (
|
||||||
<div className={`side-panel wiki-side-panel ${this.props.closeSideBar ? '': 'left-zero'}`}>
|
<div className={`side-panel wiki-side-panel ${this.props.closeSideBar ? '': 'left-zero'}`}>
|
||||||
<div className="side-panel-top panel-top">
|
<div className="side-panel-top panel-top">
|
||||||
{wiki_icon && <img src={src} width="32" height="32" alt='' className='mr-2' />}
|
{src && <img src={src} width="32" height="32" alt='' className='mr-2' />}
|
||||||
<h4 className="ml-0 mb-0">{wiki_name || slug}</h4>
|
<h4 className="ml-0 mb-0">{wiki_name || slug}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div id="side-nav" className="wiki-side-nav" role="navigation">
|
<div id="side-nav" className="wiki-side-nav" role="navigation">
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import {serviceURL} from '../../../utils/constants';
|
import { serviceURL, mediaUrl } from '../../../utils/constants';
|
||||||
|
|
||||||
const generatorBase64Code = (keyLength = 4) => {
|
const generatorBase64Code = (keyLength = 4) => {
|
||||||
let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789';
|
let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
@@ -34,6 +34,12 @@ const isObjectNotEmpty = (obj) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getIconURL = (repoId, fileName) => {
|
const getIconURL = (repoId, fileName) => {
|
||||||
|
if (!fileName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (fileName === 'default') {
|
||||||
|
return `${mediaUrl}img/wiki/default.png`;
|
||||||
|
}
|
||||||
return serviceURL + '/lib/' + repoId + '/file/_Internal/Wiki/Icon/' + fileName + '?raw=1';
|
return serviceURL + '/lib/' + repoId + '/file/_Internal/Wiki/Icon/' + fileName + '?raw=1';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button } from 'reactstrap';
|
import { Button } from 'reactstrap';
|
||||||
import { seafileAPI } from '../../../../utils/seafile-api';
|
import { seafileAPI } from '../../../../utils/seafile-api';
|
||||||
import { gettext, mediaUrl } from '../../../../utils/constants';
|
import { gettext } from '../../../../utils/constants';
|
||||||
import { getIconURL } from '../../utils';
|
import { getIconURL } from '../../utils';
|
||||||
|
|
||||||
class AppSettingsDialogCustomIcon extends React.Component {
|
class AppSettingsDialogCustomIcon extends React.Component {
|
||||||
@@ -55,13 +55,12 @@ class AppSettingsDialogCustomIcon extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const hasIcon = false;
|
|
||||||
let { iconName } = this.state;
|
let { iconName } = this.state;
|
||||||
const iconUrl = iconName ? getIconURL(this.props.repoId, iconName) : `${mediaUrl}img/wiki/default.png`;
|
const src = getIconURL(this.props.repoId, iconName);
|
||||||
if (hasIcon) {
|
if (src) {
|
||||||
return (
|
return (
|
||||||
<div className="app-setting-dialog-icon">
|
<div className="app-setting-dialog-icon">
|
||||||
<img src={iconUrl} alt="" width={128} height={128} ></img>
|
<img src={src} alt="" width={128} height={128} ></img>
|
||||||
<p className="mt-2 mb-1 app-setting-dialog-icon-description">
|
<p className="mt-2 mb-1 app-setting-dialog-icon-description">
|
||||||
{gettext('Please select a png image within 5MB.')}
|
{gettext('Please select a png image within 5MB.')}
|
||||||
</p>
|
</p>
|
||||||
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormGroup, Label, Tooltip, Button } from 'reactstrap';
|
import { FormGroup, Label, Tooltip, Button } from 'reactstrap';
|
||||||
import IconSettingsPopover from './icon-settings-popover';
|
import IconSettingsPopover from './icon-settings-popover';
|
||||||
import { gettext, mediaUrl } from '../../../../utils/constants';
|
import { gettext } from '../../../../utils/constants';
|
||||||
import { getIconURL } from '../../utils';
|
import { getIconURL } from '../../utils';
|
||||||
|
|
||||||
import './app-settings-dialog-icon-color.css';
|
import './app-settings-dialog-icon-color.css';
|
||||||
@@ -28,7 +28,7 @@ class AppSettingsDialogIconColor extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { wiki_icon } = this.props.config;
|
const { wiki_icon } = this.props.config;
|
||||||
const src = wiki_icon ? getIconURL(this.props.repoId, wiki_icon) : `${mediaUrl}img/wiki/default.png`;
|
const src = getIconURL(this.props.repoId, wiki_icon);
|
||||||
return (
|
return (
|
||||||
<div className="app-settings-dialog-icon-color">
|
<div className="app-settings-dialog-icon-color">
|
||||||
<FormGroup className="app-settings-dialog-theme-color">
|
<FormGroup className="app-settings-dialog-theme-color">
|
||||||
|
@@ -2,31 +2,26 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { mediaUrl } from '../../../../utils/constants';
|
import { mediaUrl } from '../../../../utils/constants';
|
||||||
|
|
||||||
const APP_ICON_CLASSNAMES = [
|
const ICON_CLASSNAMES = [
|
||||||
'default',
|
'default',
|
||||||
];
|
];
|
||||||
|
|
||||||
class AppSettingsDialogIcons extends React.Component {
|
class AppSettingsDialogIcons extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
onClickIcon = () => {
|
||||||
super(props);
|
if (this.props.config.wiki_icon === 'default') {
|
||||||
this.state = {
|
|
||||||
iconClass: '',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
onClickIcon = (iconClass) => {
|
|
||||||
this.setState({ iconClass }, () => {
|
|
||||||
this.props.updateConfig({ wiki_icon: '' });
|
this.props.updateConfig({ wiki_icon: '' });
|
||||||
this.props.onToggle();
|
} else {
|
||||||
});
|
this.props.updateConfig({ wiki_icon: 'default' });
|
||||||
|
}
|
||||||
|
this.props.onToggle();
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="app-settings-dialog-icons">
|
<div className="app-settings-dialog-icons">
|
||||||
<div className='d-flex flex-wrap'>
|
<div className='d-flex flex-wrap'>
|
||||||
{APP_ICON_CLASSNAMES.map((name, index) => {
|
{ICON_CLASSNAMES.map((name, index) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
@@ -35,7 +30,7 @@ class AppSettingsDialogIcons extends React.Component {
|
|||||||
}}
|
}}
|
||||||
className={`seafile-multicolor-icon-container ${index < 5 ? 'top' : ''}`}
|
className={`seafile-multicolor-icon-container ${index < 5 ? 'top' : ''}`}
|
||||||
>
|
>
|
||||||
<img src={`${mediaUrl}img/wiki/${name}.png`} className={`${name === this.state.iconClass ? 'active' : ''}`} alt='' />
|
<img src={`${mediaUrl}img/wiki/${name}.png`} alt='' />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@@ -119,10 +119,10 @@ class Wikis extends Component {
|
|||||||
<div className="operation">
|
<div className="operation">
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<MediaQuery query="(min-width: 768px)">
|
<MediaQuery query="(min-width: 768px)">
|
||||||
<Button className="btn btn-secondary operation-item" onClick={this.onSelectToggle}>{gettext('Publish a Library')}</Button>
|
<Button className="btn btn-secondary operation-item" onClick={this.onSelectToggle}>{gettext('Add Wiki')}</Button>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
<MediaQuery query="(max-width: 767.8px)">
|
<MediaQuery query="(max-width: 767.8px)">
|
||||||
<span className="sf2-icon-plus mobile-toolbar-icon" title={gettext('Publish a Library')} onClick={this.onSelectToggle}></span>
|
<span className="sf2-icon-plus mobile-toolbar-icon" title={gettext('Add Wiki')} onClick={this.onSelectToggle}></span>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</div>
|
</div>
|
||||||
@@ -134,7 +134,7 @@ class Wikis extends Component {
|
|||||||
<div className="cur-view-container" id="wikis">
|
<div className="cur-view-container" id="wikis">
|
||||||
<div className="cur-view-path">
|
<div className="cur-view-path">
|
||||||
<div className="path-container">
|
<div className="path-container">
|
||||||
<h3 className="sf-heading m-0">{gettext('Published Libraries')}</h3>
|
<h3 className="sf-heading m-0">{gettext('Wikis')}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="cur-view-content">
|
<div className="cur-view-content">
|
||||||
@@ -148,7 +148,7 @@ class Wikis extends Component {
|
|||||||
{(!this.state.loading && this.state.wikis.length === 0) &&
|
{(!this.state.loading && this.state.wikis.length === 0) &&
|
||||||
<EmptyTip>
|
<EmptyTip>
|
||||||
<h2>{gettext('No published libraries')}</h2>
|
<h2>{gettext('No published libraries')}</h2>
|
||||||
<p>{gettext('You have not published any libraries yet. A published library can be accessed by anyone, not only users, via its URL. You can publish a library by clicking the "Publish a Library" button in the menu bar.')}</p>
|
<p>{gettext('You have not published any libraries yet. A published library can be accessed by anyone, not only users, via its URL. You can publish a library by clicking the "Add Wiki" button in the menu bar.')}</p>
|
||||||
</EmptyTip>
|
</EmptyTip>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user