From 3ba69d9aab7883f7af483372f2a9974990beab24 Mon Sep 17 00:00:00 2001 From: Justine Date: Wed, 27 Jan 2021 12:04:51 +0100 Subject: [PATCH 1/5] added title meta tag --- templates/next/components/foo/Form.tsx | 7 +++++++ templates/next/components/foo/List.tsx | 7 +++++++ templates/next/components/foo/Show.tsx | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/templates/next/components/foo/Form.tsx b/templates/next/components/foo/Form.tsx index 2284cff5..6572f728 100644 --- a/templates/next/components/foo/Form.tsx +++ b/templates/next/components/foo/Form.tsx @@ -1,6 +1,7 @@ import { FunctionComponent, useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; +import Head from "next/head"; import { Formik } from "formik"; import { fetch } from "../../utils/dataAccess"; import { {{{ucf}}} } from '../../types/{{{ucf}}}'; @@ -27,6 +28,12 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { return (
+
+ + {{{lc}}} Form page + + +
{ {{{lc}}} ?

Edit {{{ucf}}} { {{{lc}}}['@id'] }

:

Create {{{ucf}}}

} = ({ {{{name}}} }) => (
+
+ + {{{lc}}} List page + + +

{{{ucf}}} List

Create diff --git a/templates/next/components/foo/Show.tsx b/templates/next/components/foo/Show.tsx index 1b45dcbe..6aa3487d 100644 --- a/templates/next/components/foo/Show.tsx +++ b/templates/next/components/foo/Show.tsx @@ -1,5 +1,6 @@ import { FunctionComponent, useState } from 'react'; import Link from 'next/link'; +import Head from "next/head"; import { useRouter } from "next/router"; import { fetch } from "../../utils/dataAccess"; import { ReferenceLinks } from '../common/ReferenceLinks'; @@ -27,6 +28,12 @@ export const Show: FunctionComponent = ({ {{{lc}}} }) => { return (
+
+ + {{{lc}}} Show page + + +

Show { {{{lc}}}['@id'] }

From 0bb8f56dc0d9b065e305180ba6e77d09e38b61cb Mon Sep 17 00:00:00 2001 From: Justine Date: Wed, 27 Jan 2021 14:32:50 +0100 Subject: [PATCH 2/5] changed title --- templates/next/components/foo/Form.tsx | 128 ++++++++++++------------- templates/next/components/foo/List.tsx | 12 +-- templates/next/components/foo/Show.tsx | 4 +- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/templates/next/components/foo/Form.tsx b/templates/next/components/foo/Form.tsx index 6572f728..3686d94f 100644 --- a/templates/next/components/foo/Form.tsx +++ b/templates/next/components/foo/Form.tsx @@ -28,21 +28,21 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { return (
-
+
- {{{lc}}} Form page + { {{{lc}}} ? Edit {{{ucf}}} { {{{lc}}}['@id'] } : Create {{{ucf}}}}
- { {{{lc}}} ?

Edit {{{ucf}}} { {{{lc}}}['@id'] }

:

Create {{{ucf}}}

} - { - const errors = {}; - // add your validation logic here + { {{{lc}}} ?

Edit {{{ucf}}} { {{{lc}}}['@id'] }

:

Create {{{ucf}}}

} + { + const errors = {}; + // add your validation logic here return errors; - }} - onSubmit={async (values, { setSubmitting, setStatus }) => { + }} + onSubmit={async (values, { setSubmitting, setStatus }) => { const isCreation = !values["@id"]; try { await fetch(isCreation ? "/{{{name}}}" : values["@id"], { @@ -60,24 +60,24 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { msg: `Error when ${isCreation ? 'creating': 'updating'} the resource.`, }); } - setSubmitting(false); - }} - > - {({ - values, + setSubmitting(false); + }} + > + {({ + values, status, errors, touched, - handleChange, - handleBlur, - handleSubmit, - isSubmitting, - }) => ( -
+ handleChange, + handleBlur, + handleSubmit, + isSubmitting, + }) => ( + {{#each formFields}} -
- - + + = ({ {{{lc}}} }) => { {{#if required}}required={true}{{/if}} className={`form-control${errors.{{name}} && touched.{{name}} ? ' is-invalid' : ''}`} aria-invalid={errors.{{name}} && touched.{{name~}} } - onChange={handleChange} - onBlur={handleBlur} - /> -
- { errors.{{name}} && touched.{{name}} &&
{ errors.{{name}} }
} + onChange={handleChange} + onBlur={handleBlur} + /> +
+ { errors.{{name}} && touched.{{name}} &&
{ errors.{{name}} }
} {{/each}} - {status && status.msg && ( -
- {status.msg} -
- )} + {status && status.msg && ( +
+ {status.msg} +
+ )} - {error && ( -
- {error} -
- )} + {error && ( +
+ {error} +
+ )} - - - )} - - - Back to list - - { {{{lc}}} && ( - - )} -
- ); + + + )} + + + Back to list + + { {{{lc}}} && ( + + )} + + ); }; diff --git a/templates/next/components/foo/List.tsx b/templates/next/components/foo/List.tsx index a144e5d7..c0d7fa01 100644 --- a/templates/next/components/foo/List.tsx +++ b/templates/next/components/foo/List.tsx @@ -10,12 +10,12 @@ interface Props { export const List: FunctionComponent = ({ {{{name}}} }) => (
-
- - {{{lc}}} List page - - -
+
+ + {{{ucf}}} List + + +

{{{ucf}}} List

Create diff --git a/templates/next/components/foo/Show.tsx b/templates/next/components/foo/Show.tsx index 6aa3487d..bdc42c32 100644 --- a/templates/next/components/foo/Show.tsx +++ b/templates/next/components/foo/Show.tsx @@ -28,9 +28,9 @@ export const Show: FunctionComponent = ({ {{{lc}}} }) => { return (
-
+
- {{{lc}}} Show page + Show { {{{lc}}}['@id'] }
From bdfc0be10ccf3eed70d49b8c363d053fd0d3cb83 Mon Sep 17 00:00:00 2001 From: Justine Date: Thu, 28 Jan 2021 09:30:14 +0100 Subject: [PATCH 3/5] requested changes on titles --- templates/next/components/foo/Form.tsx | 6 +++--- templates/next/components/foo/List.tsx | 2 +- templates/next/components/foo/Show.tsx | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/next/components/foo/Form.tsx b/templates/next/components/foo/Form.tsx index 3686d94f..f97a3b9e 100644 --- a/templates/next/components/foo/Form.tsx +++ b/templates/next/components/foo/Form.tsx @@ -30,11 +30,11 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => {
- { {{{lc}}} ? Edit {{{ucf}}} { {{{lc}}}['@id'] } : Create {{{ucf}}}} - + { {{{lc}}} ? `Edit {{{ucf}}} ${ {{{~lc}}}['@id']}` : `Create {{{ucf}}}` } +
- { {{{lc}}} ?

Edit {{{ucf}}} { {{{lc}}}['@id'] }

:

Create {{{ucf}}}

} +

{{{lc}}} ? `Edit {{{ucf}}} ${ {{{~lc}}}['@id']}` : `Create {{{ucf}}}`

{ diff --git a/templates/next/components/foo/List.tsx b/templates/next/components/foo/List.tsx index c0d7fa01..ee5fd302 100644 --- a/templates/next/components/foo/List.tsx +++ b/templates/next/components/foo/List.tsx @@ -13,7 +13,7 @@ export const List: FunctionComponent = ({ {{{name}}} }) => (
{{{ucf}}} List - +

{{{ucf}}} List

diff --git a/templates/next/components/foo/Show.tsx b/templates/next/components/foo/Show.tsx index bdc42c32..73e3ac81 100644 --- a/templates/next/components/foo/Show.tsx +++ b/templates/next/components/foo/Show.tsx @@ -27,14 +27,14 @@ export const Show: FunctionComponent = ({ {{{lc}}} }) => { }; return ( -
+

- Show { {{{lc}}}['@id'] } - + {`Show {{{ucf}}} ${ {{{~lc}}}['@id']}`} +
-

Show { {{{lc}}}['@id'] }

+

{`Show {{{ucf}}} ${ {{{~lc}}}['@id']}`}

From 7296d25a496a6805f5431fe5cead4b44f6240912 Mon Sep 17 00:00:00 2001 From: Justine Date: Fri, 29 Jan 2021 09:59:09 +0100 Subject: [PATCH 4/5] review, removed quotes for content in meta tag --- templates/next/components/foo/Show.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/next/components/foo/Show.tsx b/templates/next/components/foo/Show.tsx index 73e3ac81..0c6d59d8 100644 --- a/templates/next/components/foo/Show.tsx +++ b/templates/next/components/foo/Show.tsx @@ -31,7 +31,7 @@ export const Show: FunctionComponent = ({ {{{lc}}} }) => {
{`Show {{{ucf}}} ${ {{{~lc}}}['@id']}`} - +

{`Show {{{ucf}}} ${ {{{~lc}}}['@id']}`}

From b4535f71a93f981c9cc26ba5cb777bae130313d9 Mon Sep 17 00:00:00 2001 From: Justine Date: Tue, 2 Feb 2021 09:31:39 +0100 Subject: [PATCH 5/5] added link to edit page in list --- templates/next/components/foo/List.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/next/components/foo/List.tsx b/templates/next/components/foo/List.tsx index ee5fd302..0826fa40 100644 --- a/templates/next/components/foo/List.tsx +++ b/templates/next/components/foo/List.tsx @@ -38,6 +38,8 @@ export const List: FunctionComponent = ({ {{{name}}} }) => (
{{/each}} +

+ Edit ))}
{{#if reference}}{{else}}{ {{{../lc}}}['{{{name}}}'] }{{/if}}