summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/SiteRouter.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-23 15:27:02 -0400
committerJules Laplace <jules@okfoc.us>2014-06-23 15:27:02 -0400
commitb0ab3271996d542e718e8e3fc910053d60cf81f6 (patch)
treefb147d83a108c4945b6bb42850e62aa78ead5226 /public/assets/javascripts/ui/SiteRouter.js
parentb9dacb35ff90c6f666121742cf03f30ea4d2129d (diff)
standalone viewer
Diffstat (limited to 'public/assets/javascripts/ui/SiteRouter.js')
-rw-r--r--public/assets/javascripts/ui/SiteRouter.js169
1 files changed, 0 insertions, 169 deletions
diff --git a/public/assets/javascripts/ui/SiteRouter.js b/public/assets/javascripts/ui/SiteRouter.js
deleted file mode 100644
index 3a6b589..0000000
--- a/public/assets/javascripts/ui/SiteRouter.js
+++ /dev/null
@@ -1,169 +0,0 @@
-
-var SiteRouter = Router.extend({
- el: "body",
-
- events: {
- "click [data-role='show-signup-modal']": 'signup',
- "click [data-role='show-signin-modal']": 'signin',
- "click [data-role='new-project-modal']": 'newProject',
- "click [data-role='edit-project-modal']": 'editProject',
- "click [data-role='edit-profile-modal']": 'editProfile',
- "click [data-role='new-document-modal']": 'newDocument',
- "click [data-role='edit-document-modal']": 'editDocument',
- "click [data-role='destroy-document-modal']": 'destroyDocument',
- "click [data-role='show-layouts-modal']": 'layoutPicker',
- "click [data-role='show-projects-modal']": 'projectPicker',
- },
-
- routes: {
- "/login": 'signin',
- "/signup": 'signup',
- "/profile": 'profile',
- "/profile/edit": 'editProfile',
- "/about/:name/edit": 'editDocument',
- "/about/new": 'newDocument',
-
- "/layout": 'layoutPicker',
- "/layout/:name": 'layoutEditor',
-
- "/project": 'projectPicker',
- "/project/new": 'newProject',
- "/project/new/:layout": 'projectNewWithLayout',
- "/project/:name": 'projectEditor',
- },
-
- initialize: function(){
- this.signUpModal = new SignUpModal()
- this.signInModal = new SignInModal()
- this.layoutsModal = new LayoutsModal()
- this.projectsModal = new ProjectsModal()
- this.newProjectModal = new NewProjectModal()
- this.editProjectModal = new EditProjectModal()
- this.editProfileModal = new EditProfileModal()
- this.documentModal = new DocumentModal()
-
- this.route()
-
- $("body").removeClass("loading")
- },
-
-
- layoutEditor: function(e, name){
- app.mode.builder = true
- app.launch()
-
- this.builderView = new BuilderView()
- this.builderView.load(name)
- },
-
- layoutPicker: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/layout")
- this.layoutsModal.load()
- },
-
- projectPicker: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/project")
- this.projectsModal.load()
- },
-
- newProject: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/project/new")
- this.newProjectModal.load()
- },
-
- projectNewWithLayout: function(e, layout){
- e && e.preventDefault()
-
- app.mode.editor = true
- app.launch()
-
- layout = slugify(layout)
-
- window.history.pushState(null, document.title, "/project/new/" + layout)
- this.editorView = new EditorView()
- this.editorView.loadLayout(layout)
- },
-
- projectEditor: function(e, name){
- app.mode.editor = true
- app.launch()
-
- this.editorView = new EditorView()
- this.editorView.load(name)
- },
-
-
-/*
- editProject: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/project/edit")
- this.editProjectModal.load()
- },
-*/
-
- signup: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/signup")
- this.signUpModal.load()
- },
-
- signin: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/login")
- this.signInModal.load()
- },
-
- profile: function(e){
- var classes = ['one', 'two', 'three', 'four',
- 'five', 'six', 'seven', 'eight',
- 'nine', 'ten', 'eleven', 'twelve',
- 'thirteen'];
- $(".bio").addClass(choice(classes));
- },
-
- editProfile: function(e){
- e && e.preventDefault()
- window.history.pushState(null, document.title, "/profile/edit")
-
- this.editProfileModal.load()
- },
-
-
- newDocument: function(e){
- e && e.preventDefault()
-
- var name = e ? $(e.currentTarget).data("name") : "new"
-
- window.history.pushState(null, document.title, "/about/new")
- this.documentModal.load(name, true)
- },
-
- editDocument: function(e, name){
- e && e.preventDefault()
-
- var name = e ? $(e.currentTarget).data("name") : name
- window.history.pushState(null, document.title, "/about/" + name + "/edit")
- this.documentModal.load(name, false)
- },
-
- destroyDocument: function(e, name){
- e && e.preventDefault()
-
- var name = e ? $(e.currentTarget).data("name") : name
-
- confirmModal.confirm("Are you sure you want to delete " + name + "?", $.proxy(function(){
- this.documentModal.destroy(name, $.proxy(function(){
- AlertModal.alert("Document deleted!", $.proxy(function(){
- window.location.href = "/about"
- }, this))
- }, this))
- }, this))
-
- // this.documentModal.destroy(name)
- },
-
-})
-