Detecting if touch UI or Classic UI for handlebar template?
Is there any way I can detect if a component is being edited in touch or classic UI from the handlebar template of the component?
Thanks for reading.
Is there any way I can detect if a component is being edited in touch or classic UI from the handlebar template of the component?
Thanks for reading.
Hi
As mentioned by Lokesh (cf# for classic and editor.html for touchUI. However this may not work if the URL changes in future), we can know if we are in Touch UI or in classic UI.
Here is a article showing use of function calling in Handlerbars.js
//
Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/communities/scf/handlebars-helpers.html
Handlebars.js Basic Overview
A quick overview of helper functions from Handlebars.js documentation :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Handlebars.registerHelper('link_to', function(title, options) { return new Handlebars.SafeString('<a href="https://forums.adobe.com/posts' + this.url + '">' + title + "!</a>");});var context = {posts: [ {url: "/hello-world", body: "Hello World!"} ] };// when link_to is called, posts is the current contextvar source = '<ul>{{#posts}}<li>{{{link_to "Post"}}}</li>{{/posts}}</ul>'var template = Handlebars.compile(source);template(context); |
I hope this would help you.
Thanks and Regards
Kautuk Sahni
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.