Ticket #2502 (closed enhancement: fixed)

Opened 23 months ago

Last modified 23 months ago

Create Jinja block for common helpers

Reported by: aron.carroll Owned by: toby
Priority: minor Milestone: ckan-sprint-2012-06-25
Component: ckan Keywords: demo-theme
Cc: Repository: ckan
Theme: none

Description

Most important is {% snippet %} but {% url_for %} would be great too.

Change History

comment:1 Changed 23 months ago by toby

  • Owner changed from toby to aron.carroll
  • Status changed from new to assigned

{% snippet 'template_name', var=value, var2=value ... %}

{% url_for(controller='foo', action='bar', ...) %}

let me know if you want these changed eg remove need for () in url_for

merged into demo branch they are just available in jinja templates no need to do anything special

Let me know any problems or if you need some others added

comment:2 Changed 23 months ago by aron.carroll

  • Owner changed from aron.carroll to toby

Works beautifully. Be great if we could remove the parens around url_for and add an extra one for h.nav_link but I think call it link_for instead.

{% url_for controller='foo', action='bar', ... %}
{% link_for controller='foo', action='bar', class='btn', icon='plus'... %}

comment:3 Changed 23 months ago by toby

  • Status changed from assigned to closed
  • Resolution set to fixed

url_for no longer needs () link_for added but not tested - pretty certain it will just work

Note: See TracTickets for help on using tickets.