Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
editoria
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
Yannis Barlas
editoria
Commits
b1184a9d
Commit
b1184a9d
authored
8 years ago
by
john
Browse files
Options
Downloads
Patches
Plain Diff
attempt to make bookbuilder working with pubsweet
parent
a71e56e9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/components/BookBuilder/BookBuilder.jsx
+24
-7
24 additions, 7 deletions
app/components/BookBuilder/BookBuilder.jsx
with
24 additions
and
7 deletions
app/components/BookBuilder/BookBuilder.jsx
+
24
−
7
View file @
b1184a9d
...
@@ -30,9 +30,7 @@ export class BookBuilder extends React.Component {
...
@@ -30,9 +30,7 @@ export class BookBuilder extends React.Component {
componentWillMount
()
{
componentWillMount
()
{
const
{
actions
,
book
}
=
this
.
props
const
{
actions
,
book
}
=
this
.
props
const
{
getUsers
,
getTeams
,
getCollections
,
getFragments
}
=
actions
const
{
getCollections
,
getFragments
,
getTeams
,
getUsers
}
=
actions
// console.log(this.props.actions)
getUsers
().
then
(
getUsers
().
then
(
()
=>
getTeams
()
()
=>
getTeams
()
...
@@ -42,10 +40,25 @@ export class BookBuilder extends React.Component {
...
@@ -42,10 +40,25 @@ export class BookBuilder extends React.Component {
return
getCollections
()
return
getCollections
()
}
}
).
then
(
).
then
(
()
=>
getFragments
(
book
)
()
=>
{
console
.
log
(
book
.
id
)
if
(
book
.
id
)
getFragments
(
book
)
}
)
)
}
}
// componentWillReceiveProps (nextProps) {
// const { actions, book } = nextProps
// const { getFragments } = actions
// //
// console.log(book)
// console.log(this.props)
// //
// // if (book.id && book.id !== this.props.id) {
// // // getFragments(book)
// // }
// }
componentDidMount
()
{
componentDidMount
()
{
// I'm using the ref inside the render function it was created in
// I'm using the ref inside the render function it was created in
// So it won't be available until didMount
// So it won't be available until didMount
...
@@ -61,6 +74,8 @@ export class BookBuilder extends React.Component {
...
@@ -61,6 +74,8 @@ export class BookBuilder extends React.Component {
return
t
.
teamType
.
name
===
'
Production Editor
'
&&
t
.
object
.
id
===
book
.
id
return
t
.
teamType
.
name
===
'
Production Editor
'
&&
t
.
object
.
id
===
book
.
id
})
})
if
(
!
productionEditorsTeam
)
return
console
.
log
(
'
to crash
'
)
const
productionEditors
=
_
.
filter
(
users
,
function
(
u
)
{
const
productionEditors
=
_
.
filter
(
users
,
function
(
u
)
{
return
_
.
includes
(
productionEditorsTeam
.
members
,
u
.
id
)
return
_
.
includes
(
productionEditorsTeam
.
members
,
u
.
id
)
})
})
...
@@ -226,14 +241,14 @@ export class BookBuilder extends React.Component {
...
@@ -226,14 +241,14 @@ export class BookBuilder extends React.Component {
}
}
BookBuilder
.
propTypes
=
{
BookBuilder
.
propTypes
=
{
actions
:
React
.
PropTypes
.
object
.
isRequired
,
book
:
React
.
PropTypes
.
object
.
isRequired
,
book
:
React
.
PropTypes
.
object
.
isRequired
,
chapters
:
React
.
PropTypes
.
array
.
isRequired
,
chapters
:
React
.
PropTypes
.
array
.
isRequired
,
actions
:
React
.
PropTypes
.
object
.
isRequired
,
// error: React.PropTypes.string,
error
:
React
.
PropTypes
.
string
,
// userRoles: React.PropTypes.array,
teams
:
React
.
PropTypes
.
array
,
teams
:
React
.
PropTypes
.
array
,
users
:
React
.
PropTypes
.
array
,
users
:
React
.
PropTypes
.
array
,
user
:
React
.
PropTypes
.
object
user
:
React
.
PropTypes
.
object
// userRoles: React.PropTypes.array,
}
}
function
mapStateToProps
(
state
,
ownProps
)
{
function
mapStateToProps
(
state
,
ownProps
)
{
...
@@ -241,6 +256,8 @@ function mapStateToProps (state, ownProps) {
...
@@ -241,6 +256,8 @@ function mapStateToProps (state, ownProps) {
return
c
.
id
===
ownProps
.
params
.
id
return
c
.
id
===
ownProps
.
params
.
id
})
})
console
.
log
(
state
)
let
chapters
=
_
.
sortBy
(
_
.
filter
(
state
.
fragments
,
function
(
f
)
{
let
chapters
=
_
.
sortBy
(
_
.
filter
(
state
.
fragments
,
function
(
f
)
{
return
f
.
book
===
book
.
id
&&
f
.
id
&&
!
f
.
deleted
return
f
.
book
===
book
.
id
&&
f
.
id
&&
!
f
.
deleted
}),
'
index
'
)
}),
'
index
'
)
...
...
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