Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authors and affiliation lookup examples added #9

Merged
merged 8 commits into from
May 18, 2022
Merged

Conversation

Kris-LIBIS
Copy link
Collaborator

As requested I have added files to illustrate how we implemented the authors lookup at KU Leuven. Currently a config file and JavaScript file are added along with some documentation in the examples directory.

@pdurbin
Copy link
Member

pdurbin commented Feb 9, 2022

@Kris-LIBIS thanks! I haven't had a chance to dig into this but on a related note, do you think it's possible to search ROR to populate author affiliations? This was asked about here: https://groups.google.com/g/dataverse-community/c/498ElEzOBcg/m/Mn9-JC29DgAJ

@Kris-LIBIS
Copy link
Collaborator Author

@pdurbin It sure would. Put a search button after the affiliation input instead of the name field. Perform a query on ror.org instead of the 'covoc' server/solr index. Then some changes (mostly simplifications) to the copy-and-paste function is all that is needed. It could be another and probably simpler example of this feature.

@Kris-LIBIS
Copy link
Collaborator Author

@pdurbin I added the affiliation example to this PR as well. Should be pretty straightforward to implement and try out.

@Kris-LIBIS Kris-LIBIS changed the title authors lookup example added authors and affiliation lookup example added Feb 10, 2022
@Kris-LIBIS Kris-LIBIS changed the title authors and affiliation lookup example added authors and affiliation lookup examples added Feb 10, 2022
@pdurbin
Copy link
Member

pdurbin commented Feb 10, 2022

@Kris-LIBIS thanks! I'm hosting the .js file locally with Python's built in web server so I changed the following line...

"js-url": "http://localhost:8000/scripts/affiliation.js",

... before loading it into :CVocConf. However, Author Affiliation (citation block) hasn't turned into a field I can search. If it matters, I'm running Dataverse on port 8080 (in dev).

Maybe we can talk in https://chat.dataverse.org sometime to figure this out. Thanks for the example!

@Kris-LIBIS
Copy link
Collaborator Author

@pdurbin It worked for me, but there may be something I missed in the configuration. If you do not see the search icon next to the affiliation input field, you may want to check out your browser developer mode (F12) and see which error messages are printed on the console when you reload the page and enter the metadata editor.

@pdurbin
Copy link
Member

pdurbin commented Feb 10, 2022

@Kris-LIBIS thanks for all the help today! The version as of 376651d doesn't work for me but if I put the document.ready back in like before it seems to work. Please see affiliation.js.txt or the diff below:

$ git diff scripts/affiliation.js
diff --git a/scripts/affiliation.js b/scripts/affiliation.js
index dc438ac..4d1e394 100644
--- a/scripts/affiliation.js
+++ b/scripts/affiliation.js
@@ -26,13 +26,14 @@ var elementIdAttribute = 'data-affiliation-element-id';
  * added or removed. This code is reposible for creating the HTML for the dialog box, adding a search button to 
  * the affiliation name fields and creating the triggers for initializing the dialog box and the search action itself.
  */
-(function() {
+$(document).ready(function() {
+
   // Create Dialog box, if necessary
   createAffiliationModal();
 
   // Put a search button after each affiliation name field
   putAffiliationSearchIcon();
-})();
+});
 
 function createAffiliationModal() {
   let affiliationModal = document.getElementById(affiliationModalId);

@Kris-LIBIS
Copy link
Collaborator Author

I have undone that change. It did not help me with the CORS errors anyway. I realize now that jquery is not my issue.

@Kris-LIBIS
Copy link
Collaborator Author

Note: if you want to apply the affiliation lookup also to the Contacts affiliation, in the javascript file just change the definition of authorSelector into:
var authorSelector = "#metadata_author ~ .dataset-field-values .edit-compound-field, #metadata_datasetContact ~ .dataset-field-values .edit-compound-field"; (single line of code)

@Kris-LIBIS
Copy link
Collaborator Author

Recent changes fixes a problem I noticed in our own installation. The JavaScript code would prevent the Dataset Template drop-down not to open. This is fixed in the patch.

@qqmyers
Copy link
Member

qqmyers commented May 18, 2022

Discussion in IQSS/dataverse#6640 (comment) - merged now since all of these are examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants