Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ant-design-pro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thiago Borges
ant-design-pro
Commits
c5929815
Commit
c5929815
authored
Jan 10, 2018
by
afc163
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:ant-design/ant-design-pro
parents
cf41067c
57767505
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
11 deletions
+85
-11
package.json
package.json
+2
-2
basic.md
src/components/Authorized/demo/basic.md
+2
-2
secured.md
src/components/Authorized/demo/secured.md
+73
-0
index.js
src/components/Ellipsis/index.js
+1
-1
basic.md
src/components/GlobalFooter/demo/basic.md
+1
-1
UserLayout.js
src/layouts/UserLayout.js
+6
-5
No files found.
package.json
View file @
c5929815
...
...
@@ -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"
,
...
...
src/components/Authorized/demo/basic.md
View file @
c5929815
...
...
@@ -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
);
```
src/components/Authorized/demo/secured.md
0 → 100644
View file @
c5929815
---
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,
);
```
src/components/Ellipsis/index.js
View file @
c5929815
...
...
@@ -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>
)
: childre
n
tooltip
?
(
<
Tooltip
title
=
{
children
}
>
{
children
}
<
/Tooltip>
)
: childre
n
}
<
/div>
)
;
}
...
...
src/components/GlobalFooter/demo/basic.md
View file @
c5929815
...
...
@@ -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,
...
...
src/layouts/UserLayout.js
View file @
c5929815
import
React
from
'react'
;
import
{
Link
,
Route
}
from
'dva/router'
;
import
{
Link
,
R
edirect
,
Switch
,
R
oute
}
from
'dva/router'
;
import
DocumentTitle
from
'react-document-title'
;
import
{
Icon
}
from
'antd'
;
import
GlobalFooter
from
'../components/GlobalFooter'
;
...
...
@@ -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
}
...
...
@@ -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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment