File tree Expand file tree Collapse file tree 8 files changed +79
-36
lines changed Expand file tree Collapse file tree 8 files changed +79
-36
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import ChildList from "./ChildList" ;
3
+ import { Link } from "react-router-dom" ;
3
4
4
5
const EditHome = ( ) => {
5
6
return (
6
7
< div >
7
- < p > Welcome to the editor!</ p >
8
+ < h1 > Editor</ h1 >
9
+ < h2 > Tools</ h2 >
10
+ < ul >
11
+ < li >
12
+ < Link to = "/edit/newChild" > Create New Top-Level Object</ Link >
13
+ </ li >
14
+ </ ul >
15
+ < h2 > Contents</ h2 >
8
16
< ChildList />
9
17
</ div >
10
18
) ;
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import PropTypes from "prop-types" ;
3
3
import ChildList from "./ChildList" ;
4
+ import { Link } from "react-router-dom" ;
4
5
5
6
const ObjectEditor = ( { pid } ) => {
6
7
return (
7
8
< div >
8
- < p > You are editing { pid } </ p >
9
+ < h1 > Editor: Object { pid } </ h1 >
10
+ < h2 > Tools</ h2 >
11
+ < ul >
12
+ < li >
13
+ < Link to = { `/edit/object/${ pid } /newChild` } > Create New Child Object</ Link >
14
+ </ li >
15
+ </ ul >
16
+ < h2 > Contents</ h2 >
9
17
< ChildList pid = { pid } />
10
18
</ div >
11
19
) ;
Original file line number Diff line number Diff line change 2
2
3
3
exports [` EditHome renders 1` ] = `
4
4
<div >
5
- <p >
6
- Welcome to the editor!
7
- </p >
5
+ <h1 >
6
+ Editor
7
+ </h1 >
8
+ <h2 >
9
+ Tools
10
+ </h2 >
11
+ <ul >
12
+ <li >
13
+ <Link
14
+ to = " /edit/newChild"
15
+ >
16
+ Create New Top-Level Object
17
+ </Link >
18
+ </li >
19
+ </ul >
20
+ <h2 >
21
+ Contents
22
+ </h2 >
8
23
<ChildList />
9
24
</div >
10
25
` ;
Original file line number Diff line number Diff line change 2
2
3
3
exports [` ObjectEditor renders 1` ] = `
4
4
<div >
5
- <p >
6
- You are editing
5
+ <h1 >
6
+ Editor: Object
7
7
foo:123
8
- </p >
8
+ </h1 >
9
+ <h2 >
10
+ Tools
11
+ </h2 >
12
+ <ul >
13
+ <li >
14
+ <Link
15
+ to = " /edit/object/foo:123/newChild"
16
+ >
17
+ Create New Child Object
18
+ </Link >
19
+ </li >
20
+ </ul >
21
+ <h2 >
22
+ Contents
23
+ </h2 >
9
24
<ChildList
10
25
pid = " foo:123"
11
26
/>
Original file line number Diff line number Diff line change @@ -27,12 +27,6 @@ const MainMenu = () => {
27
27
< Link to = "/solr" > Solr Indexer</ Link >
28
28
</ li >
29
29
</ ul >
30
- < h2 > Object Editor Pieces</ h2 >
31
- < ul >
32
- < li >
33
- < Link to = "/editor/object/new" > Create Object</ Link >
34
- </ li >
35
- </ ul >
36
30
</ div >
37
31
) ;
38
32
} ;
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ import PdfGenerator from "./PdfGenerator";
10
10
import SolrIndexer from "./SolrIndexer" ;
11
11
import CreateObject from "./Editor/CreateObject" ;
12
12
13
+ const CreateObjectHook = ( ) => {
14
+ const { pid } = useParams ( ) ;
15
+ return < CreateObject parentPid = { pid } allowNoParentPid = { false } allowChangeParentPid = { false } /> ;
16
+ } ;
17
+
13
18
const JobPaginatorHook = ( ) => {
14
19
const { category, job } = useParams ( ) ;
15
20
return < JobPaginator initialCategory = { category } initialJob = { job } /> ;
@@ -29,6 +34,12 @@ const Routes = () => {
29
34
< Route exact path = "/edit" >
30
35
< EditHome />
31
36
</ Route >
37
+ < Route exact path = "/edit/newChild" >
38
+ < CreateObject allowNoParentPid = { true } allowChangeParentPid = { false } />
39
+ </ Route >
40
+ < Route path = "/edit/object/:pid/newChild" >
41
+ < CreateObjectHook />
42
+ </ Route >
32
43
< Route path = "/edit/object/:pid" >
33
44
< ObjectEditorHook />
34
45
</ Route >
@@ -44,9 +55,6 @@ const Routes = () => {
44
55
< Route exact path = "/solr" >
45
56
< SolrIndexer />
46
57
</ Route >
47
- < Route path = "/editor/object/new" >
48
- < CreateObject allowNoParentPid = { true } />
49
- </ Route >
50
58
</ Switch >
51
59
) ;
52
60
} ;
Original file line number Diff line number Diff line change @@ -62,17 +62,5 @@ exports[`MainMenu renders 1`] = `
62
62
</Link >
63
63
</li >
64
64
</ul >
65
- <h2 >
66
- Object Editor Pieces
67
- </h2 >
68
- <ul >
69
- <li >
70
- <Link
71
- to = " /editor/object/new"
72
- >
73
- Create Object
74
- </Link >
75
- </li >
76
- </ul >
77
65
</div >
78
66
` ;
Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ exports[`Routes render 1`] = `
14
14
>
15
15
<EditHome />
16
16
</Route >
17
+ <Route
18
+ exact = { true }
19
+ path = " /edit/newChild"
20
+ >
21
+ <CreateObject
22
+ allowChangeParentPid = { false }
23
+ allowNoParentPid = { true }
24
+ />
25
+ </Route >
26
+ <Route
27
+ path = " /edit/object/:pid/newChild"
28
+ >
29
+ <CreateObjectHook />
30
+ </Route >
17
31
<Route
18
32
path = " /edit/object/:pid"
19
33
>
@@ -42,12 +56,5 @@ exports[`Routes render 1`] = `
42
56
>
43
57
<Component />
44
58
</Route >
45
- <Route
46
- path = " /editor/object/new"
47
- >
48
- <CreateObject
49
- allowNoParentPid = { true }
50
- />
51
- </Route >
52
59
</Switch >
53
60
` ;
You can’t perform that action at this time.
0 commit comments