"atach" -> mapping(
"grpName" -> text
)(AtachForm.apply)(AtachForm.unapply),
- "projectName" -> nonEmptyText
+ "projectName" -> nonEmptyText,
+ "cost" -> longNumber
)(PartForm.apply)(PartForm.unapply)
)
- def create = Action { implicit request =>
- Ok(views.html.createPartForm(partRegistForm))
- }
+ def create = AuthAction {
+ Action { implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ Ok(views.html.createPartForm(partRegistForm))
+ }
+ }
+ }
def partRegistration() = Action(parse.multipartFormData) { implicit request =>
partRegistForm.bindFromRequest.fold(
)
}
- def update(id:Long) = Action { implicit request =>
- inTransaction {
- val part = PartManager().getById(id)
- val partForm = PartForm(part.name, null, part.project.assign(part.project.head).name)
- Ok(views.html.updatePartForm(partRegistForm.fill(partForm), id, part))
+ def update(id:Long) = AuthAction {
+ Action { implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ inTransaction {
+ val part = PartManager().getById(id)
+ val partForm = PartForm(part.name, null, part.project.assign(part.project.head).name, part.price)
+ Ok(views.html.updatePartForm(partRegistForm.fill(partForm), id, part))
+ }
+ }
}
}
)
}
- def partDelete(id:Long) = Action {
- inTransaction {
- PartManager().delete(id)
- Home.flashing("success" -> "Part %s has been created".format(id))
+ def partDelete(id:Long) = AuthAction {
+ Action {implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ inTransaction {
+ PartManager().delete(id)
+ Home.flashing("success" -> "Part %s has been created".format(id))
+ }
+ }
}
}