|
@@ -1,94 +1,59 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
-//import { Pagination } from 'react-js-pagination';
|
|
|
|
|
import Pagination from 'react-bootstrap/lib/Pagination';
|
|
import Pagination from 'react-bootstrap/lib/Pagination';
|
|
|
export default class RecentCreated extends React.Component {
|
|
export default class RecentCreated extends React.Component {
|
|
|
|
|
|
|
|
|
|
+ constructor(props) {
|
|
|
|
|
+ super(props);
|
|
|
|
|
+
|
|
|
|
|
+ this.state = {
|
|
|
|
|
+ RecentCreatedData : '',
|
|
|
|
|
+ pages : [] ,
|
|
|
|
|
+ };
|
|
|
|
|
+ this.getRecentCreatedList = this.getRecentCreatedList.bind(this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ componentWillMount() {
|
|
|
|
|
+ this.getRecentCreatedList( );
|
|
|
|
|
+ }
|
|
|
|
|
+ getRecentCreatedList() {
|
|
|
|
|
+
|
|
|
|
|
+ const pageId = this.props.pageId;
|
|
|
|
|
+ const userId = this.props.crowi.me;
|
|
|
|
|
+
|
|
|
|
|
+ this.props.crowi.apiGet('/pages.list', {page_id: pageId , user: userId , limit: 3 , offset: 3 , })
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ const pages = res.pages;
|
|
|
|
|
+ let inUse = {};
|
|
|
|
|
+
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ pages: pages,
|
|
|
|
|
+ inUse: inUse,
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
- const testval = null;
|
|
|
|
|
- let active = 7;
|
|
|
|
|
|
|
+ let active = 1;
|
|
|
let items = [];
|
|
let items = [];
|
|
|
- for (let number = 1; number <= 10; number++) {
|
|
|
|
|
|
|
+ for (let number = 1; number <= 5; number++) {
|
|
|
items.push(
|
|
items.push(
|
|
|
- <Pagination.Item active={number === active}>{number}</Pagination.Item>
|
|
|
|
|
|
|
+ <Pagination.Item key={number} active={number === active}>{number}</Pagination.Item>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
return (
|
|
return (
|
|
|
<div className="page-list-container-create">
|
|
<div className="page-list-container-create">
|
|
|
<ul className="page-list-ul page-list-ul-flat">
|
|
<ul className="page-list-ul page-list-ul-flat">
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest1
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest2
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest3
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest4
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest5
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest6
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
-
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox/Bootstrap3" className="page-list-link" data-path="/Sandbox/Bootstrap3" data-short-path="Bootstrap3">/reactTest7
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/" className="page-list-link" data-path="/" data-short-path="">/
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- <span className="label label-info">RE</span>
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
-
|
|
|
|
|
- <a href="/user/tsuyoshi" className="page-list-link" data-path="/user/tsuyoshi" data-short-path="tsuyoshi">/user/tsuyoshi/GC-939
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li>
|
|
|
|
|
- <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
- <a href="/Sandbox" className="page-list-link" data-path="/Sandbox" data-short-path="/Sandbox">/ReactComponentTest
|
|
|
|
|
- </a>
|
|
|
|
|
- <span className="page-list-meta">
|
|
|
|
|
- </span>
|
|
|
|
|
- </li>
|
|
|
|
|
|
|
+ {!this.state.pages.lenth != 0 &&
|
|
|
|
|
+ this.state.pages.map((page, i) => {
|
|
|
|
|
+ return <li key="{page.id}">
|
|
|
|
|
+ <img src="/images/icons/user.svg" className="picture img-circle" ></img>
|
|
|
|
|
+ <a href="{page.path}" className="page-list-link" data-path="{page.path}" data-short-path="{page.revision.body}">{decodeURI(page.path)}</a>
|
|
|
|
|
+ </li> ;
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
</ul>
|
|
</ul>
|
|
|
<Pagination bsSize="small">{items}</Pagination>
|
|
<Pagination bsSize="small">{items}</Pagination>
|
|
|
</div>
|
|
</div>
|
|
@@ -97,11 +62,9 @@ export default class RecentCreated extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
RecentCreated.propTypes = {
|
|
RecentCreated.propTypes = {
|
|
|
|
|
+ pageId: PropTypes.string.isRequired,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
RecentCreated.defaultProps = {
|
|
RecentCreated.defaultProps = {
|
|
|
- page: {},
|
|
|
|
|
- linkTo: '',
|
|
|
|
|
- excludePathString: '',
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|