diff options
-rw-r--r-- | bh20simplewebuploader/main.py | 9 | ||||
-rw-r--r-- | bh20simplewebuploader/static/main.js | 2 | ||||
-rw-r--r-- | doc/blog/using-covid-19-pubseq-part5.org | 14 |
3 files changed, 19 insertions, 6 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 77e345b..8b5781a 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -227,8 +227,13 @@ def generate_form(schema, options): # At startup, we need to load the metadata schema from the uploader module, so we can make a form for it -METADATA_SCHEMA = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-schema.yml")) -METADATA_OPTION_DEFINITIONS = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-options.yml")) +if os.path.isfile("bh20sequploader/bh20seq-schema.yml"): + METADATA_SCHEMA = yaml.safe_load(open("bh20sequploader/bh20seq-schema.yml","r").read()) + METADATA_OPTION_DEFINITIONS = yaml.safe_load(open("bh20sequploader/bh20seq-options.yml","r").read()) +else: + METADATA_SCHEMA = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-schema.yml")) + METADATA_OPTION_DEFINITIONS = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-options.yml")) +print(METADATA_SCHEMA,file=sys.stderr) FORM_ITEMS = generate_form(METADATA_SCHEMA, METADATA_OPTION_DEFINITIONS) @app.route('/') diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js index 751e478..4703047 100644 --- a/bh20simplewebuploader/static/main.js +++ b/bh20simplewebuploader/static/main.js @@ -195,7 +195,7 @@ function addField(e) { // Increment the number and use the keypath and number to set IDs and cross // references. // TODO: Heavily dependent on the form field HTML. Maybe we want custom - // elements for the labeled controlsd that know how to be list items? + // elements for the labeled controls that know how to be list items? fieldNumber++ newField.dataset.number = fieldNumber let newID = keypath + '[' + fieldNumber + ']' diff --git a/doc/blog/using-covid-19-pubseq-part5.org b/doc/blog/using-covid-19-pubseq-part5.org index 4b0ea64..aa06d5e 100644 --- a/doc/blog/using-covid-19-pubseq-part5.org +++ b/doc/blog/using-covid-19-pubseq-part5.org @@ -13,6 +13,7 @@ - [[#what-is-the-schema][What is the schema?]] - [[#how-is-the-website-generated][How is the website generated?]] - [[#modifying-the-schema][Modifying the schema]] + - [[#adding-fields-to-the-form][Adding fields to the form]] * Modify Metadata @@ -113,8 +114,15 @@ So, we'll add it simply as a title field. Now the draft schema is _id: https://creativecommons.org/ns#Work #+END_SRC -Now, we are no ontology experts, right? So, next we submit a patch to our source tree and -ask for feedback before wiring it up in the data entry form. The pull request was -submitted here FIXME. +Now, we are no ontology experts, right? So, next we submit a patch to +our source tree and ask for feedback before wiring it up in the data +entry form. The pull request was submitted [[https://github.com/arvados/bh20-seq-resource/pull/97][here]] and reviewed on the +gitter channel and I merged it. + +* Adding fields to the form + +To add the new fields to the form we have to modify it a little. If we +go to the upload form we need to add the license box. The schema is +loaded in [[https://github.com/arvados/bh20-seq-resource/blob/a0c8ebd57b875f265e8b0efec4abfaf892eb6c45/bh20simplewebuploader/main.py#L229][main.py]] in the 'generate_form' function. /Note: work in progress/ |