Permalink
Browse files

Created methods to create edit buttons for the different generated pa…

…ges.


Closes #1123
  • Loading branch information...
tuhlmann committed Sep 30, 2011
1 parent 9a0a4e8 commit c6ec24fa995994c7ae8942a9999fd24b7d762bf8
Showing with 34 additions and 6 deletions.
  1. +34 −6 persistence/proto/src/main/scala/net/liftweb/proto/ProtoUser.scala
@@ -742,11 +742,15 @@ trait ProtoUser {
def innerSignup = bind("user",
signupXhtml(theUser),
- "submit" -> SHtml.submit(S.??("sign.up"), testSignup _))
+ "submit" -> signupSubmitButton(S.??("sign.up"), testSignup _))
innerSignup
}
+ def signupSubmitButton(name: String, func: () => Any = () => {}): NodeSeq = {
+ standardSubmitButton(name, func)
+ }
+
def emailFrom = "noreply@"+S.hostName
def bccEmail: Box[String] = Empty
@@ -851,7 +855,15 @@ trait ProtoUser {
bind("user", loginXhtml,
"email" -> (FocusOnLoad(<input type="text" name="username"/>)),
"password" -> (<input type="password" name="password"/>),
- "submit" -> (<input type="submit" value={S.??("log.in")}/>))
+ "submit" -> loginSubmitButton(S.??("log.in")))
+ }
+
+ def loginSubmitButton(name: String, func: () => Any = () => {}): NodeSeq = {
+ standardSubmitButton(name, func)
+ }
+
+ def standardSubmitButton(name: String, func: () => Any = () => {}) = {
+ SHtml.submit(name, func)
}
def lostPasswordXhtml = {
@@ -932,7 +944,11 @@ trait ProtoUser {
def lostPassword = {
bind("user", lostPasswordXhtml,
"email" -> SHtml.text("", sendPasswordReset _),
- "submit" -> <input type="submit" value={S.??("send.it")} />)
+ "submit" -> lostPasswordSubmitButton(S.??("send.it")))
+ }
+
+ def lostPasswordSubmitButton(name: String, func: () => Any = () => {}): NodeSeq = {
+ standardSubmitButton(name, func)
}
def passwordResetXhtml = {
@@ -962,10 +978,14 @@ trait ProtoUser {
bind("user", passwordResetXhtml,
"pwd" -> SHtml.password_*("",(p: List[String]) =>
user.setPasswordFromListString(p)),
- "submit" -> SHtml.submit(S.??("set.password"), finishSet _))
+ "submit" -> resetPasswordSubmitButton(S.??("set.password"), finishSet _))
case _ => S.error(S.??("password.link.invalid")); S.redirectTo(homePage)
}
+ def resetPasswordSubmitButton(name: String, func: () => Any = () => {}): NodeSeq = {
+ standardSubmitButton(name, func)
+ }
+
def changePasswordXhtml = {
(<form method="post" action={S.uri}>
<table><tr><td colspan="2">{S.??("change.password")}</td></tr>
@@ -996,7 +1016,11 @@ trait ProtoUser {
bind("user", changePasswordXhtml,
"old_pwd" -> SHtml.password("", s => oldPassword = s),
"new_pwd" -> SHtml.password_*("", LFuncHolder(s => newPassword = s)),
- "submit" -> SHtml.submit(S.??("change"), testAndSet _))
+ "submit" -> changePasswordSubmitButton(S.??("change"), testAndSet _))
+ }
+
+ def changePasswordSubmitButton(name: String, func: () => Any = () => {}): NodeSeq = {
+ standardSubmitButton(name, func)
}
def editXhtml(user: TheUserType) = {
@@ -1042,11 +1066,15 @@ trait ProtoUser {
}
def innerEdit = bind("user", editXhtml(theUser),
- "submit" -> SHtml.submit(S.??("edit"), testEdit _))
+ "submit" -> editSubmitButton(S.??("edit"), testEdit _))
innerEdit
}
+ def editSubmitButton(name: String, func: () => Any = () => {}): NodeSeq = {
+ standardSubmitButton(name, func)
+ }
+
def logout = {
logoutCurrentUser
S.redirectTo(homePage)

0 comments on commit c6ec24f

Please sign in to comment.