Commit 914c6777 authored by Kjetil Thuen's avatar Kjetil Thuen

Handle failed metadatalookups better

parent 65e509c1
...@@ -5,6 +5,7 @@ head.js("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js") ...@@ -5,6 +5,7 @@ head.js("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js")
.js("studymetadata_template.js") .js("studymetadata_template.js")
.js("studylist_template.js", function() { .js("studylist_template.js", function() {
var jsondata = {}; var jsondata = {};
var build_list = function() { var build_list = function() {
var template = Handlebars.templates.studylist; var template = Handlebars.templates.studylist;
var listhtml = template(jsondata); var listhtml = template(jsondata);
...@@ -34,7 +35,7 @@ head.js("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js") ...@@ -34,7 +35,7 @@ head.js("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js")
}); });
var studyMetadataTemplate = Handlebars.templates.studymetadata; var studyMetadataTemplate = Handlebars.templates.studymetadata;
var metadatahtml = studyMetadataTemplate(studyMetadata[0]); var metadatahtml = studyMetadataTemplate(studyMetadata.length > 0 ? studyMetadata[0] : {});
return metadatahtml; return metadatahtml;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment