var NewProjectModal = ModalView.extend(LayoutsIndex.prototype).extend({ el: ".mediaDrawer.newProject", action: "/api/layout", events: { "click [data-role='create-new-layout']": 'createNewLayout', "click [data-role='create-new-blueprint']": 'createNewBlueprint', "click .templates span": 'pick', }, toggleActive: function(e){ e.preventDefault() this.$(".templates .active").removeClass("active") $(e.currentTarget).addClass("active") }, pick: function(e){ e && e.preventDefault() // var layout = this.$(".templates .active").data("slug") var layout = $(e.currentTarget).data("slug") var isBlueprint = $(e.currentTarget).data("blueprint") if (! layout || ! layout.length) return if (isBlueprint) { window.location.pathname = "/project/blueprint/" + layout } else { window.location.pathname = "/project/new/" + layout } }, createNewLayout: function(e){ e.preventDefault() window.location.pathname = "/project/new/empty" }, createNewBlueprint: function(e){ e.preventDefault() window.location.pathname = "/blueprint/new" }, populate: function(data){ /* if (data.user.plan_level < 1 && data.projectCount == 1) { // show lockout message this.$newBlueprintButton.hide() } */ if (! data.layouts.length && ! data.user_layouts.length) { this.$templates.hide() this.$form.hide() this.$noTemplates.show() } if (! data.blueprints.length) { this.$blueprintsList.parent().hide() } if (! data.user_layouts.length) { this.$userTemplatesList.parent().hide() } this.$templatesList.empty() data.layouts.forEach(function(room){ var $span = $("") $span.data("slug", room.slug) var $label = $("