Hi, Can't we use standard JS libraries approach for this one? Here we have used zone names. eg : UUF.renderFragment(fragmentFullyQualifedName, templateFillingObject, *zoneName*, mode)
But AFAIK in standard JS this is done using Classes or IDs of elements. For an example can't we have something similar to *var zone = document.getElementById(zoneName);* *UFF.renderFragment(par1, par2, par3, zone);* IMHO I think that it would be better if we can find an approach which JS developers are more often familiar with. Also, IMHO I think we can use something similar to Jinja2 [1] kind of approach from Python Flask for server-side template rendering. [1] http://jinja.pocoo.org/docs/dev/ Thanks and Best Regards, Irunika *Irunika Weeraratne* *Software Engineer | WSO2, Inc. <http://wso2.com/>* *Email : [email protected] <[email protected]>* *LinkedIn : https://lk.linkedin.com/in/irunika <https://lk.linkedin.com/in/irunika>* *Mobile : +94712403314* *Lean . Enterprise . Middleware* On Wed, Dec 14, 2016 at 8:05 AM, Joseph Fonseka <[email protected]> wrote: > Hi > > +1, few clarifications bellow. > > 1. I guess the default mode will be OVERWRITE. > 2. Why did we use comments to propagate Zones to the client side instead > of Divs. > > Thanks > Jo > > > > On Tue, Dec 13, 2016 at 10:37 PM, SajithAR Ariyarathna <[email protected]> > wrote: > >> Hi All, >> >> To do $subject, we are hoping to give a UUF client JS library. With the >> client-side library, webapp developers will be able to render fragments and >> push to zones similar to the server-side. >> >> Functions in the library: >> >> UUF.renderFragment(fragmentFullyQualifedName, templateFillingObject, >> zoneName, mode) >> >> Using this function webapp developers can render a fragment in the >> client-side and push the content to a given zone. >> >> Here, >> >> *fragmentFullyQualifedName* - Fully qualified name >> (<component-name>.<fragment-name>) of the fragment that you want to >> render. e.g. "org.wso2.carbon.apimgt.store.api-grid" >> *templateFillingObject* - JSON object which will be used to fill the >> fragment's template. e.g. {name: "My API", version: "1.0.0"} >> >> *zoneName* - Name of the zone that you want to push the rendered HTML. >> e.g. "grid" >> >> *mode* - Dictates how the pushing content orders with the existing >> content in the zone. Mode can be "PREPEND" (put the pushing content before >> the existing content), "APPEND" (put the pushing content after the existing >> content) or "OVERWRITE" (replace the existing content with the pushing >> content) >> >> >> UUF.renderTemplate(hbsTemplate, templateFillingObject, zoneName, mode) >> >> Using this function webapp devs can render a given Handlebars template >> and push it to a desired zone. >> >> Here, >> >> *hbsTemplate* - Handlebars template string >> >> >> Bringing zones to the client-side. >> >> When rendering a zone in the server-side, we can mark the start and end >> of a zone's content with HTML comments. >> >> e.g. >> >> <!-- [UUF-ZONE]{"name": "grid", "position": "start"} --> >> <p>content of zone grid goes here</p> >> <div>here is a div</div> >> <p>some more stuff</p> >> <!-- [UUF-ZONE]{"name": "grid", "position": "end"} --> >> >> HTML comments can be identified by filtering nodes in the DOM. And >> further filtering the comments that starts with [UUF-ZONE], we can >> identify UUF zone marking comments. Jerad did a POC for this. In that we >> were able to successfully identify zones and push content for all modes. >> >> >> We are hoping to expose this library through the "uuf-client" fragment in >> the common "foundation" component [1]. >> >> [1] https://github.com/wso2/carbon-uuf-common/tree/master/compo >> nents/org.wso2.carbon.uuf.common.foundation >> >> WDYT? >> >> Thanks. >> -- >> Sajith Janaprasad Ariyarathna >> Software Engineer; WSO2, Inc.; http://wso2.com/ >> <https://wso2.com/signature> >> >> _______________________________________________ >> Architecture mailing list >> [email protected] >> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >> >> > > > -- > > -- > *Joseph Fonseka* > WSO2 Inc.; http://wso2.com > lean.enterprise.middleware > > mobile: +94 772 512 430 > skype: jpfonseka > > * <http://lk.linkedin.com/in/rumeshbandara>* > > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > >
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
