object PartsListController extends Controller{
val Home = Redirect(routes.PartsListController.index(0,0,"",""))
- val Home2 = Redirect(routes.PartsListController.relationRegistration())
+ val Home2 = Redirect(routes.PartsListController.relationRegistration(""))
val relationForm = Form(
mapping(
"parent" -> nonEmptyText,
Ok(views.html.uppartslistshow(partBuffer.drop(page*row).take(row), opt, page, partBuffer.size, key))
}
- def createRelation(parent:String) = Action {implicit request =>
- Ok(views.html.createRelationForm(relationForm.fill(new PartsListBean(parent, "", 0, "")),""))
+ def createRelation(parent:String, child:String, project:String) = Action {implicit request =>
+ Ok(views.html.createRelationForm(relationForm.fill(new PartsListBean(parent, child, 0, "")),project, ""))
}
def updateRelation(parentNo:String, childNo:String, project:String) = Action { implicit request =>
}
}
- def relationRegistration() = Action { implicit request =>
+ def relationRegistration(project:String) = Action { implicit request =>
relationForm.bindFromRequest.fold(
- formWithErrors => BadRequest(views.html.createRelationForm(formWithErrors, "")),
+ formWithErrors => BadRequest(views.html.createRelationForm(formWithErrors, "", "")),
data => {
inTransaction {
val message = PartRelationManager().insert(data, null, 0)
if( message == null) {
- Home.flashing("success" -> "Relation %s has been created".format(data.parent))
+ if(project=="") {
+ Home.flashing("success" -> "Relation %s has been created".format(data.parent))
+ } else {
+ Redirect(routes.PartsListController.matrixPartList(project))
+ }
} else {
- Ok(views.html.createRelationForm(relationForm.fill(data), message))
+ Ok(views.html.createRelationForm(relationForm.fill(data), "", message))
}
}
}
-@(relationForm: Form[beans.PartsListBean], error:String)(implicit lang: Lang)
+@(relationForm: Form[beans.PartsListBean], project:String, error:String)(implicit lang: Lang)
@import helper._
@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.f) }
@main("Create relation by Play 2.1") {
<h1>@Messages("title2")</h1>
@Messages(error)
- @form(routes.PartsListController.relationRegistration()) {
+ @form(routes.PartsListController.relationRegistration(project)) {
<fieldset>
@inputText(relationForm("parent"), '_label -> Messages("list.header1"), 'readonly -> "readonly")
@inputText(relationForm("child"), '_label -> Messages("list.header2"))
GET /partModify controllers.PartsMasterController.update(id:Long)
POST /partSave controllers.PartsMasterController.partRegistration()
POST /partModification controllers.PartsMasterController.partModification(id:Long)
-GET /relationCreate controllers.PartsListController.createRelation(parent:String)
-POST /relationSave controllers.PartsListController.relationRegistration
+GET /relationCreate controllers.PartsListController.createRelation(parent:String, child:String, project:String)
+POST /relationSave controllers.PartsListController.relationRegistration(projeect:String)
GET /relationUpdate controllers.PartsListController.updateRelation(parent:String, child:String, project:String)
POST /relationChange controllers.PartsListController.relationUpdate(childName:String, project:String)
GET /designChangeCoverForm controllers.DesignChangeController.create