Right now I have a base.leaf
file that imports the body from other files successfully.
/// base.leaf
<!DOCTYPE html>
<html>
<head>
</head>
<body>
.
.
.
<!-- Begin page content -->
<div class="body-content">
#import("content")
</div>
.
.
.
</body>
</html>
In my report.leaf
file I need to display different report templates at the bottom of this page based on the selected option. For example, if the Wire
is selected, I want to import that section of the code from the wire.leaf
file and so on. In GRAILS GROOVY, importing partial files are done by <g:render template="/shared/report/wire" />
. But I can't seem to figure out how to do so in vapor/leaf
.
/// report.leaf
#extend("base")
#export("content") {
<h2>Generate Report</h2>
<section>
<ul>
<li>
<label for="report">select report</label>
<select name="report">
<option value="-1">-- Select Report --</option>
<option value="1">Purchaser Confirm</option>
<option value="2">Wire</option>
<option value="3">Withdrawal Letter</option>
</select>
</li>
<li>
<input type="submit" value="run report" />
</li>
</ul>
</section>
/// Display different report templates based on the selected option
<!-- #export("report") { #embed("section") } -->
<!-- #import("wire") -->
<!-- #embed("section") -->
<!-- #import("report-content") -->
}
Here is my wire.leaf
file.
/// wire.leaf
<!--
/// Trying the: #export("report") { #embed("section") }
<section>
<h3>Wire info for Loan # 123456789</h3>
<div>
<ul>
<li>Name: Marlin Bank</li>
<li>CMG: 007</li>
<li>MtDt: 005689</li>
<li>CUSIP: BDTK001</li>
<li>GP: 5</li>
</ul>
</div>
<div>
<input type="submit" value="print" />
</div>
</section>
-->
/// Trying the: #import("report-content")
#export("report-content") {
<section>
<h3>Wire info for Loan # 123456789</h3>
<div>
<ul>
<li>Name: Marlin Bank</li>
<li>CMG: 007</li>
<li>MtDt: 005689</li>
<li>CUSIP: BDTK001</li>
<li>GP: 5</li>
</ul>
</div>
<div>
<input type="submit" value="print" />
</div>
</section>
}
I did read this documentation on #embed
but I'm still very confused. Any help will be highly appreciated!