Sha256: 04fe931040ee3b1e87d695109ad2c5fd1ddd476926f310c405924e58cf35d3b9

Contents?: true

Size: 1.47 KB

Versions: 23

Compression:

Stored size: 1.47 KB

Contents

define(
[
    'model/base'
],
function(
    Base
){
    /**
     * DashboardModel
     *
     * Generic model that represents a dashboard in rearview.
     **/
    var DashboardModel = Base.extend({
        initialize : function(options) {
            this.category    = ( options ) ? options.category : false;
            this.dashboardId = ( options ) ? options.dashboardId : null;
        },
        url : function() {
            if ( this.category ) {
                return ( this.dashboardId ) ? '/dashboards/' + this.dashboardId + '/children.json' : '/dashboards.json';
            } else {
                return ( this.get('id') ) ? '/dashboards/' + this.get('id') : '/dashboards.json';
            }
        },
        parse : function(response, options) {
            response.createdAt = ( response.createdAt ) 
                               ? this.formatServerDateTime(response.createdAt)
                               : response.createdAt;
            
            response.modifiedAt = ( response.modifiedAt ) 
                                ? this.formatServerDateTime(response.modifiedAt) 
                                : response.modifiedAt;
            return response;
        },
        defaults : {
            'id'         : null,
            'userId'     : null,
            'name'       : 'Default',
            'createdAt'  : null,
            'modifiedAt' : null,
            'description': null,
            'children'   : []
        }
    });

    return DashboardModel;
});

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby public/rearview-src/js/model/dashboard.js
rearview-1.2.2.rc.2-jruby public/rearview-src/js/model/dashboard.js
rearview-1.2.2.rc.1-jruby public/rearview-src/js/model/dashboard.js
rearview-1.2.1-jruby public/rearview-src/js/model/dashboard.js
rearview-1.2.0-jruby public/rearview-src/js/model/dashboard.js
rearview-1.1.2-jruby public/rearview-src/js/model/dashboard.js
rearview-1.1.1-jruby public/rearview-src/js/model/dashboard.js
rearview-1.1.0-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.3.rc.4-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.3.rc.3-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.3.rc.2-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.3.rc.1-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.2-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.2.rc.4-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.2.rc.3-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.2.rc.2-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.2.rc.1-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.1-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.0-jruby public/rearview-src/js/model/dashboard.js
rearview-1.0.0.rc5-jruby public/rearview-src/js/model/dashboard.js