From e6ec3294cd9f795623885fba41b76e0bc02dcd3b Mon Sep 17 00:00:00 2001 From: Tim Hostetler Date: Mon, 12 Mar 2018 14:39:26 -0400 Subject: [PATCH 1/3] Catch Bad Work Response (non-error) --- src/js/modules/orcid/orcid_api.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/modules/orcid/orcid_api.js b/src/js/modules/orcid/orcid_api.js index 6c69d430c..cd12ec9b4 100644 --- a/src/js/modules/orcid/orcid_api.js +++ b/src/js/modules/orcid/orcid_api.js @@ -543,7 +543,11 @@ define([ var oldWork = cacheEntry.work; // check to see if the work is an error message, { error: {...} } - if (work.error) { + if (!work) { + + // something weird going on with work, just reject + promise.reject(); + } else if (work.error) { // check to see if it's just a conflict if (work.error['response-code'] === 409) { From 6014d88efcc18e713273c54d247b00501806ecc0 Mon Sep 17 00:00:00 2001 From: Tim Hostetler Date: Mon, 12 Mar 2018 14:51:10 -0400 Subject: [PATCH 2/3] Remove Authors From Orcid Profile Page --- src/js/modules/orcid/widget/widget.js | 3 + .../templates/item-template.html | 57 ++++++++++--------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/js/modules/orcid/widget/widget.js b/src/js/modules/orcid/widget/widget.js index 9e9b655cd..b82e07076 100644 --- a/src/js/modules/orcid/widget/widget.js +++ b/src/js/modules/orcid/widget/widget.js @@ -207,6 +207,9 @@ define([ var start = 0; var docs = PaginationMixin.addPaginationToDocs(docs, start); _.each(docs, function (d,i) { + + // let each doc know if it's on the orcid widget page + d.isOrcidWidget = true; docs[i] = PapersUtilsMixin.prepareDocForViewing(d); }); return docs; diff --git a/src/js/widgets/list_of_things/templates/item-template.html b/src/js/widgets/list_of_things/templates/item-template.html index 9cc3b48ca..e616ab9e9 100644 --- a/src/js/widgets/list_of_things/templates/item-template.html +++ b/src/js/widgets/list_of_things/templates/item-template.html @@ -121,34 +121,37 @@

{{{title}}}

- {{#if authorFormatted}} -
    - {{#each authorFormatted}} - - {{/each}} - - {{#if extraAuthors}} -
  • - - and {{extraAuthors}} more - -
  • + {{#unless isOrcidWidget}} + {{#if authorFormatted}} + + + + {{else}} + no author information available {{/if}} -
- - - {{else}} - no author information available - {{/if}} + {{/unless}} +
From edec5e447c4d8434efcac77eeed28f8280fa827f Mon Sep 17 00:00:00 2001 From: Tim Hostetler Date: Tue, 13 Mar 2018 14:48:18 -0400 Subject: [PATCH 3/3] Make Sure Non-ADS Records Show Properly --- src/js/modules/orcid/orcid_api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/modules/orcid/orcid_api.js b/src/js/modules/orcid/orcid_api.js index cd12ec9b4..9d4c9be67 100644 --- a/src/js/modules/orcid/orcid_api.js +++ b/src/js/modules/orcid/orcid_api.js @@ -1011,7 +1011,7 @@ define([ Then we can add some metadata like whether it was an ADS sourced record or not */ - var updateRecord = function (k, v, out) { + var updateRecord = function (v, k, out) { // db is always 'identifier:xxx' var key = ('identifier:' + v).toLowerCase(); @@ -1038,7 +1038,7 @@ define([ if (_.isArray(value)) { _.each(value, updateRecord); } else { - updateRecord(key, value, out); + updateRecord(value, key, out); } });