Skip to content

Commit

Permalink
All obsolete paths moved to /old/
Browse files Browse the repository at this point in the history
Introduced thingRedirect(), to absorb old links and repoint them to the
new UI.
  • Loading branch information
Mark "Justin" Waks committed Mar 6, 2015
1 parent ad081dd commit 21d0b05
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 38 deletions.
6 changes: 6 additions & 0 deletions querki/scalajvm/app/controllers/ClientController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import akka.util.Timeout

import play.api.data._
import play.api.data.Forms._
import play.api.mvc.{Action, Call}

import upickle._
import autowire._
Expand Down Expand Up @@ -76,6 +77,11 @@ class ClientController extends ApplicationBase {
}
}

def thingRedirect(ownerId:String, spaceId:String, thingId:String) = Action {
val spaceCall = routes.ClientController.space(ownerId, spaceId)
Redirect(new Call(spaceCall.method, spaceCall.url + s"#$thingId"))
}

def unpickleRequest(rc:PlayRequestContext):autowire.Core.Request[String] = {
implicit val request = rc.request
requestForm.bindFromRequest.fold(
Expand Down
81 changes: 43 additions & 38 deletions querki/scalajvm/conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,44 @@ GET /spaces @controllers.Application.spaces
GET /newSpace @controllers.Application.newSpace
POST /doNewSpace @controllers.Application.doNewSpace

GET /help/ @controllers.Application.thing(userName = "systemUser", spaceId = "documentation", thingId = "documentation")
GET /help/:thingId @controllers.Application.thing(userName = "systemUser", spaceId = "documentation", thingId)
#GET /help/ @controllers.Application.thing(userName = "systemUser", spaceId = "documentation", thingId = "documentation")
#GET /help/:thingId @controllers.Application.thing(userName = "systemUser", spaceId = "documentation", thingId)
GET /help/ @controllers.ClientController.space(userName = "systemUser", spaceId = "documentation")
GET /help/:thingId @controllers.ClientController.thingRedirect(userName = "systemUser", spaceId = "documentation", thingId)

GET /TOS @controllers.TOSController.showTOS
POST /TOS @controllers.TOSController.handleTOS

# The old way to address a Space, now replaced by the new client:
# GET /u/:userName/:spaceId/ @controllers.Application.space(userName, spaceId)
GET /u/:userName/:spaceId/ @controllers.ClientController.space(userName, spaceId)

GET /u/:userName/:spaceId/createThing @controllers.Application.createThing(userName, spaceId, model:Option[String])
GET /u/:userName/:spaceId/createProperty @controllers.Application.createProperty(userName, spaceId)
POST /u/:userName/:spaceId/createThing @controllers.Application.doCreateThing(userName, spaceId, subCreate:Option[Boolean])
GET /u/:userName/:spaceId/_createAndEdit @controllers.Application.doCreateThing2(userName, spaceId, model)
POST /u/:userName/:spaceId/_createAndEdit @controllers.Application.doCreateThing2(userName, spaceId, model)
POST /u/:userName/:spaceId/setProperty2 @controllers.Application.setProperty2(userName, spaceId, thingId)
GET /u/:userName/:spaceId/getPropertyDisplay @controllers.Application.getPropertyDisplay(userName, spaceId, thingId, prop)
GET /u/:userName/:spaceId/getPropertyEditor @controllers.Application.getPropertyEditor(userName, spaceId, thingId, prop, i:Int)
GET /u/:userName/:spaceId/_getThingEditor @controllers.Application.getThingEditor(userName, spaceId, thingId)
GET /u/:userName/:spaceId/_editInstances @controllers.Application.editInstances(userName, spaceId, modelId)
GET /u/:userName/:spaceId/_getModelType @controllers.Application.getModelType(userName, spaceId, modelId)
GET /u/:userName/:spaceId/_exportModel @controllers.Application.exportModel(userName, spaceId, modelId, format:Int)
GET /u/:userName/:spaceId/_advanced @controllers.Application.showAdvancedCommands(userName, spaceId, thingId)

GET /u/:userName/:spaceId/_explorer @controllers.ExploreController.showExplorer(userName, spaceId, thingId)
POST /u/:userName/:spaceId/_evaluate @controllers.ExploreController.evaluate(userName, spaceId, thingId, ql)

GET /u/:userName/:spaceId/edit @controllers.Application.editThing(userName, spaceId, thingId)
POST /u/:userName/:spaceId/edit @controllers.Application.doEditThing(userName, spaceId, thingId)
GET /u/:userName/:spaceId/_changeModel @controllers.Application.changeModel(userName, spaceId, thingId)
GET /u/:userName/:spaceId/view @controllers.Application.viewThing(userName, spaceId, thingId)
GET /u/:userName/:spaceId/delete @controllers.Application.deleteThing(userName, spaceId, thingId)

GET /u/:userName/:spaceId/_sharing @controllers.Application.sharing(userName, spaceId)
POST /u/:userName/:spaceId/_inviteMembers @controllers.LoginController.inviteMembers(userName, spaceId)
GET /u/:userName/:spaceId/ @controllers.ClientController.space(userName, spaceId)

GET /old/:userName/:spaceId/createThing @controllers.Application.createThing(userName, spaceId, model:Option[String])
GET /old/:userName/:spaceId/createProperty @controllers.Application.createProperty(userName, spaceId)
POST /old/:userName/:spaceId/createThing @controllers.Application.doCreateThing(userName, spaceId, subCreate:Option[Boolean])
GET /old/:userName/:spaceId/_createAndEdit @controllers.Application.doCreateThing2(userName, spaceId, model)
POST /old/:userName/:spaceId/_createAndEdit @controllers.Application.doCreateThing2(userName, spaceId, model)
POST /old/:userName/:spaceId/setProperty2 @controllers.Application.setProperty2(userName, spaceId, thingId)
GET /old/:userName/:spaceId/getPropertyDisplay @controllers.Application.getPropertyDisplay(userName, spaceId, thingId, prop)
GET /old/:userName/:spaceId/getPropertyEditor @controllers.Application.getPropertyEditor(userName, spaceId, thingId, prop, i:Int)
GET /old/:userName/:spaceId/_getThingEditor @controllers.Application.getThingEditor(userName, spaceId, thingId)
GET /old/:userName/:spaceId/_editInstances @controllers.Application.editInstances(userName, spaceId, modelId)
GET /old/:userName/:spaceId/_getModelType @controllers.Application.getModelType(userName, spaceId, modelId)
GET /old/:userName/:spaceId/_exportModel @controllers.Application.exportModel(userName, spaceId, modelId, format:Int)
GET /old/:userName/:spaceId/_advanced @controllers.Application.showAdvancedCommands(userName, spaceId, thingId)

GET /old/:userName/:spaceId/_explorer @controllers.ExploreController.showExplorer(userName, spaceId, thingId)
POST /old/:userName/:spaceId/_evaluate @controllers.ExploreController.evaluate(userName, spaceId, thingId, ql)

GET /old/:userName/:spaceId/edit @controllers.Application.editThing(userName, spaceId, thingId)
POST /old/:userName/:spaceId/edit @controllers.Application.doEditThing(userName, spaceId, thingId)
GET /old/:userName/:spaceId/_changeModel @controllers.Application.changeModel(userName, spaceId, thingId)
GET /old/:userName/:spaceId/view @controllers.Application.viewThing(userName, spaceId, thingId)
GET /old/:userName/:spaceId/delete @controllers.Application.deleteThing(userName, spaceId, thingId)

GET /old/:userName/:spaceId/_sharing @controllers.Application.sharing(userName, spaceId)
POST /old/:userName/:spaceId/_inviteMembers @controllers.LoginController.inviteMembers(userName, spaceId)

# Note that these are still direct pages, not through the Client:
GET /u/:userName/:spaceId/_handleInvite @controllers.LoginController.handleInvite(userName, spaceId)
POST /u/:userName/:spaceId/_handleInvite @controllers.LoginController.signup(userName, spaceId)
POST /u/:userName/:spaceId/_joinLogin @controllers.LoginController.joinlogin(userName, spaceId)
Expand All @@ -52,16 +55,15 @@ GET /u/:userName/:spaceId/_getCollaborators @controllers.LoginController.get

# GET /u/:userName/:spaceId/export @controllers.Application.exportThing(userName, spaceId, thingId)

GET /u/:userName/:spaceId/getTags @controllers.Application.getTags(userName, spaceId, propId, q)
GET /u/:userName/:spaceId/getLinks @controllers.Application.getLinks(userName, spaceId, propId, q)
GET /old/:userName/:spaceId/getTags @controllers.Application.getTags(userName, spaceId, propId, q)
GET /old/:userName/:spaceId/getLinks @controllers.Application.getLinks(userName, spaceId, propId, q)

POST /u/:userName/:spaceId/search @controllers.Application.search(userName, spaceId)
POST /old/:userName/:spaceId/search @controllers.Application.search(userName, spaceId)

POST /u/:userName/:spaceId/_photoUpload @controllers.PhotoController.upload(userName, spaceId, thingId)

# API CALLS
# TODO: this should eventually replace the normal thing path, below:
# GET /u/:userName/:spaceId/client @controllers.ClientController.thing(userName, spaceId, thingId)
POST /u/:userName/:spaceId/_apiRequest @controllers.ClientController.apiRequest(userName, spaceId)
GET /u/:userName/:spaceId/_marcoPolo @controllers.ClientController.marcoPolo(userName, spaceId, propId)
POST /_userApiRequest @controllers.ClientController.userApiRequest
Expand Down Expand Up @@ -90,18 +92,21 @@ GET /admin/sendSystemMessage @controllers.AdminController.sendSystemMessa
POST /admin/sendSystemMessage @controllers.AdminController.doSendSystemMessage

# Conversations
GET /u/:userName/:spaceId/__getConv @controllers.ConversationController.getConversations(userName, spaceId, thingId)
POST /u/:userName/:spaceId/__addComment @controllers.ConversationController.addComment(userName, spaceId, thingId, text, responseTo)
GET /u/:userName/:spaceId/__deleteComment @controllers.ConversationController.deleteComment(userName, spaceId, thingId, commentId)
GET /old/:userName/:spaceId/__getConv @controllers.ConversationController.getConversations(userName, spaceId, thingId)
POST /old/:userName/:spaceId/__addComment @controllers.ConversationController.addComment(userName, spaceId, thingId, text, responseTo)
GET /old/:userName/:spaceId/__deleteComment @controllers.ConversationController.deleteComment(userName, spaceId, thingId, commentId)
GET /convJs @controllers.ConversationController.javascriptRoutes

# Notifications
GET /_notifications @controllers.NotificationController.showNotifications

# Redirect pointers to Things to go to the Client:
GET /u/:userName/:spaceId/*thingId @controllers.ClientController.thingRedirect(userName, spaceId, thingId)

# Fetch a Thing by ThingId
# Note that Things can have slashes in their names!
# IMPORTANT: this needs to come *after* all Space-based special-purpose pages!
GET /u/:userName/:spaceId/*thingId @controllers.Application.thing(userName, spaceId, thingId)
GET /old/:userName/:spaceId/*thingId @controllers.Application.thing(userName, spaceId, thingId)

# AJAX test stuff:
GET /showTestAjax @controllers.Application.showTestAjax
Expand Down

0 comments on commit 21d0b05

Please sign in to comment.