[Sugar-devel] Handlebars js

utkarsh Dhawan dhawanutkarsh at gmail.com
Fri Jun 26 11:08:08 EDT 2015


Hi Gonzalo,

Sure will ensure that next time.Thanks anyways.



Thanking You,
Utkarsh Dhawan
(Developer/Student)

Note:Please Consider The environment before printing.

On Fri, Jun 26, 2015 at 6:59 PM, Gonzalo Odiard <godiard at sugarlabs.org>
wrote:

> This is not a Sugar development question.
> If you are using a specific tool (like HandleBars) and have a problem,
> you should go to the specific tool forum to ask questions.
>
> And maybe you are not using the right tool for the job.
>
> Gonzalo
>
> On Thu, Jun 25, 2015 at 11:34 PM, utkarsh Dhawan <dhawanutkarsh at gmail.com>
> wrote:
>
>> Hi Gonzalo,
>>
>> Ya I would try to be more explanatory this time.
>>
>> My code looks somewhat like this:
>>
>> <script id="template" type="text/x-handlebars-template">
>> {{#each this}}
>> <li>
>> <h2>{{Title}}</h2>
>> {{#if content}}
>> <p>{{{content}}}</p>
>> {{/if}}
>> {{#if code}}
>> <div class="code">{{code}}</div>
>> {{/if}}
>> <button onclick="previous()">Previous</button>
>> <button onclick="next()">Next</button>
>> </li>
>> {{/each}}
>> </script>
>>
>> and I send data to this code through HandleBars
>>
>> <script type="text/javascript">
>> (function(){
>> var data=[{
>> id:"0",
>> Title:"Diving In",
>> content:"Some Data.",
>> },{
>> id:"1",
>> Title:"Text Editor",
>> content:"Some Data"
>> }];
>> var template=Handlebars.compile( $('#template').html() );
>> $('ul.content').append(template(data));
>> })();
>> </script>
>>
>> Now I just want the content and title to be displayed according to their
>> ids or something(only one at a time),but since the HandleBars is logic-less
>> I am not sure how to do that.
>>
>> So when the user clicks next the content and title of id 1 should be
>> displayed and when previous the content and title of id 0 should be
>> displayed dynamically.
>>
>> Thanking You,
>> Utkarsh Dhawan
>> (Developer/Student)
>>
>> Note:Please Consider The environment before printing.
>>
>> On Fri, Jun 26, 2015 at 1:42 AM, Gonzalo Odiard <godiard at sugarlabs.org>
>> wrote:
>>
>>> You don't describe the problems.
>>> Please explain and if possible point to the code or examples.
>>>
>>> Gonzalo
>>>
>>> On Thu, Jun 25, 2015 at 1:30 PM, utkarsh Dhawan <dhawanutkarsh at gmail.com
>>> > wrote:
>>>
>>>> Hi,
>>>>
>>>> I am working on a Sugar Activity called WebConfusion.It is basically a
>>>> python webkit activity which displays HTML page in it.I am currently
>>>> templating the webpages using the Handlebars js.Now the aim of the activity
>>>> is to show texts on various topics of HTML,CSS and JavaScript.I want to
>>>> dynamically load content on the page and add next and previous button to it
>>>> which load the next js object on the same page dynamically.Although Roshan
>>>> Poduyal helped me out but still I am facing problems and I guess he is not
>>>> available now.Hope to recieve some guidance.
>>>>
>>>> Thanking You,
>>>> Utkarsh Dhawan
>>>> (Developer/Student)
>>>>
>>>> Note:Please Consider The environment before printing.
>>>>
>>>> _______________________________________________
>>>> Sugar-devel mailing list
>>>> Sugar-devel at lists.sugarlabs.org
>>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>>
>>>>
>>>
>>>
>>> --
>>> Gonzalo Odiard
>>>
>>> SugarLabs - Software for children learning
>>>
>>
>>
>
>
> --
> Gonzalo Odiard
>
> SugarLabs - Software for children learning
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20150626/2ed0595e/attachment.html>


More information about the Sugar-devel mailing list