Created
December 3, 2011 19:23
-
-
Save joegaudet/1427885 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GPlusController(val dispatcher:FlowDispatcher) extends FlowController { | |
// show | |
get("/posts/:id/googlePlus") { | |
val post = Post.find(params("id")) | |
val offering = post.getOffering() | |
val redirectUrl = FlowAuthentication.userFromRequest(request, response) match { | |
case Some(user) if (offering != None) => { | |
if (offering.get.userIsInOffering(Some(user))) { | |
"https://www.matygo.com/app/#threads/" + post.discussionThreadId | |
} | |
else "https://www.matygo.com/app" | |
} | |
case _ => "http://www.matygo.com" | |
} | |
val courseTitle = offering match { | |
case None => "a course" | |
case Some(offering) => offering.courseTitle | |
} | |
val content = "0; url=" + redirectUrl; | |
<html> | |
<head> | |
<meta http-equiv="Refresh" content={content} /> | |
<title>Great Post</title> | |
</head> | |
<body> | |
<img src="https://s3.amazonaws.com/assets.matygo.com/matygologo.png" /> | |
<p>From {courseTitle} <a href={redirectUrl}>on Matygo</a>.</p> | |
</body> | |
</html> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment