diff options
| author | Julie Lala <jules@okfoc.us> | 2014-06-11 02:11:53 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-06-11 02:29:43 -0400 |
| commit | 7e72bf7d028c2d95555b1132251103eac4dacec9 (patch) | |
| tree | 5c1d6cf8c5591467fc137dd605205a6bd092cd4f /public/assets/javascripts/ui/SiteRouter.js | |
| parent | c40e1e901f0d51e48be4dffafad9c3b1039a9fd2 (diff) | |
hook up layout settings
Diffstat (limited to 'public/assets/javascripts/ui/SiteRouter.js')
| -rw-r--r-- | public/assets/javascripts/ui/SiteRouter.js | 21 |
1 files changed, 9 insertions, 12 deletions
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)) |
