[ckan-dev] Proper way to create a link

Matthew Fullerton matt.fullerton at gmail.com
Sat Nov 12 11:22:07 UTC 2016


Hi Lucia,
I think something like this might be a minor improvement:

{% set url = h.url_for(controller='package', action='package_read') %}
<a href="{{url}}/export/datacite.xml" class="btn"><iclass="icon-file-text"
></i>{{ _('Get DataCite XML')}}</a>

Best,
Matt


On 11 November 2016 at 16:56, <lucia.espona at wsl.ch> wrote:

> Dear all,
>
> I am working on an extension that converts the CKAN metadata to a DataCite
> XML (https://github.com/espona/ckanext-package_converter).
>
> In this first version the XML can be retrieved in two ways:
> - Adding "/export/datacite.xml" to the package path, for example:
> http://www.envidat.ch/dataset/10-16904-2/*export/datacite.xml *
> - API call: http://www.envidat.ch/api/action/
> *package_export?id=10-16904-2&format=datacite*
>
> Now I want to put a button in the package read page that downloads the
> XML. I did a quick solution that works:
>
> <a href="*/dataset/{{c.pkg_dict.get('name')}}/export/datacite.xml*" class=
> "btn"><i class="icon-file-text"></i>{{ _('Get DataCite XML')}}</a>
>
>
> Is there a better/cleaner way to do this?
>
> Thanks,
> Lucia
>
>
> _________________________________________________________
> Dr. Lucia Espona Pernas
>
> Swiss Federal Institute for Forest, Snow and Landscape Research WSL
> Hauptgebäaude Labortrakt (HL C21)
> Zürcherstrasse 111
> 8903 Birmensdorf
> Switzerland
>
> +41 44 739 28 71 phone direct
> +41 44 739 21 11 reception
>
> www.wsl.ch
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20161112/e4aae8cb/attachment-0003.html>


More information about the ckan-dev mailing list