var LayoutsIndex = View.extend({ initialize: function(){ this.$templates = this.$(".templates") this.$templatesList = this.$(".templates-list") this.$noTemplates = this.$(".no-templates") this.$form = this.$("form") this.$userTemplatesList = this.$(".userTemplatesList") this.$blueprintsList = this.$(".blueprintsList") this.$newBlueprintButton = this.$("[data-role='create-new-blueprint']") }, load: function(type){ this.$templates.children("span").remove() $.get(this.action, this.populate.bind(this)) }, populate: function(data){ if (! data.layouts.length) { this.$templates.hide() this.$form.hide() this.$noTemplates.show() } this.$templatesList.empty() data.layouts.forEach(function(room){ var $span = $("") $span.data("slug", room.slug) var $label = $("