/**
 * Main page
 */
define([
    "underscore",
    "backbone"
],
function(_, Backbone, Handlebars, template) {
    var mainPage = Backbone.View.extend({
        events: {
            "vclick #main-add-book": "onAddBook",
        },

        initialize: function() {
            this.books = null;
            return this;
        },

        render: function() {
            // Show books in "reading" state.
            console.info("Reading count", this.books.size());

            this.$("#main-reading-count").text(this.books.size());
            this.$("#main-book-instances-fmt").text(this.model.formatSimply("_book_instances"));
            this.$("#main-author-instances-fmt").text(this.model.formatSimply("_author_instances"));
            this.$("#main-tag-instances-fmt").text(this.model.formatSimply("_tag_instances"));

            this.$("#main-reading").append(this.books.map(function(book) {
                return "<li>" + book.get("title") + "</li>";
            }));

            return this;
        },

        /** EVENTS **/
        /**
         * Handle add book request.
         */
        onAddBook: function(event) {
            event.preventDefault();
            this.trigger("app:navigate", {
                url: "addbook"
            });
        }
    });

    return mainPage;
});

@@ -403,16 +403,75 @@
  state.%0A
+            var currentlyReadingCount = this.books.size();%0A
         
@@ -504,33 +504,37 @@
 count%22, 
-this.books.size()
+currentlyReadingCount
 );%0A%0A    
@@ -580,27 +580,382 @@
 ext(
-this.books.size());
+currentlyReadingCount);%0A%0A            if (currentlyReadingCount %3E 0) %7B%0A                this.$(%22#main-reading%22).empty().append(this.books.map(function(book) %7B%0A                    return %22%3Cli%3E%22 + book.get(%22title%22) + %22%3C/li%3E%22;%0A                %7D));%0A            %7D else %7B%0A                this.$(%22#main-reading%22).empty().append(%22%3Cli%3ECurrently reading no books.%3C/li%3E%22);%0A            %7D%0A
 %0A   
@@ -1249,162 +1249,8 @@
 );%0A%0A
-            this.$(%22#main-reading%22).append(this.books.map(function(book) %7B%0A                return %22%3Cli%3E%22 + book.get(%22title%22) + %22%3C/li%3E%22;%0A            %7D));%0A%0A
     

Improve currently reading list