StudyPlannr Updates

I’ve updated StudyPlannr with even more cool AJAX-style interactivity. Now everything on the edit schedule page can be edited without requiring a page refresh.

Overall, I found this to not be as difficult as I had thought it would but. The main issue was translating the Jinja server-side python templates to client-side Javascript templates. I spent a long searching around and I ended up using ICanHaz.js. I like the automatic HTML escaping by default and that it allows me to include the templates directly in the HTML. ICanHas doesn’t have the same impressive feature list as Jinja, but that’s OK. I don’t like the syntax very much. I don’t look forward to having to maintain the funky characters- I have to look them up in the manual constantly. It feels like they’re trying to save a few characters for no reason and that feels like Perl, which isn’t a good thing.

Example Jinja:

Example ICanHaz:

        <p>text here </p>

This new version uses IcedCoffeeScript almost exclusively for the client-side stuff. I’m really digging it. I like the syntax much better than JavaScript and the await stuff is just icing on the cake. I think I’d probably still prefer some language that didn’t just compile to JavaScript (like Python or Ruby) but interoperability with amazing JavaScript libraries like JQuery would definitely be required.

For example, here’s the code that adds a new subject to a schedule:

$('#add-subject-form').submit (event) ->
    url = $('#add-subject-form').attr('action')
    post_data = { name: $('#add-item-name-textbox').val() }
    await $.post url, post_data, defer response_data, status, xhr
    FullRerender response_data