Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elements macro namespace #396

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apps/companies/views/investments.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="split-header">
<h2 class="heading-medium">{{ projects.count }} investment {{ 'project' | pluralise(projects.count) }}</h2>
<a class="button button-secondary" href="/investment-projects/create/1?client-company={{ company.id }}">Add investment project</a>
<a class="button button-secondary" href="/investment-projects/create/{{ company.id }}">Add investment project</a>
</div>

{% if projects.results %}
Expand Down
1 change: 1 addition & 0 deletions src/templates/_layouts/datahub-base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{% from "_macros/common.njk" import LocalHeader with context %}
{% from "_macros/common.njk" import Pagination, LocalNav %}
{% from "_macros/address.njk" import addressFormatter %}
{% from "_macros/elements.njk" import Link %}

{% if IS_XHR %}
{% extends "./xhr.njk" %}
Expand Down
11 changes: 11 additions & 0 deletions src/templates/_macros/elements.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{##
# Render anchor markup
# @param {string} props.href - Anchor href
# @param {string} props.text - Anchor text
# @param {string} [props.target=_self] - Anchor target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the target be left empty by default and not add the attribute if not present?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro is going to be dropped after discussion with @tyom - closing PR

#}
{% macro Link(props) %}
{% set target = props.target or '_self' %}

<a href="{{ props.href }}" target="{{ target }}">{{ props.text }}</a>
{% endmacro %}