Skip to content

Commit

Permalink
Pass variable to macro (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm authored Aug 20, 2017
1 parent f46df85 commit f557950
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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

0 comments on commit f557950

Please sign in to comment.