[
https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bertrand Delacretaz updated SLING-114:
--------------------------------------
Attachment: SLING-114.patch
The attached patch implements a rough prototype of the client-side rendering.
If an *.ect script is found, microsling outputs an HTML page with:
-A "currentNode" javascript variable, initialized using our JSON renderer
-The javascript code, converted from the ECT template, that renders the content
-A simple HTML rendering, based on the DefaultHtmlRenderer class (which will
need to be improved)
That means that in one HTTP request, the client gets all it needs for dynamic
rendering (using the client's CPU), and a page that is indexable by search
engines.
To test this:
-Apply this patch (tested with revision 599839)
-Start microsling, go to http://localhost:8080/content-creation-forms.html and
create a node using the supplied form
-The created node should be displayed with the default rendering
-Mount the repository via WebDAV and add the template shown below as file
sling/scripts/microsling/example/html.ect
The ectOnLoad() stuff in the template needs to be better integrated.
Here's the template:
<p>
currentNode.title = <b> <%= currentNode.title %> </b>
</p>
<p>
currentNode.text = <em> <%= currentNode.text %> </em>
</p>
<%
function ectOnLoad() {
var defaultDisplay = document.getElementById("EctDefaultRendering");
if(defaultDisplay) {
defaultDisplay.setAttribute("style","display:none");
}
var title = document.getElementById("title");
if(title) {
title.innerHTML = currentNode.title;
}
}
%>
> ECT - Ecmascript Client Templates
> ---------------------------------
>
> Key: SLING-114
> URL: https://issues.apache.org/jira/browse/SLING-114
> Project: Sling
> Issue Type: Improvement
> Components: microsling
> Reporter: Bertrand Delacretaz
> Attachments: SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to
> implement a client-side version of the ESP templates.
> A template such as
> <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
> document.write("<p class=");
> document.write(item.color);
> document.write("\">");
> document.write(item.text);
> document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now,
> this creates interesting possibilities for ajaxish apps based on
> microsling/microjax (SLING-92).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.