Skip to content

Pass variable to macro #136

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

Merged
merged 1 commit into from
Aug 20, 2017
Merged
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
8 changes: 4 additions & 4 deletions Resources/views/WebUI/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@

<div id="new-translations"></div>
{% for idx, message in messages if message.new %}
{{ macro.printMessage(idx + 1, message, allow_delete) }}
{{ macro.printMessage(idx + 1, message, allow_delete, file_base_path) }}
{% endfor %}

{% set idxStart = messages|length %}
{% for idx, message in messages if not message.new %}
{{ macro.printMessage(idx + idxStart, message, allow_delete) }}
{{ macro.printMessage(idx + idxStart, message, allow_delete, file_base_path) }}
{% endfor %}
</div>

Expand All @@ -73,7 +73,7 @@
</script>
{% endblock %}

{% macro printMessage(idx, message, allow_delete) %}
{% macro printMessage(idx, message, allow_delete, base_path) %}
<div class="message row" id="{{ message.key }}">
<div class="col-md-6 col-xs-12">
{% if message.new %}
Expand Down Expand Up @@ -107,7 +107,7 @@
{% if message.sourceLocations|length > 0 %}
<ul class="location-list">
{% for location in message.sourceLocations %}
<li><a href="{{ (file_base_path ~ location['path'])|file_link(location['line']) }}">{{ location['path'] }} at line {{ location['line'] }} </a></li>
<li><a href="{{ (base_path ~ location['path'])|file_link(location['line']) }}">{{ location['path'] }} at line {{ location['line'] }} </a></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions Tests/Functional/app/Resources/translations/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
</segment>
</unit>
<unit id="LCa0a2b">
<notes>
<note category="file-source" priority="1">Resources/views/translated.html.twig:11</note>
<note>file-source</note>
<note>status:new</note>
</notes>
<segment>
<source>key1</source>
<target>trans1</target>
Expand Down