Skip to content

Commit

Permalink
Fixed localForm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Nelson committed Nov 23, 2010
1 parent 6f4587b commit 85102dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/main/scala/code/lib/ProtoUser.scala
Expand Up @@ -57,7 +57,6 @@ trait ProtoUser[T <: ProtoUser[T]] extends MongoRecord[T] with MongoId[T] {
super.validations
}


object locale extends LocaleField(this) {
override def displayName = ??("locale")
}
Expand Down Expand Up @@ -708,7 +707,6 @@ trait MetaMegaProtoUser[ModelType <: MegaProtoUser[ModelType]] extends MongoMeta
flatMap(f =>
f.toForm.toList.map(form =>
(<tr><td>{f.displayName}</td><td>{form}</td></tr>) ) )

}

protected def wrapIt(in: NodeSeq): NodeSeq =
Expand Down
19 changes: 9 additions & 10 deletions src/main/scala/code/model/User.scala
Expand Up @@ -18,9 +18,8 @@ object User extends User with MetaMegaProtoUser[User] {
override def collectionName = "users" // define the MongoDB collection name
override def screenWrap = Full(<lift:surround with="default" at="content">
<lift:bind /></lift:surround>)
// comment this line out to require email validations
//override def skipEmailValidation = true

//override def skipEmailValidation = true // uncomment this line to skip email validations

override def localForm(user: User, ignorePassword: Boolean): NodeSeq = {
/* This doesn't work either
for {
Expand All @@ -29,15 +28,15 @@ object User extends User with MetaMegaProtoUser[User] {
<tr><td>{f.displayName}</td><td>{f.toForm}</td></tr>
*/
val formXhtml: NodeSeq = {
<tr><td>{user.firstName.toForm}</td></tr>
<tr><td>{user.lastName.toForm}</td></tr>
<tr><td>{user.email.toForm}</td></tr>
<tr><td>{user.locale.toForm}</td></tr>
<tr><td>{user.timezone.toForm}</td></tr>
<tr><td>{user.firstName.displayName}</td><td>{user.firstName.toForm openOr Text("")}</td></tr>
<tr><td>{user.lastName.displayName}</td><td>{user.lastName.toForm openOr Text("")}</td></tr>
<tr><td>{user.email.displayName}</td><td>{user.email.toForm openOr Text("")}</td></tr>
<tr><td>{user.locale.displayName}</td><td>{user.locale.toForm openOr Text("")}</td></tr>
<tr><td>{user.timezone.displayName}</td><td>{user.timezone.toForm openOr Text("")}</td></tr>
}

if (!ignorePassword)
formXhtml ++ <tr><td>{user.password.toForm}</td></tr>
formXhtml ++ <tr><td>{user.password.displayName}</td><td>{user.password.toForm openOr Text("")}</td></tr>
else
formXhtml
}
Expand All @@ -46,7 +45,7 @@ object User extends User with MetaMegaProtoUser[User] {
/**
* A "User" class that includes first name, last name, password
*/
class User extends MegaProtoUser[User] {
class User extends MegaProtoUser[User] {
def meta = User // what's the "meta" server
}

Expand Down

0 comments on commit 85102dc

Please sign in to comment.