mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-10-31 02:25:59 +01:00 
			
		
		
		
	Implementing label editing form.
This commit is contained in:
		| @@ -3,6 +3,7 @@ package app | ||||
| import jp.sf.amateras.scalatra.forms._ | ||||
| import service._ | ||||
| import util.WritableRepositoryAuthenticator | ||||
| import org.scalatra._ | ||||
|  | ||||
| class LabelsController extends LabelsControllerBase | ||||
|   with LabelsService with RepositoryService with AccountService with WritableRepositoryAuthenticator | ||||
| @@ -12,12 +13,17 @@ trait LabelsControllerBase extends ControllerBase { | ||||
|  | ||||
|   case class LabelForm(labelName: String, color: String) | ||||
|  | ||||
|   val labelForm = mapping( | ||||
|   val newForm = mapping( | ||||
|     "newLabelName" -> trim(label("Label name", text(required, maxlength(100)))), | ||||
|     "newColor"     -> trim(label("Color",      text(required, maxlength(7)))) | ||||
|   )(LabelForm.apply) | ||||
|  | ||||
|   post("/:owner/:repository/issues/label/new", labelForm)(writableRepository { form => | ||||
|   val editForm = mapping( | ||||
|     "editLabelName" -> trim(label("Label name", text(required, maxlength(100)))), | ||||
|     "editColor"     -> trim(label("Color",      text(required, maxlength(7)))) | ||||
|   )(LabelForm.apply) | ||||
|  | ||||
|   post("/:owner/:repository/issues/label/new", newForm)(writableRepository { form => | ||||
|     val owner      = params("owner") | ||||
|     val repository = params("repository") | ||||
|  | ||||
| @@ -37,4 +43,14 @@ trait LabelsControllerBase extends ControllerBase { | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   post("/:owner/:repository/issues/label/:labelId/edit", editForm)(writableRepository { form => | ||||
|     val owner      = params("owner") | ||||
|     val repository = params("repository") | ||||
|     val labelId    = params("labelId").toInt | ||||
|  | ||||
| //    createLabel(owner, repository, form.labelName, form.color.substring(1)) | ||||
| // | ||||
|     Ok("label updated.") | ||||
|   }) | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user