From 7e72bf7d028c2d95555b1132251103eac4dacec9 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Wed, 11 Jun 2014 02:11:53 -0400 Subject: hook up layout settings --- public/assets/javascripts/ui/SiteRouter.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'public/assets/javascripts/ui/SiteRouter.js') diff --git a/public/assets/javascripts/ui/SiteRouter.js b/public/assets/javascripts/ui/SiteRouter.js index 92816be..c224b6a 100644 --- a/public/assets/javascripts/ui/SiteRouter.js +++ b/public/assets/javascripts/ui/SiteRouter.js @@ -11,7 +11,7 @@ var SiteRouter = Router.extend({ "click [data-role='new-document-modal']": 'newDocument', "click [data-role='edit-document-modal']": 'editDocument', "click [data-role='delete-document-modal']": 'destroyDocument', - "click [data-role='show-layouts-modal']": 'showLayoutsModal', + "click [data-role='show-layouts-modal']": 'pickLayout', }, routes: { @@ -23,9 +23,8 @@ var SiteRouter = Router.extend({ "/about/:name/edit": 'editDocument', "/about/new": 'newDocument', "/editor": 'launchEditor', - "/builder": 'showLayoutsModal', - "/builder/new": 'launchBuilder', - "/builder/:name": 'launchBuilder', + "/builder": 'pickLayout', + "/builder/:name": 'builder', }, initialize: function(){ @@ -35,26 +34,24 @@ var SiteRouter = Router.extend({ this.editProjectModal = new EditProjectModal() this.editProfileModal = new EditProfileModal() this.documentModal = new DocumentModal() - this.confirmModal = new ConfirmModal() - this.alertModal = new AlertModal() this.route() $("body").removeClass("loading") }, - launchBuilder: function(){ + builder: function(e, name){ app.mode.builder = true app.launch() this.builderView = new BuilderView() - this.builderView.load() + this.builderView.load(name) }, - showLayoutsModal: function(e){ + pickLayout: function(e){ e && e.preventDefault() window.history.pushState(null, document.title, "/builder") - this.layoutsModal.load("builder") + this.layoutsModal.load() }, launchEditor: function(){ @@ -127,9 +124,9 @@ var SiteRouter = Router.extend({ var name = e ? $(e.currentTarget).data("name") : name - this.confirmModal.confirm("Are you sure you want to delete " + name + "?", $.proxy(function(){ + confirmModal.confirm("Are you sure you want to delete " + name + "?", $.proxy(function(){ this.documentModal.destroy(name, $.proxy(function(){ - this.alertModal.alert("Document deleted!", $.proxy(function(){ + AlertModal.alert("Document deleted!", $.proxy(function(){ window.location.href = "/about" }, this)) }, this)) -- cgit v1.2.3-70-g09d2