From: Alex Sadleir Date: Tue, 13 May 2014 05:21:31 +0000 Subject: add Government Data Use Cases section X-Git-Url: http://maxious.lambdacomplex.org/git/?p=ckanext-datagovau.git&a=commitdiff&h=5e863778ef30995de93926085306bb55a48df539 --- add Government Data Use Cases section --- --- a/ckanext/datagovau/plugin.py +++ b/ckanext/datagovau/plugin.py @@ -22,6 +22,10 @@ filtered_dict[dataset['id']] = dataset return filtered_dict.values() +def get_related_dataset(related_id): + result = model.Session.execute("select dataset_id from related_dataset where related_id =\'"+related_id+"\' limit 1;").first()[0] + return lib.helpers.get_action('package_show',{'id':result}) + def related_create(context, data_dict=None): return {'success': False, 'msg': 'No one is allowed to create related items'} @@ -37,7 +41,7 @@ plugins.implements(plugins.IAuthFunctions) def get_auth_functions(self): - return {'rekated_create': related_create} + return {'related_create': related_create} def update_config(self, config): # Add this plugin's templates dir to CKAN's extra_template_paths, so @@ -51,6 +55,6 @@ # config['licenses_group_url'] = 'http://%(ckan.site_url)/licenses.json' def get_helpers(self): - return {'get_user_datasets': get_user_datasets} + return {'get_user_datasets': get_user_datasets, 'get_related_dataset': get_related_dataset} --- a/ckanext/datagovau/templates/header.html +++ b/ckanext/datagovau/templates/header.html @@ -7,10 +7,11 @@ {{ h.build_nav_main( ('search', _('Datasets')), ('organizations_index', _('Organizations')), - ('about', _('About')) + ('about', _('About')), + ('stats', _('Site Statistics')) ) }} -
  • Site Statistics
  • -
  • Feedback/Request Data
  • +
  • Use Cases
  • +
  • Feedback/Request Data
  • {% endblock %} --- /dev/null +++ b/ckanext/datagovau/templates/package/read_base.html @@ -1,1 +1,10 @@ +{% ckan_extends %} +{% block content_primary_nav %} + {{ h.build_nav_icon('dataset_read', _('Dataset'), id=pkg.name) }} + {{ h.build_nav_icon('dataset_groups', _('Groups'), id=pkg.name) }} + {{ h.build_nav_icon('dataset_activity', _('Activity Stream'), id=pkg.name) }} + {{ h.build_nav_icon('related_list', _('Use Cases'), id=pkg.name) }} +{% endblock %} + + --- /dev/null +++ b/ckanext/datagovau/templates/related/dashboard.html @@ -1,1 +1,100 @@ +{% extends "page.html" %} +{% set page = c.page %} +{% set item_count = c.page.item_count %} + +{% block subtitle %}{{ _('Government Data Use Cases') }}{% endblock %} + +{% block breadcrumb_content %} +
  • {{ _('Government Data Use Cases') }}
  • +{% endblock %} + +{% block primary_content %} +
    +
    +

    + {% block page_heading %}{{ _('Government Data Use Cases') }}{% endblock %} +

    + + {% block related_items %} + {% if item_count %} + {% trans first=page.first_item, last=page.last_item, item_count=item_count %} +

    Showing items {{ first }} - {{ last }} of {{ item_count }} use cases found

    + {% endtrans %} + {% elif c.filters.type %} + {% trans item_count=item_count %} +

    {{ item_count }} use cases found

    + {% endtrans %} + {% else %} +

    {{ _('There have been no use cases submitted yet.') }} + {% endif %} + {% endblock %} + + {% block related_list %} + {% if page.items %} + {% snippet "related/snippets/related_list.html", related_items=page.items %} + {% endif %} + {% endblock %} +

    + + {% block page_pagination %} + {{ page.pager() }} + {% endblock %} +
    +{% endblock %} + +{% block secondary_content %} +
    +

    {{ _('What are use cases?') }}

    +
    + {% trans %} +

    Use Cases are any apps, articles, visualisations or ideas using datasets.

    + +

    For example, it could be a custom visualisation, pictograph + or bar chart, an app using all or part of the data or even a news story + that references datasets from this site.

    + +

    Send your ideas to data.gov@finance.gov.au with Title; Description; URL; Image URL; and Type: [API|Applications|Idea|News Article|Paper|Post|Visualisation]

    + {% endtrans %} +
    +
    + +
    +

    {{ _('Filter Results') }}

    +
    + + +
    + + +
    + +
    + + +
    + +
    + +
    + +
    + +
    +
    +
    +{% endblock %} + --- /dev/null +++ b/ckanext/datagovau/templates/related/snippets/related_item.html @@ -1,1 +1,48 @@ +{# +Displays a single related item. +related - The related item dict. +pkg_id - The id of the owner package. If present the edit button will be + displayed. + +Example: + + + +#} +{% set placeholder_map = { +'application': h.url_for_static('/base/images/placeholder-application.png') +} %} +{% set tooltip = _('Go to {related_item_type}').format(related_item_type=related.type|replace('_', ' ')|title) %} + +{% if position is divisibleby 3 %} +
  • +{% endif %} +