Skip to content

Commit f557950

Browse files
authored
Pass variable to macro (#136)
1 parent f46df85 commit f557950

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Resources/views/WebUI/show.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@
5959

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

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

@@ -73,7 +73,7 @@
7373
</script>
7474
{% endblock %}
7575

76-
{% macro printMessage(idx, message, allow_delete) %}
76+
{% macro printMessage(idx, message, allow_delete, base_path) %}
7777
<div class="message row" id="{{ message.key }}">
7878
<div class="col-md-6 col-xs-12">
7979
{% if message.new %}
@@ -107,7 +107,7 @@
107107
{% if message.sourceLocations|length > 0 %}
108108
<ul class="location-list">
109109
{% for location in message.sourceLocations %}
110-
<li><a href="{{ (file_base_path ~ location['path'])|file_link(location['line']) }}">{{ location['path'] }} at line {{ location['line'] }} </a></li>
110+
<li><a href="{{ (base_path ~ location['path'])|file_link(location['line']) }}">{{ location['path'] }} at line {{ location['line'] }} </a></li>
111111
{% endfor %}
112112
</ul>
113113
{% endif %}

Tests/Functional/app/Resources/translations/messages.en.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
</segment>
1414
</unit>
1515
<unit id="LCa0a2b">
16+
<notes>
17+
<note category="file-source" priority="1">Resources/views/translated.html.twig:11</note>
18+
<note>file-source</note>
19+
<note>status:new</note>
20+
</notes>
1621
<segment>
1722
<source>key1</source>
1823
<target>trans1</target>

0 commit comments

Comments
 (0)