Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
model adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanflorentin committed Oct 10, 2016
1 parent 0e31236 commit 9e2ff0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/createMainContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {PropTypes} from 'react'
import {Router, Route} from 'react-router'

const createMainContainer = (MainRoute, apps, MainContainer) =>{
// console.log('createMainContainer', MainRoute, apps, MainContainer)
const Container = (props) =>{
for (let appName in apps) {
const app = apps[appName]
Expand Down Expand Up @@ -34,7 +35,7 @@ const createMainContainer = (MainRoute, apps, MainContainer) =>{
}
return <div>
<Router>
<Route path="/" model={MainContainer}>
<Route path="/" component={MainContainer}>
{MainRoute}
</Route>
</Router>
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import menuCreator from './menu'
export {createMainContainer} from './createMainContainer'

export default function (appDef) {
// console.log('ProvideAppCrud.appDef', appDef)
const components = {}
const providers = {}
const componentRoutes = []
Expand Down
14 changes: 7 additions & 7 deletions src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default function (appDef) {
} = appDef
const AppMenu = (props) =>{
const {pushRoute} = props
const buttons = appDef.components.map((component, index) =>{
const {componentName} = component
const componentProperName = componentName[0].toUpperCase() +
componentName.substring(1)
return <Button key={`${componentProperName}${index}`}
label={componentProperName} primary onClick={() =>{
pushRoute(`/${appRoute}/${component.componentName}/list`)
const buttons = appDef.models.map((model, index) =>{
const {modelName} = model
const modelProperName = modelName[0].toUpperCase() +
modelName.substring(1)
return <Button key={`${modelProperName}${index}`}
label={modelProperName} primary onClick={() =>{
pushRoute(`/${appRoute}/${model.modelName}/list`)
}}/>
})

Expand Down
6 changes: 3 additions & 3 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export default function (modelDef, models) {
const display = 'display' + modelProperName
return (
<Route key={mainPath} path={mainPath}>
<Route path='edit' model={models[edit]}/>
<Route path='list' model={models[list]}/>
<Route path='display' model={models[display]}/>
<Route path='edit' component={models[edit]}/>
<Route path='list' component={models[list]}/>
<Route path='display' component={models[display]}/>
</Route>
)
}
Expand Down

0 comments on commit 9e2ff0a

Please sign in to comment.