public
Last active

simple skills list dust template

  • Download Gist
skills.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
{#profile_skill}
<div class="section" id="profile-skills" style="display:block">
<div class="header">
<h2>{@pre:i18n text="Skills"}</h2>
</div>
{?skills} {! we still want to display the Skills heading, even if the number of skills is zero !}
<div class="content">
<ol class="skills" id="skills-list">
{#skills}
<li class="competency show-bean">
<span class="miniprofile-container jellybean">{.name}</span>
</li>
{/skills}
</ol>
</div>
{/skills}
</div>
{/profile_skill}
 
"profile_skill": {
"skills": [{
"name": "JavaScript"
}, {
"name": "Ruby"
}, {
"name": "Java"
}],
"i18n_skills": "Skills" // when rendered with current locale en_US
}

Interesting to see the unnecessary "hasSkills" property. Could this be a leftover from an earlier mustache implementation? Or could it be an artifact from the Java layer?

Interesting you ask! Yes, we tried mustache before moving to dust,js!

One more interesting case !

Say we want to do something like this

{?summary || ?specialties}
{?summary}

{summary}

{/summary}
{?specialties}

{specialties}

{/specialties}

And dust does not allow you to do expressions, since it is wants to be logic-less.

Even more ugly is like sending hasSummaryorSpecialities boolean is JSON

we thought hard on eliminating these superflous fields in the JSON

We wrote a @if helper! More details in the subsequent blog post

Slightly unrelated, but how do you render the "chrome" of these pages? Is that still done on the backend with something like Sitemesh?

We are moving away from full page model.

We used to use site-mesh, but we do not, since we have to buffer the response and we lose the progressive rendering

We have been building a smart evented/async proxy infront of all the apps to act as a aggregator for content from diff apps.

Hi,
I'm currently playing around with your extended version of dustjs and I'm curious about the way you approached internationalisation.
I see that "{@pre:i18n text="Skills"}" tag and I wonder how that is implemented.
Until now I have not seen that i18n feature in dustjs itselfs, is it a extension you did?
And what about that @pre tag?
Is it a helper you implemented?

Thanks in advance!

Yeah, I'd be very interested in a blog post or open-sourcing of your i18n infrastructure. (Or at least just a brief comment here on what it looks like) :)

We explored a lot of options and decided to process the template on the server.

A number of our new pages/features are using this and soon will be ramped to production

blog post will be out soon. ( in a week) stay tuned.

We are working on open sourcing the same ( mid June )

Looking for the blog post too... :)

Can we completely stop using server side scripting in jsp etc ?. How do we embed dynamic json data into html without using jsp at all. I am not talking about getting json data from ajax. Its when we have send following in the response, html ( static ) + script tags including templates ( static ) + json data ( dynamic ) .

Thank you for the great articles at linkedin.
I have a kind of general question. As I understood you moved completely to JS templating - only html and js. Right? It's exciting! Especially for us who used to use JSP/GSP/PythonWebFrameworks and so on. But how do you path to templates such params as context path, js libs versions, html headers and meta info? I guess in such cases you use server side template processing? Sorry if I repeat previous questions..

Hi Veena,
I have some cases that want to compile dust template on server, too. I decide use Nodejs as js engine on server.
On the above your comment you mentioned that you will have blog post about processing template on server
Would you mind give me a link of that post, I've had a searching and still dont see any articles that relate compiling dust template on server.
And you had mentioned about your open source, so how is about it?? Do you mind give me some ideas about compiling template on Node js

@alohaTu, Never made it publish the post, now I look back, compiling dust on the server is easy ( using node.js or Rhino or even V8 engine if you use a c++ stack). it is basically 4 lines of code to compile template in node.js Are you still wondering how.?

check out the paypal's open sources node module for dust rendering
https://github.com/paypal/adaro

@sivikt oops for been so late! But the answer is simple, any data to the dust template has to be in JSON including what you ask for .....params as context path, js libs versions, html headers and meta info. But why would you need html headers to display on the dust template? ....

@vybs : ok thank you, I will check this link, I think I will use node to compile Dust, and when you publish that post, please let me know that link, I alway keep follow any articles that relate about Dust :D

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.