Scripts for Customized Home Page

30 views
Skip to first unread message

Sherry Lake

unread,
Dec 7, 2017, 11:26:09 AM12/7/17
to Dataverse Users Community
Still working on our Customized home page and was hoping for some help getting a couple of our buttons "actionable".

Here's a screen shot (since our test server is behind firewall):



I want the search button to act like the "Search this dataverse" from the top level DV.

The "Next" Button under "Add your dataset to LibraData", is a little more complicated. Based on the dataverse chosen in Step 2, we want to "Add a dataset" to the Dataverse selected.


Be glad to poke around the code for javascript if someone could point me in the right direction.

Thanks
Sherry

Durand, Gustavo

unread,
Dec 7, 2017, 12:04:00 PM12/7/17
to dataverse...@googlegroups.com
Short Answer:

1. For the search, you need to go to (using demo dataverse examples):

https://demo.dataverse.org/dataverse/harvard?q=XX , using javascript to replace the XX with the value from the text

2. For the add, you need to go to this link:

https://demo.dataverse.org/dataset.xhtml?ownerId=XX, using javascript to replace the XX with the value from the selection


Longer Answer / comments:

1. For examples of the javascript to use you can look at the search widget (or even actually imbed the widget itself):

Widget code example:


and adds this to the button:
<input id="btnDataverseSearch" value="Find" type="button" onclick="window.open('https://demo.dataverse.org/dataverse.xhtml?alias=harvard&amp;q=' + this.previousSibling.previousSibling.value + '', '_blank');" style="-moz-border-bottom-colors:none; -moz-border-left-colors:none; -moz-border-right-colors:none; -moz-border-top-colors:none; background-color:#f5f5f5; background-image:-moz-linear-gradient(center top , #ffffff, #e6e6e6); background-repeat:repeat-x; border:1px solid #ccc; border-color:#e6e6e6 #e6e6e6 #b3b3b3; border-image:none; border-radius:4px; box-shadow:0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05); color:#333; cursor:pointer; text-shadow:0 1px 1px rgba(255, 255, 255, 0.75); padding:0.3em 1em; line-height:1.4;">

2. For the add, do you already have the select box of the dataverses working and it's just the button you need? If so see, above. If it's the dropdown, then that's (obviously) more complex. You would need to use an API to get the list of dataverses, in Json form, then translate the Json html select markup. I don't have any specific example on how to do that, but can try to help (or maybe someone else has already done it?)


Hope that helps!

Gustavo

--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-community+unsub...@googlegroups.com.
To post to this group, send email to dataverse-community@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/009cf4cb-d701-4113-895b-2cd8c7cf8cba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages