Commit fd4fcb17 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Move favorites order saving to Docs.Favorites.

Keeps the Favorites controller cleaner.
parent 8162326e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -84,5 +84,16 @@ Ext.define("Docs.Favorites", {
     */
    getCount: function() {
        return this.store.getCount();
    },

    /**
     * Save order of favorites in store.
     *
     * This needs to be called explicitly, because of a bug in
     * localStorage which prevents the order of items being saved when
     * they're changed.
     */
    saveOrder: function() {
        this.store.getProxy().setIds(Ext.Array.map(this.store.data.items, function(i) { return i.data.id; }));
    }
});
+1 −4
Original line number Diff line number Diff line
@@ -34,10 +34,7 @@ Ext.define('Docs.controller.Favorites', {
                    Docs.Favorites.remove(url);
                },
                reorder: function() {
                    // Hack to fix a bug in localStorage which prevents the order of
                    // items being saved when they're changed
                    var store = Ext.getStore('Favorites');
                    store.getProxy().setIds(Ext.Array.map(store.data.items, function(i) { return i.data.id; }));
                    Docs.Favorites.saveOrder();
                }
            },
            'classtree': {