This CKAN Extension customises a CKAN instance for the hosting of data.gov.au. | This CKAN Extension customises a CKAN instance for the hosting of data.gov.au. |
It comprises: | It comprises: |
* A custom Package edit form that defaults to cc-by licence | * A custom Package edit form that defaults to cc-by licence |
* Replaces links with http/https protocol independent versions | * Replaces links with http/https protocol independent versions |
* Provides HTML to users to embed data previews on their own website | * Provides HTML to users to embed data previews on their own website |
* A cut down licenses.json file | * A cut down licenses.json file |
This extension is complimented by ckanext-agls for AGLS metadata and ckanext-googleanalytics for Google Analytics tracking of API usage | This extension is complemented by ckanext-agls for AGLS metadata, ckanext-googleanalytics for Google Analytics tracking of API usage and ckanext-dga-stats for the customised site statistics page. |
Installation | Installation |
============ | ============ |
To install this package, from your CKAN virtualenv, run the following from your CKAN base folder (e.g. ``pyenv/``):: | To install this package, from your CKAN virtualenv, run the following from your CKAN base folder (e.g. ``pyenv/``):: |
pip install -e git+https://github.com/okfn/ckanext-datagovau#egg=ckanext-datagovau | pip install -e git+https://github.com/okfn/ckanext-datagovau#egg=ckanext-datagovau |
Then activate it by setting ``ckan.plugins = datagovau`` in your main ``ini``-file. | Then activate it by setting ``ckan.plugins = datagovau`` in your main ``ini``-file. |
To add the cut down licenses.json set ``licenses_group_url = http://%(ckan.site_url)/licenses.json`` | To add the cut down licenses.json set ``licenses_group_url = http://%(ckan.site_url)/licenses.json`` |
or copy ``ckanext/datagovau/theme/public/licenses.json`` to the same folder as your CKAN config ini file | or copy ``ckanext/datagovau/theme/public/licenses.json`` to the same folder as your CKAN config ini file |
and set ``licenses_group_url = file://%(here)s/licenses.json`` | and set ``licenses_group_url = file://%(here)s/licenses.json`` |
{% ckan_extends %} | |
{% block header_site_navigation %} | |
<nav class="section navigation"> | |
<ul class="nav nav-pills"> | |
{% block header_site_navigation_tabs %} | |
{{ h.build_nav_main( | |
('search', _('Datasets')), | |
('organizations_index', _('Organizations')), | |
('about', _('About')) | |
) }} | |
<li><a href="//data.gov.au/stats">Site Statistics</a></li> | |
<li><a href="https://datagovau.ideascale.com/">Feedback/Request Data</a></li> | |
{% endblock %} | |
</ul> | |
</nav> | |
{% endblock %} | |
{% ckan_extends %} | |
{% block home_search %} | |
<div class="hero-secondary-inner"> | |
<script type="text/javascript" src="http://www.google.com/jsapi"> | |
</script> | |
<script type="text/javascript"> | |
google.load("feeds", "1") //Load Google Ajax Feed API (version 1) | |
</script> | |
<div id="feeddiv"> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
var feedcontainer=document.getElementById("feeddiv") | |
var feedurl="http://www.finance.gov.au/taxonomy/term/1274/feed" | |
var feedlimit=4 | |
var rssoutput="<div class='module module-shallow module-narrow module-dark info box' style='color:black'><h2>Latest data.gov.au News</h2><i class='ckan-icon ckan-icon-feed'></i><a href='http://www.finance.gov.au/taxonomy/term/1274/feed/'> Subscribe to the blog </a></div>" | |
function rssfeedsetup(){ | |
var feedpointer=new google.feeds.Feed(feedurl) //Google Feed API method | |
feedpointer.setNumEntries(feedlimit) //Google Feed API method | |
feedpointer.load(displayfeed) //Google Feed API method | |
} | |
function displayfeed(result){ | |
if (!result.error){ | |
var thefeeds=result.feed.entries | |
for (var i=0; i<thefeeds.length; i++) { | |
rssoutput+="<div class='module module-shallow module-narrow module-dark info box'><h3><a href='" + thefeeds[i].link + "'>" + thefeeds[i].title + "</a></h3>" | |
rssoutput+= " <font color='black'>Posted on " + new Date(thefeeds[i].publishedDate).toDateString() + "</font></div>" | |
} | |
rssoutput+="" | |
feedcontainer.innerHTML=rssoutput | |
} | |
else | |
alert("Error fetching feeds!") | |
} | |
window.onload=function(){ | |
rssfeedsetup() | |
} | |
</script> | |
<form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}"> | |
<h3 class="heading">{{ _("Search Your Data") }}</h3> | |
<div class="search-input control-group search-giant"> | |
<input type="text" class="search" name="q" value="{{ c.q }}" autocomplete="off" placeholder="{{ _('eg. Gold Prices') }}" /> | |
<button type="submit"> | |
<i class="icon-search"></i> | |
<span>{{ _('Search') }}</span> | |
</button> | |
</div> | |
</form> | |
{% endblock %} | |
<div class="hero-secondary-inner"> | |
<script type="text/javascript" src="http://www.google.com/jsapi"> | |
</script> | |
<script type="text/javascript"> | |
google.load("feeds", "1") //Load Google Ajax Feed API (version 1) | |
</script> | |
<div id="feeddiv"> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
var feedcontainer=document.getElementById("feeddiv") | |
var feedurl="http://www.finance.gov.au/taxonomy/term/1274/feed" | |
var feedlimit=4 | |
var rssoutput="<div class='module module-shallow module-narrow module-dark info box' style='color:black'><h2>Latest data.gov.au News</h2><i class='ckan-icon ckan-icon-feed'></i><a href='http://www.finance.gov.au/taxonomy/term/1274/feed/'> Subscribe to the blog </a></div>" | |
function rssfeedsetup(){ | |
var feedpointer=new google.feeds.Feed(feedurl) //Google Feed API method | |
feedpointer.setNumEntries(feedlimit) //Google Feed API method | |
feedpointer.load(displayfeed) //Google Feed API method | |
} | |
function displayfeed(result){ | |
if (!result.error){ | |
var thefeeds=result.feed.entries | |
for (var i=0; i<thefeeds.length; i++) { | |
rssoutput+="<div class='module module-shallow module-narrow module-dark info box'><h3><a href='" + thefeeds[i].link + "'>" + thefeeds[i].title + "</a></h3>" | |
rssoutput+= " <font color='black'>Posted on " + new Date(thefeeds[i].publishedDate).toDateString() + "</font></div>" | |
} | |
rssoutput+="" | |
feedcontainer.innerHTML=rssoutput | |
} | |
else | |
alert("Error fetching feeds!") | |
} | |
window.onload=function(){ | |
rssfeedsetup() | |
} | |
</script> | |
{% set tags = h.get_facet_items_dict('tags', limit=3) %} | |
{% set placeholder = _('eg. Gold Prices') %} | |
<div class="module module-search module-narrow module-shallow box"> | |
<form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}"> | |
<h3 class="heading">{{ _("Search Your Data") }}</h3> | |
<div class="search-input control-group search-giant"> | |
<input type="text" class="search" name="q" value="" autocomplete="off" placeholder="{{ placeholder }}" /> | |
<button type="submit"> | |
<i class="icon-search"></i> | |
<span>{{ _('Search') }}</span> | |
</button> | |
</div> | |
</form> | |
<div class="tags"> | |
<h3>{{ _('Popular Tags') }}</h3> | |
{% for tag in tags %} | |
<a class="tag" href="{% url_for controller='package', action='search', tags=tag.name %}">{{ h.truncate(tag.display_name, 22) }}</a> | |
{% endfor %} | |
</div> | |
</div> | |