diff --git a/gatsby-node.js b/gatsby-node.js index 0886a79..427167d 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -48,13 +48,21 @@ exports.createSchemaCustomization = ({ actions, schema }) => { """ type MaterialsAndMethods { dataset: MarkdownRemark @link(by: "frontmatter.name") - protocols: [ProtocolItem!]! + protocols: [Protocol!]! cellLines: [CellLineItem!]! software: [SoftwareTool!]! } - type ProtocolItem { - protocol: String! + """ + The front end and CMS assume that you enter EITHER a url OR a file which + this type doesn't strictly enforce. Directly entering data into markdown + with both fields populated may lead to unexpected behavior. + """ + type Protocol @dontInfer { + type: String! + name: String! + url: String + file: File @fileByRelativePath } type CellLineItem { diff --git a/src/components/MaterialsAndMethods.tsx b/src/components/MaterialsAndMethods.tsx index 8955e3e..0091bcc 100644 --- a/src/components/MaterialsAndMethods.tsx +++ b/src/components/MaterialsAndMethods.tsx @@ -20,7 +20,7 @@ export const MaterialsAndMethodsComponent: React.FC = ({ return cellLine.name; } return ( - + {cellLine.name} ); @@ -34,7 +34,7 @@ export const MaterialsAndMethodsComponent: React.FC = ({ const title = link ? (

{`Name: `} - + {name}

@@ -72,7 +72,7 @@ export const MaterialsAndMethodsComponent: React.FC = ({ {datasetFm.name} @@ -98,17 +98,23 @@ export const MaterialsAndMethodsComponent: React.FC = ({ label: "Protocols", children: ( ), }); diff --git a/src/pages/ideas/dev-example.md b/src/pages/ideas/dev-example.md index cfddcfd..f4bfbc9 100644 --- a/src/pages/ideas/dev-example.md +++ b/src/pages/ideas/dev-example.md @@ -27,8 +27,12 @@ preliminaryFindings: materialsAndMethods: dataset: Released EMT dataset protocols: - # - protocol: /protocols/emt_junction_segmentation.pdf - # - protocol: /protocols/emt_tracking_qc.pdf + - type: protocolLink + name: Culture And Freezing Methods + url: https://cell-catalog.allencell.org/pdf/AICS_WTC_cell_culture_protocol.pdf + - type: protocolFile + name: Cell culture protocol + file: /img/cell_culture_protocol.pdf cellLines: - name: AICS-42 link: https://allencell.org/cell-catalog diff --git a/src/templates/idea-post.tsx b/src/templates/idea-post.tsx index 52f4a25..236a518 100644 --- a/src/templates/idea-post.tsx +++ b/src/templates/idea-post.tsx @@ -144,7 +144,12 @@ export const pageQuery = graphql` } } protocols { - protocol + type + name + url + file { + publicURL + } } cellLines { name diff --git a/static/admin/config.yml b/static/admin/config.yml index ef13b89..6422879 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -127,12 +127,45 @@ collections: widget: "list", required: false, hint: "List any relevant protocols used in this analysis.", - field: - { - label: "Protocol", - name: "protocol", - widget: "file", - }, + types: + [ + { + label: "Protocol link", + name: "protocolLink", + widget: "object", + fields: + [ + { + label: "Name", + name: "name", + widget: "string", + }, + { + label: "URL", + name: "url", + widget: "string", + }, + ], + }, + { + label: "Protocol file", + name: "protocolFile", + widget: "object", + fields: + [ + { + label: "Name", + name: "name", + widget: "string", + }, + { + label: "File", + name: "file", + widget: "file", + }, + ], + }, + ], }, { label: "Cell lines used", @@ -173,7 +206,7 @@ collections: hint: "Optionally provide a custom or supplementary description for how this tool was used in this specific analysis. Leave blank to use the default description.", }, ], - } + }, ], } - { @@ -330,7 +363,12 @@ collections: options: ["Public", "In development", "Internal use only"], required: false, } - - { label: "Publish Date", name: "date", widget: "datetime", required: false } + - { + label: "Publish Date", + name: "date", + widget: "datetime", + required: false, + } - name: "pages" label: "Pages" diff --git a/static/img/cell_culture_protocol.pdf b/static/img/cell_culture_protocol.pdf new file mode 100644 index 0000000..cba3575 Binary files /dev/null and b/static/img/cell_culture_protocol.pdf differ