webjiragoogle-closure-templatessoy-templates

Google Closure Templates variable variables


Situation:

context contains such fields as testExecutionKey1, testExecutionKey2 .. testExecutionKey10

I want to check them for null, but do it the nice way - in for loop

I need to access $context.testExecutionKey1..10 inside the loop, where number is $i

{for $i in range(1, 11)}
    {if {$context.testExecutionKey}{$i}}
        <div class="aui-message aui-message-info">
            <p>A Test instance execution is already linked to this issue: <a href="$baseURL/browse/$context.testExecutionKey${$i}" target="_blank">${context.testExecutionKey{$i}}</a>.</p>
        </div>
        <input type="hidden" name="skip-test-execution-${$i}" value="true">
    {/if}
{/for}

Problem:

PHP has got variable variables feature, but I could no similar find for closure templates in docs.


Solution

  • Reimplementing jira context the proper way is the way to go