Commit 98ec8005 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Backwards-compatibility layer for Favorites model.

Convert favorites saved in old format to new format.
parent 91faa933
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -29,6 +29,16 @@ Ext.define("Docs.Favorites", {
            this.syncStore();
        }
        
        // For backwards compatibility with old Favorites Model
        // convert the old-style records to new schema.
        else if (!this.store.first().get("url")) {
            this.store.each(function(r) {
                r.set("title", r.data.cls);
                r.set("url", "/api/"+r.get("cls"));
                r.set("cls", "");
            });
            this.syncStore();
        }
    },

    /**
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
 * Favorite classes
 */
Ext.define('Docs.model.Favorite', {
    fields: ['id', 'url', 'title'],
    fields: ['id', 'url', 'title', 'cls'],
    extend: 'Ext.data.Model',
    proxy: {
        type: ('localStorage' in window && window['localStorage'] !== null) ? 'localstorage' : 'memory',