diff --git a/community/forms.py b/community/forms.py index e75f05de..aae59b1b 100644 --- a/community/forms.py +++ b/community/forms.py @@ -192,3 +192,26 @@ class GSOCStudent(forms.Form): label='Personal Image URL', required=False, widget=forms.URLInput(attrs={'autocomplete': 'off'}) ) + + +class AssignIssue(forms.Form): + user = forms.CharField( + max_length=50, label='GitHub Username', + widget=forms.TextInput(attrs={'autocomplete': 'off'}) + ) + hoster = forms.ChoiceField( + choices=[('github', 'GitHub'), ('gitlab', 'GitLab')], label='Hoster' + ) + repository_url = forms.URLField( + label='Repository URL', + help_text='For example, https://github.com/org/repo_name/', + widget=forms.URLInput(attrs={'autocomplete': 'off'}) + ) + issue_number = forms.IntegerField( + label='Issue Number', + widget=forms.NumberInput(attrs={'autocomplete': 'off'}) + ) + requested_user = forms.CharField( + max_length=50, label='GitHub Username', + widget=forms.TextInput(attrs={'autocomplete': 'off', 'hidden': True}) + ) diff --git a/community/views.py b/community/views.py index 2ab3b644..654c4bf6 100644 --- a/community/views.py +++ b/community/views.py @@ -18,6 +18,7 @@ CommunityEvent, OrganizationMentor, GSOCStudent, + AssignIssue ) from data.models import Team from gamification.models import Participant as GamificationParticipant @@ -48,6 +49,14 @@ def initialize_org_context_details(): return org_details +def get_assign_issue_form_variables(context): + context['assign_issue_form'] = AssignIssue() + context['assign_issue_form_name'] = os.environ.get( + 'ISSUES_ASSIGN_REQUEST_FORM_NAME', None + ) + return context + + def get_gsoc_student_form_variables(context): context['gsoc_student_form'] = GSOCStudent() context['gsoc_student_form_name'] = os.environ.get( @@ -85,6 +94,7 @@ def get_all_community_forms(context): context = get_community_event_form_variables(context) context = get_community_mentor_form_variables(context) context = get_gsoc_student_form_variables(context) + context = get_assign_issue_form_variables(context) return context diff --git a/static/js/forms.js b/static/js/forms.js index 2f5d2ed8..d6543060 100644 --- a/static/js/forms.js +++ b/static/js/forms.js @@ -18,7 +18,7 @@ $(document).ready(function () { var is_user_authenticated = Cookies.get('authenticated'); var authenticated_username = Cookies.get('username'); - var username_input = $('[name=user]'); + var username_input = $('[name$=user]'); username_input.attr('value', authenticated_username || 'Anonymous User'); username_input.attr('disabled', true); @@ -86,7 +86,7 @@ $(document).ready(function () { display_form_or_error(mentor_students_form); }); - $(':input').focusin(function () { + $('.community-form :input').focusin(function () { if (is_user_authenticated===undefined && authenticated_username===undefined) { $('.community-form').css('display', 'none'); diff --git a/templates/community_forms.html b/templates/community_forms.html index 5e6046b8..58f4bf88 100644 --- a/templates/community_forms.html +++ b/templates/community_forms.html @@ -209,3 +209,57 @@