File tree 4 files changed +15
-5
lines changed
events/client/components/admin
posts/client/components/admin
4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ module.exports = {
27
27
quotes : [ 2 , 'single' ] ,
28
28
semi : [ 2 , 'always' ] ,
29
29
'no-unused-vars' : 1 ,
30
- 'no-console' : 0 ,
31
- 'react/prop-types' : 0 , // disabled for dev
30
+ 'no-console' : 1 ,
31
+ 'react/prop-types' : 1 , // disabled for dev
32
32
'react/no-danger' : 0
33
33
}
34
34
} ;
Original file line number Diff line number Diff line change
1
+ export default {
2
+ shortText ( text ) {
3
+ return text . length > 10 ? `${ text . slice ( 0 , 10 ) } ...` : text ;
4
+ } ,
5
+ } ;
6
+
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React, { Component } from 'react';
2
2
import { Link } from 'react-router' ;
3
3
import Loading from 'client/components/common/loading' ;
4
4
import moment from 'moment' ;
5
+ import { shortText } from 'lib/helpers' ;
5
6
6
7
export default class EventsList extends Component {
7
8
render ( ) {
@@ -28,16 +29,18 @@ export default class EventsList extends Component {
28
29
< th > 活动标题</ th >
29
30
< th > 活动日期</ th >
30
31
< th > 活动地点</ th >
32
+ < th > 人数限制</ th >
31
33
< th > 发布日期</ th >
32
34
< th > 操作</ th >
33
35
</ tr >
34
36
</ thead >
35
37
< tbody >
36
38
{ events . map ( ( event , index ) =>
37
39
< tr key = { event . _id } style = { { fontSize : '16px' } } >
38
- < td style = { { lineHeight : '50px' } } > < Link to = { `/event/${ event . _id } ` } > { event . title } </ Link > </ td >
40
+ < td style = { { lineHeight : '50px' } } > < Link to = { `/event/${ event . _id } ` } > { shortText ( event . title ) } </ Link > </ td >
39
41
< td style = { { lineHeight : '50px' } } > { moment ( event . time ) . format ( 'YYYY-MM-DD' ) } </ td >
40
- < td style = { { lineHeight : '50px' } } > { event . location } </ td >
42
+ < td style = { { lineHeight : '50px' } } > { shortText ( event . location ) } </ td >
43
+ < td style = { { lineHeight : '50px' } } > { shortText ( event . limit ) } </ td >
41
44
< td style = { { lineHeight : '50px' } } > { moment ( event . createdAt ) . format ( 'YYYY-MM-DD' ) } </ td >
42
45
< td style = { { lineHeight : '50px' } } >
43
46
< Link to = { `/admin/event/edit/${ event . _id } ` } className = "btn btn-success" style = { { marginRight : '10px' } } > 编辑</ Link >
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React, { Component } from 'react';
2
2
import { Link } from 'react-router' ;
3
3
import Loading from 'client/components/common/loading' ;
4
4
import moment from 'moment' ;
5
+ import { shortText } from 'lib/helpers' ;
5
6
6
7
export default class PostsList extends Component {
7
8
render ( ) {
@@ -36,7 +37,7 @@ export default class PostsList extends Component {
36
37
< tbody >
37
38
{ posts . map ( ( post , index ) =>
38
39
< tr key = { post . _id } style = { { fontSize : '16px' } } >
39
- < td style = { { lineHeight : '50px' } } > < Link to = { `/post/${ post . _id } ` } > { post . title } </ Link > </ td >
40
+ < td style = { { lineHeight : '50px' } } > < Link to = { `/post/${ post . _id } ` } > { shortText ( post . title ) } </ Link > </ td >
40
41
< td style = { { lineHeight : '50px' } } > { post . category } </ td >
41
42
< td style = { { lineHeight : '50px' } } > { post . author } </ td >
42
43
< td style = { { lineHeight : '50px' } } > { moment ( post . createdAt ) . format ( 'YYYY-MM-DD' ) } </ td >
You can’t perform that action at this time.
0 commit comments