Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested templates #112

Open
midi-foot-controller opened this issue Jun 15, 2019 · 2 comments
Open

nested templates #112

midi-foot-controller opened this issue Jun 15, 2019 · 2 comments

Comments

@midi-foot-controller
Copy link

I try to call a optional nested templates like

@with (templateName = model.getNestedTemplateName("SAMPLE") {
   @if (null != templateName) {
      @Rocker.template(templateName, model)
   }
}

My model contains a method

public String getNestedTemplateName(final String componentName)
{
  if ("SAMPLE".equals(componentName)) {
     return (SampleTemplate.getTemplatePackageName().replace(".", "/") + "/" + SampleTemplate.getTemplateName());
  }
   return null;
}

this is quite lengthy.. Is it possible to add a method "getFullTemplateName" which returns the complete name to the generated templates?

Thanks Jens

@bendem
Copy link
Contributor

bendem commented Jul 24, 2019

What prevents you from calling the template directly?

@import package.SampleTemplate
@args(...)

@SampleTemplate.template(model)

@bendem
Copy link
Contributor

bendem commented Jul 24, 2019

I'm curious, what's your use case for having templates that could not exist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants