Collections Registry Search Widget V2

What is this widget?

The Registry Search Widget provides a quick and easy way of embedding a live Research Data Australia search or record display within your new or existing web pages.

The flexibility of the widget allows you to configure a predefined search, or provide your end users with a text field to specify their own search.

Some use cases for the Registry Object Search Widget include:

  • Showcase recent collections contributed to Research Data Australia by institution or researcher name
  • Implement a lookup function in data capture forms/processes to search for keys or global identifiers
  • Supplement your site’s search results with search results from Research Data Australia
  • Provide your users with a listing of data collections related to a specific subject

How to use this widget

Before you start! While optional, ANDS recommends that you register for a free API key to be used with this widget. Registering will allow us to keep you informed of changes and planned outages to our services, as well monitor the system for quality purposes.

Note that if you have previously registered for an API key you do not need to register again. Your ANDS API key is reusable with any of our widgets and services.

The widget requires jQuery; load this, and the plugin itself (and associated CSS styles) in your document’s <head></head> segment:

<script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js'></script>
<script type="text/javascript" src="//researchdata.ands.org.au/apps/assets/registry_widget/js/registry_widget_v2.js"></script>
<link rel="stylesheet" type="text/css" href="//researchdata.ands.org.au/apps/assets/registry_widget/css/registry_widget_v2.css" />

See Configuration section below for details on how to configure the widget on your web page.

Demo

Search Result Display Example

Embed the results of a simple search into your website, such as a panel on your institution’s own search page to supplement it with collections which are available in Research Data Australia.

  • In this example, the top 5 records matching the search term “fish” are listed:

Custom Search Result Display Example

Embed the results of a more complex search into your website, such as a panel on your institution’s profile pagewhich lists the Collections recently contributed to Research Data Australia.

  • This result example displays the 5 most recent collections contributed by Australian Ocean Data Network

Simple Search Example

Embed the ability to search for research data on your own web page in less than 5 lines of code!

  • This search example will search for records in Research Data Australia matching your search term.

Advanced Search Example

Embed the ability to search and display information about research data on your own web page with a customised display.

  • This search example will search for records and then display them according to a template (see the JS tab).

Configuration

The widget can be initialised by two methods:

  • Simple Mode: add the class="registry_widget" api_key="[[your_api_key]]" to a <div> or <input> element as illustrated in the examples above. You can also add a data-query and data-modeattribute to customise the behaviour in Simple Mode.
  • Custom Mode: initialise the registry_widget from javascript (jQuery) by calling $('#id_of_your_container_element').registry_widget();. You can pass any of the below properties to the registry_widget() function to customise its behaviour.
Property Description Default
proxy JSONP proxy for the Registry Widget which resolves search queries against the ANDS Collections Registry APIs http://researchdata.ands.org.au/api/v2.0/registry.jsonp/
api_key Your pre registered api key which will uniquely identify the widget user public
mode mode can be search,display_single, display_result search
search Enable Search Functionality true
auto_search Auto Search based on the target’s value false
search_btn_text Search text displays on the button Search
search_btn_class CSS Classes apply on the search button rowidget_search btn btn-small btn-default
search_callback Overwrite function for search result function(data, obj, settings) false
lookup Enable Resolve/Lookup functionality. This functionality enables the user to identify a registry object based on their id, key or slug true
auto_lookup Enable Auto lookup based on the target’s value false
lookup_btn_text Lookup text displays on the button Resolve
lookup_btn_class CSS Classes apply on the lookup button rowidget_lookup btn btn-small btn-default
lookup_callback Overwrite function for lookup result function(data, obj, settings) false
result_template Mustache/Handlebar-like template for the search result list <ul class="rowidget_results">{{#docs}}<li><a href="javascript:;" data-key="{{key}}" data-slug="{{slug}}" data-id="{{id}}">{{list_title}}</a></li>{{/docs}}</ul>
single_template Mustache/Handlebar-like template for the single display of a registry object <div class="rowidget_single"><h4><a href="{{rda_link}}" target="_blank">{{title}}</a></h4><span class="text-muted">{{group}}</span><div class="description">{{description}}</div></div>
return_type Return a key, slug, title or id to the target value key

Leave a Reply

Your email address will not be published. Required fields are marked *

14 + four =