var EditorView = View.extend({ el: "#editorView", blueprintAction: "/api/blueprint/user/", projectAction: "/api/project/", layoutAction: "/api/layout/", events: { }, initialize: function(){ this.cursor = new HelpCursor ({ parent: this }) this.toolbar = new EditorToolbar ({ parent: this }) this.settings = new EditorSettings ({ parent: this }) this.info = new BuilderInfo ({ parent: this }) this.mediaViewer = new MediaViewer ({ parent: this }) this.mediaUpload = new MediaUpload ({ parent: this }) this.mediaTumblr = new MediaTumblr ({ parent: this }) this.mediaEditor = new MediaEditor ({ parent: this }) this.sculptureEditor = new SculptureEditor ({ parent: this }) this.wallpaperPicker = new WallpaperPicker ({ parent: this }) this.colorControl = new ColorControl ({ parent: this }) this.textEditor = new TextEditor ({ parent: this }) this.collaborators = new Collaborators ({ parent: this }) this.presets = new Presets ({ parent: this }) this.share = new ShareView ({ parent: this }) }, load: function(name){ name = sanitize(name) $.get(this.projectAction + name, this.ready.bind(this)) }, loadLayout: function(layout){ if (layout == "empty") { this.readyLayout({}) this.toolbar.toggleMap() return } layout = sanitize(layout) $.get(this.layoutAction + layout, this.readyLayout.bind(this)) }, loadBlueprint: function(blueprint){ $.get(this.blueprintAction + blueprint, this.readyLayout.bind(this)) }, ready: function(data){ $("#map").hide() this.data = data this.settings.load(data) this.info.load(data) }, readyLayout: function(data){ data.isNew = true // $('#help-button').trigger("click") this.ready(data) }, pick: function(scenery){ if (scenery.isSculpture) { this.mediaEditor.hide() this.textEditor.hide() this.sculptureEditor.pick(scenery) } else if (scenery.type == "text") { this.mediaEditor.hide() this.sculptureEditor.hide() this.textEditor.pick(scenery) } else { this.textEditor.hide() this.sculptureEditor.hide() this.mediaEditor.pick(scenery) } }, pickWall: function(wall, pos){ this.hideExtras() this.wallpaperPicker.pickWall(wall) }, hideExtras: function(){ this.sculptureEditor.hide() this.mediaEditor.hide() this.textEditor.hide() this.share.hide() Sculpture.resize.hide() Scenery.resize.hide() Scenery.hovering = false } })