Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
package models | ||
|
||
// STEP 1: Define the registration case class | ||
import com.mongodb.casbah.Imports._ | ||
import com.mongodb.casbah.commons.ValidBSONType.BasicDBList | ||
import com.novus.salat._ | ||
import com.novus.salat.global._ | ||
import com.mongodb.casbah.Imports._ | ||
import com.novus.salat.annotations._ | ||
|
||
case class Registration(username: String, password: String, confirm: String, realName: String) | ||
|
||
object Registrations { | ||
val registrations = MongoConnection()("sampleapp")("registrations") | ||
|
||
def all = registrations.map(grater[Registration].asObject(_)).toList | ||
def create(registration: Registration) { | ||
registrations += grater[Registration].asDBObject(registration) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
@(registrations: List[Registration])(implicit flash: Flash) | ||
@main("Super Simple Sample") { | ||
<a href="@routes.Register.index">Register</a> | ||
@if(flash.data.contains("message")){ | ||
<div class='row'> | ||
<div class="alert alert-success" style="margin-left:30px;margin-top:20px;">@flash.get("message")</div> | ||
</div> | ||
} | ||
<div style="margin-top:20px;margin-bottom:20px;"> | ||
<a href="@routes.Register.index" class="btn btn-primary">Register</a> | ||
</div> | ||
<table class="table table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>Username</th> | ||
<th>Real Name</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@registrations.map { registration => | ||
<tr> | ||
<td>@registration.username</td> | ||
<td>@registration.realName</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} |
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
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