Sha256: d328b0eee4e4079d00541313f09ffe7480ca5c656605c68956fdc4b3f5496fba

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

Lanes.Workspace.create = function(selector, options, extension_data){
    return new Lanes.Workspace.Instance(selector, options, extension_data);
};

Lanes.Workspace.Instance = class Instance {

    constructor(selector, options, extension_data){
        _.extend(this,options);

        this.ui = new Lanes.View.InterfaceState({ selector: selector, instance: this });
        Lanes.Data.Bootstrap.initialize({
            csrf: options.csrf_token,
            root: options.root_path,
            data: extension_data
        });
        options.user_data = ( options.user_data || {} );
        Lanes.current_user.setLoginData( options.user_data.user, options.user_data.access );

        Lanes.$(document).ready( ()=> {
            this.boot();
        });
    }



    boot(){
        this.root = Lanes.$( this.ui.selector );
        this.root.data().workspace = this;
        this.ui.root = this.root;

        Lanes.lib.ResizeSensor(this.root[0],  _.bind( _.debounce( function(a,b,c){
            this.ui.set({ viewport_width: this.root.width(), viewport_height: this.root.height() });
        }, 250 ), this) );

        this.root.addClass('lanes root');
        this.root.tooltip({
            viewport: '.lanes',
            selector: '[data-tooltip-message]',
            title: function(){ return this.getAttribute('data-tooltip-message'); }
        });

        var view = Lanes.getPath(this.view);
        if (!view){
            Lanes.fatal(this.view + " doesn't exist!");
        }
        this.view = new view({parent: this, model: this.ui}).render();
        this.ui.viewport = this.view.$el;

        this.root.append( this.view.el );

        Lanes.View.Keys.initialize();
        Lanes.Data.PubSub.initialize();
        Lanes.Extensions.fireOnAvailable(this);

        this.login_dialog = new Lanes.View.LoginDialog({ parent: this });

        // var screen = Lanes.Data.Screens.all.findWhere({ id: 'user-maintenance' });
        // screen.display();
    }
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.0.3 client/javascripts/workspace/Instance.es6
lanes-0.0.2 client/javascripts/workspace/Instance.es6
lanes-0.0.1 client/javascripts/workspace/Instance.es6