Jun 17, 2013

GSoC official coding period starts | Work Progress

The official coding period in this year's Google Summer of Code has finally begun. Three weeks between declaration of results and start of the coding is a big time. That is why I had started coding almost ten days ago! This was to make sure I had a head start, which gives me a better chance of tackling unforeseen delays.

First, let's talk about the tasks that I have started looking into but come later in the GSoC. One such thing is adding an accessible flipswitch in place of Enable-Disable radio buttons. Here is a cool one that I found, which also keeps accessibility in mind. Note that it uses bootstrap, but that should not be a problem as I would be reusing only those classes that are necessary.

Next, I had to identify a list of tasks which I would add AJAX functionality to. Here is the tentative list. Feel free to add something if you are accustomed to ATutor. Note that it's not in the order of priority and I would strike these off by the time as I feel good, with maximum functionality for the mid term evaluation.

In general

Changing Questions in Tests

Adding, Editing and Deleting comments- Forum, File Storage

Subscribe/Unsubscribe to Courses

Voting in Polls

Auto update of announcements in course home.

Auto update of comments/posts in Forum.

Inbox mail preview

For Instructors

Adding/Deleting/Editing Glossary terms.

Delete comments in albums/uploads

Forum/File Storage/Inbox functionality can be used by Instructor as well.

For Admins

Editing Users or Updating their passwords.

Approve/Deny instructor requests, and showing preview of their profiles before approve/deny.

Creating/Editing Administrator

According to my proposal, the tasks that were decided for the first week have already been completed and I will be proceeding with some more tasks listed in the proposal.

One more important thing that I have to do (after mid term evaluation) is convert the existing CSS structure to SASS. I have chosen SASS after a long discussion, but the community can convert to LESS with great ease if they ever decide to do so in the future.

Now, for some actual coding. I have AJAXified the processes of adding, editing and deleting comments in File Storage. My latest code can be found here. Here are some little things that I came to know recently.

If you are trying to find out the text inside a textarea using jQuery, use val(). If you use $(textarea).html() or $(textarea).text(), you don't get an update value of the text if the use types in something.

You might have noticed that these is no equivalent of PHP's htmlspecialchars() in JavaScript. A simple hack is to use $('<div/>').text("my text here").html(). Conversely, you can use $('<div/>').html(comment).text() if you want the opposite result.

Trailing whitespaces (at the ends of lines) are really irritating. To remove them run ':%s/\s\+$//' in your VIM.

Don't use $('#some-id') repeatedly. It searches the DOM every single time you call it. Most people do it unknowingly. A better way is to store it in a variable.

jQuery extend. Let's say you have a few options that you are passing as arguments to a function. You can set a defaults and use var settings = $.extend({}, defaults, options); which would essentially overwrite defaults with options, but keeps those properties of defaults intact which are not present in options! Huge potential for use in functions that require a lot of arguments (reminds me of Online Exams).

I guess that's it for now. I will make another post as soon as I find something important to pen down. Meanwhile, feel free to suggest anything that you guys may want to see in ATutor. After all, this UI redesign has the greatest potential to introduce big changes into the project and my mentor is more than willing to listen to good ideas. Cheers!

Liked this post? Have any suggestions? Just let me know. Feel free to comment below!