Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pubsweet
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Tremblay McLellan
pubsweet
Commits
48ffc6a0
Commit
48ffc6a0
authored
9 years ago
by
Jure
Browse files
Options
Downloads
Patches
Plain Diff
Added a table to the Blogpost list.
parent
29cb6ac9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/Admin/Blogpost.jsx
+28
-20
28 additions, 20 deletions
app/components/Admin/Blogpost.jsx
app/components/Admin/BlogpostList.jsx
+15
-1
15 additions, 1 deletion
app/components/Admin/BlogpostList.jsx
with
43 additions
and
21 deletions
app/components/Admin/Blogpost.jsx
+
28
−
20
View file @
48ffc6a0
import
React
from
'
react
'
import
React
from
'
react
'
import
{
Button
,
Row
,
Col
}
from
'
react-bootstrap
'
import
{
Button
}
from
'
react-bootstrap
'
import
{
LinkContainer
}
from
'
react-router-bootstrap
'
import
{
LinkContainer
}
from
'
react-router-bootstrap
'
import
TextInput
from
'
./TextInput
'
import
TextInput
from
'
./TextInput
'
...
@@ -46,7 +46,7 @@ export default class Blogpost extends React.Component {
...
@@ -46,7 +46,7 @@ export default class Blogpost extends React.Component {
}
}
render
()
{
render
()
{
const
{
blogpost
}
=
this
.
props
const
{
blogpost
,
number
}
=
this
.
props
var
input
var
input
if
(
this
.
state
.
isEditing
)
{
if
(
this
.
state
.
isEditing
)
{
input
=
input
=
...
@@ -57,29 +57,37 @@ export default class Blogpost extends React.Component {
...
@@ -57,29 +57,37 @@ export default class Blogpost extends React.Component {
/>
/>
}
}
return
(
return
(
<
div
className
=
'blogpost'
>
<
tr
className
=
'blogpost'
key
=
{
blogpost
.
key
}
>
<
Row
key
=
{
blogpost
.
_id
}
>
<
td
>
<
Col
xs
=
{
12
}
md
=
{
8
}
>
{
number
}
<
label
onDoubleClick
=
{
this
.
_onDoubleClick
}
>
</
td
>
{
blogpost
.
title
}
(
{
blogpost
.
status
}
)
<
td
>
</
label
>
<
label
onDoubleClick
=
{
this
.
_onDoubleClick
}
>
{
input
}
{
blogpost
.
title
}
</
Col
>
</
label
>
<
Col
xs
=
{
12
}
md
=
{
4
}
>
{
input
}
<
LinkContainer
to
=
{
`/admin/editor/
${
blogpost
.
_id
}
`
}
>
</
td
>
<
Button
bsStyle
=
'primary'
>
Edit this
</
Button
>
<
td
>
</
LinkContainer
>
{
blogpost
.
author
}
<
Button
bsStyle
=
'success'
onClick
=
{
this
.
_onPublish
}
>
Publish
</
Button
>
</
td
>
<
Button
bsStyle
=
'warning'
onClick
=
{
this
.
_onUnpublish
}
>
Unpublish
</
Button
>
<
td
>
<
Button
bsStyle
=
'danger'
onClick
=
{
this
.
_onDestroyClick
}
>
Delete
</
Button
>
{
blogpost
.
published_at
}
(
{
blogpost
.
status
}
)
</
Col
>
</
td
>
</
Row
>
<
td
>
</
div
>
<
LinkContainer
to
=
{
`/admin/editor/
${
blogpost
.
_id
}
`
}
>
<
Button
bsStyle
=
'primary'
>
Edit this
</
Button
>
</
LinkContainer
>
<
Button
bsStyle
=
'success'
onClick
=
{
this
.
_onPublish
}
>
Publish
</
Button
>
<
Button
bsStyle
=
'warning'
onClick
=
{
this
.
_onUnpublish
}
>
Unpublish
</
Button
>
<
Button
bsStyle
=
'danger'
onClick
=
{
this
.
_onDestroyClick
}
>
Delete
</
Button
>
</
td
>
</
tr
>
)
)
}
}
}
}
Blogpost
.
propTypes
=
{
Blogpost
.
propTypes
=
{
number
:
React
.
PropTypes
.
number
,
blogpost
:
React
.
PropTypes
.
object
,
blogpost
:
React
.
PropTypes
.
object
,
delete
:
React
.
PropTypes
.
func
,
delete
:
React
.
PropTypes
.
func
,
update
:
React
.
PropTypes
.
func
update
:
React
.
PropTypes
.
func
...
...
This diff is collapsed.
Click to expand it.
app/components/Admin/BlogpostList.jsx
+
15
−
1
View file @
48ffc6a0
...
@@ -7,6 +7,7 @@ export default class BlogpostList extends React.Component {
...
@@ -7,6 +7,7 @@ export default class BlogpostList extends React.Component {
render
()
{
render
()
{
const
blogposts
=
this
.
props
.
blogposts
.
map
((
blogpost
,
key
)
=>
{
const
blogposts
=
this
.
props
.
blogposts
.
map
((
blogpost
,
key
)
=>
{
return
(<
Blogpost
return
(<
Blogpost
number
=
{
key
+
1
}
key
=
{
blogpost
.
_id
}
key
=
{
blogpost
.
_id
}
blogpost
=
{
blogpost
}
blogpost
=
{
blogpost
}
delete
=
{
this
.
props
.
delete
}
delete
=
{
this
.
props
.
delete
}
...
@@ -16,7 +17,20 @@ export default class BlogpostList extends React.Component {
...
@@ -16,7 +17,20 @@ export default class BlogpostList extends React.Component {
return
(
return
(
<
div
className
=
{
styles
[
'
list
'
]
}
>
<
div
className
=
{
styles
[
'
list
'
]
}
>
<
h3
className
=
{
styles
[
'
header
'
]
}
>
Blog posts
</
h3
>
<
h3
className
=
{
styles
[
'
header
'
]
}
>
Blog posts
</
h3
>
{
blogposts
}
<
table
className
=
'table table-hover'
>
<
thead
>
<
tr
>
<
th
>
#
</
th
>
<
th
>
Title
</
th
>
<
th
>
Author
</
th
>
<
th
>
Status
</
th
>
<
th
>
Actions
</
th
>
</
tr
>
</
thead
>
<
tbody
>
{
blogposts
}
</
tbody
>
</
table
>
</
div
>
</
div
>
)
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment