From 2ac6a99f5d169876bb562861899c4793bf991ceb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 04 2015 16:19:38 +0000 Subject: Move all the forms to update issues information into one Relates to http://209.132.184.222/progit/issue/48 --- diff --git a/progit/forms.py b/progit/forms.py index 2b7d125..0b47962 100644 --- a/progit/forms.py +++ b/progit/forms.py @@ -60,44 +60,20 @@ class RequestPullForm(wtf.Form): ) -class AddIssueCommentForm(wtf.Form): +class UpdateIssueForm(wtf.Form): ''' Form to add a comment to an issue. ''' - comment = wtforms.TextAreaField( - 'Comment*', - [wtforms.validators.Required()] - ) - - -class AddIssueTagForm(wtf.Form): - ''' Form to add a tag to an issue. ''' tag = wtforms.TextField( - 'tag*', - [wtforms.validators.Required()] + 'tag', [wtforms.validators.Optional()] ) - - -class AddIssueDependencyForm(wtf.Form): - ''' Form to add a blocked issue to an issue. ''' depends = wtforms.TextField( - 'dependency issue*', - [wtforms.validators.Required()] + 'dependency issue', [wtforms.validators.Optional()] ) - - -class AddPullRequestCommentForm(wtf.Form): - ''' Form to add a comment to a pull-request. ''' - commit = wtforms.HiddenField('commit identifier') - filename = wtforms.HiddenField('file changed') - row = wtforms.HiddenField('row') - requestid = wtforms.HiddenField('requestid') comment = wtforms.TextAreaField( - 'Comment*', - [wtforms.validators.Required()] + 'Comment', [wtforms.validators.Optional()] + ) + assignee = wtforms.TextAreaField( + 'Assigned to', [wtforms.validators.Optional()] ) - - -class UpdateIssueStatusForm(wtf.Form): - ''' Form to update the status of an issue. ''' status = wtforms.SelectField( 'Status', [wtforms.validators.Required()], @@ -109,13 +85,25 @@ class UpdateIssueStatusForm(wtf.Form): uses the list of collection provided to fill the choices of the drop-down list. """ - super(UpdateIssueStatusForm, self).__init__(*args, **kwargs) + super(UpdateIssueForm, self).__init__(*args, **kwargs) if 'status' in kwargs: self.status.choices = [ (status, status) for status in kwargs['status'] ] +class AddPullRequestCommentForm(wtf.Form): + ''' Form to add a comment to a pull-request. ''' + commit = wtforms.HiddenField('commit identifier') + filename = wtforms.HiddenField('file changed') + row = wtforms.HiddenField('row') + requestid = wtforms.HiddenField('requestid') + comment = wtforms.TextAreaField( + 'Comment*', + [wtforms.validators.Required()] + ) + + class ProjectSettingsForm(wtf.Form): ''' Form to update the settings of a project. ''' issue_tracker = wtforms.BooleanField(