@(js: String => String, contactForm: Form[Contact])(implicit request: play.api.mvc.Request[AnyContent])
@import helper._
@import helper.twitterBootstrap._
@title = {
Add a new contact Or edit an existing contact
}
@phoneField(field: Field, className: String = "phone") = {
@input(field, '_label -> "Phone numbers", '_class -> className) { (id, name, value, _) =>
Remove
}
}
@informationGroup(field: Field, className: String = "profile") = {
Remove this profile
@inputText(
field("label"),
'_label -> "Label"
)
@inputText(
field("email"),
'_label -> "Email"
)
@repeat(field("phones"), min = 0) { phone =>
@phoneField(phone)
}
@**
* Keep an hidden block that will be used as template for Javascript copy code
**@
@phoneField(
field("phones[x]"),
className = "phone_template"
)
}
@main(title, nav = "contact") {
@if(contactForm.hasErrors) {
Oops Please fix all errors
}
@helper.form(action = routes.Contacts.submit, args = 'id -> "contactForm") {
General informations
@inputText(
contactForm("firstname"),
'_label -> "First name"
)
@inputText(
contactForm("lastname"),
'_label -> "Last name"
)
@inputText(
contactForm("company"),
'_label -> "Company"
)
Profiles
@repeat(contactForm("informations")) { information =>
@informationGroup(information)
}
@**
* Keep an hidden block that will be used as template for Javascript copy code
**@
@informationGroup(
contactForm("informations[x]"),
className = "profile_template"
)
}
}