Skip to content

Commit

Permalink
Merge pull request quarkusio#21705 from mkouba/qute-fix-devui-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi authored Nov 25, 2021
2 parents 06c56fe + 017a5ab commit 70f2f79
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ TemplateVariantsBuildItem collectTemplateVariants(List<TemplatePathBuildItem> te
// ItemResource/item -> -> [ItemResource/item.html, ItemResource/item.xml]
Map<String, List<String>> baseToVariants = new HashMap<>();
for (String path : allPaths) {
int idx = path.lastIndexOf('.');
int idx = path.indexOf('.');
if (idx != -1) {
String base = path.substring(0, idx);
List<String> variants = baseToVariants.get(base);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
<label for="template-select">Template</label>
<select class="form-control" name="template-select" id="template-select">
{#for template in info:devQuteInfos.templates}
{#let optionIndex=index}
{#each template.variants}
<option value="{it.key}"{#if optionIndex is 0 and index is 0} selected="true"{/if}>{it.key}</option>
<option value="{it.key}"{#if template_index is 0 and it_index is 0} selected="true"{/if}>{it.key}</option>
{/each}
{/let}
{/for}
</select>
</div>
Expand Down Expand Up @@ -56,26 +54,24 @@

{! Init the template path -> initial data map !}
{#for template in info:devQuteInfos.templates}
{#let dataCount=count}
var testData{dataCount};
var testData{template_count};
{#if template.parameters}
testData{dataCount} = '{';
testData{template_count} = '{';
{#each template.parameters}
testData{dataCount} += '\n // Template parameter {template_count}: {it.value.raw}\n';
testData{dataCount} += ' "{it.key}" : null';
{#if hasNext}
testData{dataCount} += ',';
testData{template_count} += '\n // Template parameter {it_count}: {it.value.raw}\n';
testData{template_count} += ' "{it.key}" : null';
{#if it_hasNext}
testData{template_count} += ',';
{/if}
{/each}
testData{dataCount} += '\n}';
testData{template_count} += '\n}';
{#else}
testData{dataCount} = '{}';
testData{template_count} = '{}';
{/if}
{#each template.variants}
templateDataMap['{it.key}'] = testData{dataCount};
templateDataMap['{it.key}'] = testData{template_count};
templateSourceMap['{it.key}'] = '{it.value}';
{/each}
{/let}
{/for}

const editor = CodeMirror.fromTextArea(document.querySelector('#template-data'), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public void testTemplates() {
RestAssured.get("q/dev/io.quarkus.quarkus-qute/templates")
.then()
.statusCode(200).body(Matchers.containsString("hello.txt"));
RestAssured.get("q/dev/io.quarkus.quarkus-qute/preview")
.then()
.statusCode(200).body(Matchers.containsString("Test JSON data"));
}

}

0 comments on commit 70f2f79

Please sign in to comment.