Bug 850880 - Add "how to include groovy snippet into templates in EPP" to the developer guide.
Add "how to include groovy snippet into templates in EPP" to the developer gu...
Status: ON_QA
Product: JBoss Enterprise Portal Platform 5
Classification: JBoss
Component: Documentation (Show other bugs)
5.2.2.GA
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: mmurray
Tomas Kyjovsky
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-22 11:46 EDT by Gary Hu
Modified: 2015-08-09 21:27 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: A release note is required for this issue. Only relating to EPP 5.2 Consequence: Fix: Result:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Commits:
8963 by ppenicka at 2012-11-15 10:28:35 EST (show)
8963 by ppenicka at 2012-11-15 10:28:35 EST

Checked in to /mnt/n4aphx2-3.storage.phx2.redhat.com/svn/repos/gatein

BZ#850880 - added information about embedding of view and dialog templates in Site Publisher.

3 files changed:

  • epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/images/manage_templates_form.png (+0 / -0)
  • epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/modules/Advanced/Administration/Presentation.xml (+52 / -9)
  • epp/docs/branches/5.2/Site_Publisher/User_Guide/en-US/Revision_History.xml (+17 / -1)


Attachments (Terms of Use)

  None (edit)
Description Gary Hu 2012-08-22 11:46:13 EDT
One customer has raised such question "Currently all our dialog templates we have similar code repeated over and over. For example we have added a wysiwyg field in all our template for which we have written same groovy code in all our dialog templates. Is it possible to externalize the code in a separate groovy template and refer it in all the dialog templates so that we can centrally change our dialog templates if needed."


We've got the answer from eXo.

*********************************************************************************
To include groovy snippets in the dialog template you can use :
_ctx.include(TemplatePath);

To get the path of the templae :
import org.exoplatform.services.cms.templates.TemplateService;
  
  public String getTemplatePath(boolean isDialog, String nodeTypeName, String templateName) throws Exception {
   TemplateService tempService = uicomponent.getApplicationComponent(TemplateService.class);
   String path = tempService.getTemplatePath(isDialog, nodeTypeName, templateName) ;
    return path;
  }
For example

Example 1 : to embed the template of vote & comment for view template
<div><% _ctx.include(uicomponent.getViewTemplate("mix:votable", "view1")); %></div>
<div><% _ctx.include(uicomponent.getViewTemplate("exo:comments", "view1")); %></div>

Example 2 : to embed the dialog template of exo:podcast for an other dialog template
<% 
   import org.exoplatform.services.cms.templates.TemplateService;
   TemplateService tempService = uicomponent.getApplicationComponent(TemplateService.class);
   String path = tempService.getTemplatePath(true, "exo:podcast", "dialog1") ;

 %>
 
  <%
  _ctx.include(path);
  %>
*********************************************************************************

Can we add this info to the developer guide so that the other customers could benefit from it?
Comment 1 Jared MORGAN 2012-09-25 01:07:37 EDT
TRIAGE INFORMATION

Relevance: EPP 5.2 and EPP 6

Task:

Include the information provided by Gary in the Developer Guide for both versions.

Add as a new section to the Portal Development section, under the heading "Groovy"

http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.2/html-single/Developer_Guide/index.html#sid-8094155

Ensure you have access to:

http://svn.jboss.org/repos/gatein/epp/docs/branches/5.2 

and

http://svn.jboss.org/repos/gatein/epp/docs/branches/6.0/

to make changes to these guides.
Comment 2 Jared MORGAN 2012-09-25 01:09:17 EDT
Release Note required.
Comment 3 Petr Penicka 2012-11-15 10:52:25 EST
The final fix is a bit different than what was proposed.

The info has been added to the Site Publisher User Guide [1]. This is because the information is specific to Site Publisher.

The info has been put generally as embedding of templates within one another rather than just about embedding of Groovy snippers. This is because the Groovy embedding is just one particular use case and the embedding itself had not been described anywhere in the docs.

The info has been added only to EPP 5.2 docs. It was not included in JPP6 docs as JPP6 will not be shipped with the Site Publisher extension.

[1] http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.2/html/Site_Publisher_User_Guide/sect-User_Guide-Content_Presentation_Manager-Manage_a_Template-Embedding.html

Note You need to log in before you can comment on or make changes to this bug.