var LayoutsIndex = View.extend({ initialize: function(){ this.$templates = this.$(".templates") this.$templatesList = this.$(".templates-list") this.$noTemplates = this.$(".no-templates") this.$form = this.$("form") }, load: function(type){ this.$templates.children("span").remove() $.get(this.action, this.populate.bind(this)) }, populate: function(data){ /* if (data.layoutCounts.basic > data.plan.basic_layout_limit) { } if (data.layoutCounts.pro > data.plan.pro_layout_limit) { } if (data.projectCounts.stock > data.plan.stock_project_limit) { } if (data.projectCounts.basic > data.plan.basic_project_limit) { } if (data.projectCounts.pro > data.plan.pro_project_limit) { } */ 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 = $("