From c781911322c84eb0c2aa4a00860016437d7b7cba Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 26 Aug 2015 18:30:33 -0400 Subject: surface blueprints on new project modal --- views/projects/layouts-modal.ejs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'views/projects') diff --git a/views/projects/layouts-modal.ejs b/views/projects/layouts-modal.ejs index 6f60d81..31ba7bf 100644 --- a/views/projects/layouts-modal.ejs +++ b/views/projects/layouts-modal.ejs @@ -43,7 +43,10 @@
+
+ +

-- cgit v1.2.3-70-g09d2 From c29a5363e3e4e0833e78958fe95b52811d0b0660 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 26 Aug 2015 18:42:13 -0400 Subject: surface blueprints on layouts modal --- public/assets/javascripts/ui/site/LayoutsIndex.js | 85 ++++++++ public/assets/javascripts/ui/site/LayoutsModal.js | 221 ++------------------- .../assets/javascripts/ui/site/NewProjectModal.js | 118 +++++++++++ public/assets/stylesheets/app.css | 6 +- views/home.ejs | 2 +- views/partials/scripts.ejs | 2 + views/projects/layouts-modal.ejs | 4 +- 7 files changed, 226 insertions(+), 212 deletions(-) create mode 100644 public/assets/javascripts/ui/site/LayoutsIndex.js create mode 100644 public/assets/javascripts/ui/site/NewProjectModal.js (limited to 'views/projects') diff --git a/public/assets/javascripts/ui/site/LayoutsIndex.js b/public/assets/javascripts/ui/site/LayoutsIndex.js new file mode 100644 index 0000000..f7272bb --- /dev/null +++ b/public/assets/javascripts/ui/site/LayoutsIndex.js @@ -0,0 +1,85 @@ + +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 = $("