Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ant-design/ant-design-pro
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Jan 10, 2018
2 parents cf41067 + 5776750 commit c592981
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"scripts": {
"precommit": "npm run lint-staged",
"start": "cross-env DISABLE_ESLINT=true roadhog dev",
"start:no-proxy": "cross-env NO_PROXY=true roadhog dev",
"build": "roadhog build",
"start:no-proxy": "cross-env NO_PROXY=true DISABLE_ESLINT=true roadhog dev",
"build": "cross-env DISABLE_ESLINT=true roadhog build",
"site": "roadhog-api-doc static && gh-pages -d dist",
"analyze": "roadhog build --analyze",
"lint:style": "stylelint \"src/**/*.less\" --syntax less",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Authorized/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ReactDOM.render(
<Authorized authority={havePermissionAsync} noMatch={noMatch}>
<Alert message="Use Promise as a parameter passed!" type="success" showIcon />
</Authorized>
</div>
mountNode,
</div>,
mountNode
);
```
73 changes: 73 additions & 0 deletions src/components/Authorized/demo/secured.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
order: 1
title:
zh-CN: 注解
en-US: secured
---

```jsx
import RenderAuthorized from 'ant-design-pro/lib/Authorized';
import { Alert } from 'antd';

const { Secured } = RenderAuthorized('user');
const noMatch = <Alert message="No permission." type="error" showIcon />;

const havePermission = () => {
return false;
};

const havePermissionAsync = new Promise((resolve, reject) => {
// Call reslove on behalf of passed
setTimeout(() => reslove(), 1000);
});

@Secured('admin', noMatch)
class TestSecuredString extends React.Component {
render() {
<Alert message="user Passed!" type="success" showIcon />;
}
}

@Secured(['user', 'admin'], noMatch)
class TestSecuredArray extends React.Component {
render() {
<Alert
message="Use Array as a parameter passed!"
type="success"
showIcon
/>;
}
}

@Secured(havePermission, noMatch)
class TestSecuredFunction extends React.Component {
render() {
<Alert
message="Use function as a parameter passed!"
type="success"
showIcon
/>;
}
}

@Secured(havePermissionAsync, noMatch)
class TestSecuredPromise extends React.Component {
render() {
<Alert
message="Use Promise as a parameter passed!"
type="success"
showIcon
/>;
}
}

ReactDOM.render(
<div>
<TestSecuredString />
<TestSecuredArray />
<TestSecuredFunction />
<TestSecuredPromise />
</div>,
mountNode,
);
```
2 changes: 1 addition & 1 deletion src/components/Ellipsis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default class Ellipsis extends Component {
<div id={id} className={cls} {...restProps}>
<style>{style}</style>
{
tooltip ? (<Tooltip title={text}>{children}</Tooltip>) : children
tooltip ? (<Tooltip title={children}>{children}</Tooltip>) : children
}
</div>);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/GlobalFooter/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const links = [{
title: '帮助',
href: '',
}, {
key: 'github'
key: 'github',
title: <Icon type="github" />,
href: 'https://github.com/ant-design/ant-design-pro',
blankTarget: true,
Expand Down
11 changes: 6 additions & 5 deletions src/layouts/UserLayout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Link, Route } from 'dva/router';
import { Link, Redirect, Switch, Route } from 'dva/router';
import DocumentTitle from 'react-document-title';
import { Icon } from 'antd';
import GlobalFooter from '../components/GlobalFooter';
Expand Down Expand Up @@ -47,8 +47,8 @@ class UserLayout extends React.PureComponent {
</div>
<div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
</div>
{
getRoutes(match.path, routerData).map(item =>
<Switch>
{getRoutes(match.path, routerData).map(item =>
(
<Route
key={item.key}
Expand All @@ -57,8 +57,9 @@ class UserLayout extends React.PureComponent {
exact={item.exact}
/>
)
)
}
)}
<Redirect exact from="/user" to="/user/login" />
</Switch>
<GlobalFooter className={styles.footer} links={links} copyright={copyright} />
</div>
</DocumentTitle>
Expand Down

0 comments on commit c592981

Please sign in to comment.