Tuesday, May 24, 2011

Week before the coding phase

I am very late on this particular blogpost, apologies for that.A week prior to the coding phase, I was working on asynchronous file uploads (for the student forms), I have used the jquery-fileupload plugin for this task and I have some problem with sending the request and so will look into it sometime later.But in this process, I have learnt how to add any javascript files to Melange and as for this, I first had to put the plugin file in app.jquery and add it's corresponding entry in soc.content.melange-dependency and run bin/paver closure to create minified version of it.I learnt that doing all that logic inside the function in the dependency array is not really the way it is meant to be.Ideally, one should create all the logic for a form in a template which is called using the tc() facility[0], which loads the javascript
template file and put variables (for example an id called #foo) in the context of the template as we can get the variables in the context (after we use the tc() facility in the django template) by using var _self = this; and then _self.context..I also learnt that Whenever we put a "null" in the array, LAB.js will wait for the above scripts to be downloaded, evaluated and ran before evaluating and then run the others.My mentor Madhusudhan gave me a lot of support and taught me many new things and thanks to Mario for advice on using javascript in Melange.

[0] http://code.google.com/p/soc/wiki/JavascriptCSSDependencies

No comments:

Post a Comment