This file contains 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
/** | |
* Count records | |
*/ | |
def count(query: BSONDocument) = { | |
val db = collection.db | |
val futureCount = db.command(Count(collection.name, Some(query))) | |
futureCount.map { totalCount => | |
totalCount | |
} |
This file contains 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
futureUser.flatMap { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains 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
futureUser.flatMap { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains 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
futureUser.flatMap[SimpleResult] { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains 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
futureUser.flatMap[SimpleResult] { user => | |
Logger.debug("Login success") | |
User.updateLastLogin(user.get) | |
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role)) | |
} |
This file contains 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
def submitLogin = Action.async { implicit request => | |
val futureForm = scala.concurrent.Future { loginForm.bindFromRequest } | |
futureForm.map(form => { | |
form.fold( | |
formWithErrors => BadRequest(html.auth.login(formWithErrors)), | |
resultForm => { | |
resultForm match { | |
case (username, password) => { | |
val futureUser = User.findByUsername(username) |
This file contains 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
def submitLogin = Action.async { implicit request => | |
val futureForm = scala.concurrent.Future { loginForm.bindFromRequest } | |
futureForm.map(form => { | |
form.fold( | |
formWithErrors => BadRequest(html.auth.login(formWithErrors)), | |
resultForm => { | |
resultForm match { | |
case (username, password) => { | |
This file contains 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
def submitLogin = Action { implicit request => | |
val futureForm = scala.concurrent.Future { loginForm.bindFromRequest } | |
Async { | |
futureForm.map(form => { | |
form.fold( | |
formWithErrors => BadRequest(html.auth.login(formWithErrors)), | |
resultForm => { | |
resultForm match { | |
case (username, password) => { |
This file contains 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
/** | |
* Wait for new notification socket | |
*/ | |
def waitForNotification = WebSocket.using[JsValue] { request => | |
val iteratee = Promise[Iteratee[JsValue, Unit]]() | |
val enumerator = Concurrent.unicast[JsValue](onStart = { clientChannel => | |
iteratee.success(Iteratee.foreach[JsValue] { | |
json => { | |
Logger.debug("== Enumerator called ==") |
This file contains 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
var tabGroup = Titanium.UI.createTabGroup({id:'tabGroup1'}); | |
var win1 = Titanium.UI.createWindow({backgroundColor: '#ffffff'}); | |
win1.addEventListener('android:back', function() { | |
alert("android:back event firing from win1"); | |
}); | |
var tab1 = Titanium.UI.createTab({ | |
id:'tab1', | |
title: "Tab 1", | |
window:win1 |
NewerOlder