Commit 6427ad81 authored by Jure's avatar Jure

Merge branch 'coko-theme' into 'master'

Initial start

See merge request pubsweet-starter-mini!1
parents 2f3626f0 ce6e9d19
......@@ -6,7 +6,7 @@ import { hot } from 'react-hot-loader'
import { configureStore, Root } from 'pubsweet-client'
import theme from '@pubsweet/default-theme'
import theme from '@pubsweet/coko-theme'
import createHistory from 'history/createBrowserHistory'
import routes from './routes'
......
......@@ -2,9 +2,9 @@ import React from 'react'
import PropTypes from 'prop-types'
import AuthenticatedComponent from 'pubsweet-client/src/components/AuthenticatedComponent'
import Navigation from '../Navigation/Navigation'
import Navigation from './Navigation/Navigation'
const AuthenticatedManage = ({ children, ...props }) => (
const App = ({ children, ...props }) => (
<div>
<Navigation />
<AuthenticatedComponent
......@@ -18,8 +18,8 @@ const AuthenticatedManage = ({ children, ...props }) => (
</div>
)
AuthenticatedManage.propTypes = {
App.propTypes = {
children: PropTypes.node.isRequired,
}
export default AuthenticatedManage
export default App
import React from 'react'
import PropTypes from 'prop-types'
import { NavLink } from 'react-router-dom'
import { connect } from 'react-redux'
import Authorize from 'pubsweet-client/src/helpers/Authorize'
import actions from 'pubsweet-client/src/actions'
import { AppBar } from '@pubsweet/ui'
import { Action, AppBar } from '@pubsweet/ui'
const Navigation = ({ logoutUser, currentUser }) => (
<AppBar
brand={<img alt="pubsweet" src="/assets/pubsweet.jpg" />}
navLinks={
<div>
<NavLink to="/manage/posts">Posts</NavLink>
<Authorize object={{ path: '/users' }} operation="GET">
<NavLink to="/manage/users">Users</NavLink>
</Authorize>
<Authorize object={{ path: '/teams' }} operation="GET">
<NavLink to="/manage/teams">Teams</NavLink>
</Authorize>
</div>
}
navLinkComponents={[
<Action to="/manage/posts">Posts</Action>,
<Authorize object={{ path: '/users' }} operation="GET">
<Action to="/manage/users">Users</Action>
</Authorize>,
<Authorize object={{ path: '/teams' }} operation="GET">
<Action to="/manage/teams">Teams</Action>
</Authorize>,
]}
onLogoutClick={logoutUser}
user={currentUser}
/>
......
......@@ -3,11 +3,7 @@ import { Route, Switch } from 'react-router-dom'
// Manage
import PostsManager from 'pubsweet-component-posts-manager/PostsManagerContainer'
import UsersManager from 'pubsweet-component-users-manager/UsersManagerContainer'
import TeamsManager from 'pubsweet-component-teams-manager/TeamsManagerContainer'
// Editor
import MediumDraft from 'pubsweet-component-medium-draft/MediumDraftContainer'
import UsersManager from 'pubsweet-component-users-manager/src/UsersManagerContainer'
// Public
import Blog from 'pubsweet-component-blog/BlogContainer'
......@@ -18,26 +14,19 @@ import Login from 'pubsweet-component-login/LoginContainer'
import Signup from 'pubsweet-component-signup/SignupContainer'
import PasswordReset from 'pubsweet-component-password-reset-frontend/PasswordReset'
import AuthenticatedManage from './components/AuthenticatedManage/AuthenticatedManage'
import App from './components/App'
const Managed = () => (
<AuthenticatedManage>
export default (
<App>
<Switch>
<Route component={PostsManager} path="/manage/posts" />
<Route component={Blog} exact path="/" />
<Route component={UsersManager} path="/manage/users" />
<Route component={TeamsManager} path="/manage/teams" />
<Route component={MediumDraft} path="/manage/sciencewriter/:id" />
</Switch>
</AuthenticatedManage>
)
<Route component={PostsManager} path="/manage/posts" />
export default (
<Switch>
<Route component={Blog} exact path="/" />
<Route component={Managed} path="/manage" />
<Route component={Login} path="/login" />
<Route component={Signup} path="/signup" />
<Route component={PasswordReset} path="/password-reset" />
<Route component={HTML} path="/:id" />
</Switch>
<Route component={Login} path="/login" />
<Route component={Signup} path="/signup" />
<Route component={PasswordReset} path="/password-reset" />
<Route component={HTML} path="/:id" />
</Switch>
</App>
)
const authsomeMode = async (userId, operation, object, context) =>
// if (!userId) {
// // unauthenticated
// return false
// }
// // It's up to us to retrieve the relevant models for our
// // authorization/authsome mode, e.g.
// const user = await context.models.User.find(userId)
// // Admins can do anything
// if (user && user.admin === true) return true
// if (user) {
// return authenticatedUser(user, operation, object, context)
// }
true
module.exports = authsomeMode
......@@ -17,15 +17,13 @@ module.exports = {
},
authsome: {
// this should be either an npm package or an absolute path, not a relative path
mode: 'authsome/src/modes/blog',
mode: path.resolve(__dirname, 'authsome-mode.js'),
teams: {
teamContributors: {
name: 'Contributors',
permissions: 'POST',
},
teamCoauthors: {
name: 'Coauthors',
permissions: 'PATCH',
},
},
},
......
......@@ -2,6 +2,9 @@ const { deferConfig } = require('config/defer')
module.exports = {
'pubsweet-server': {
db: {
database: 'starter',
},
baseUrl: deferConfig(
cfg => `http://localhost:${cfg['pubsweet-server'].port}`,
),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment