Skip to content

Commit

Permalink
Merge pull request #230 from sumandari/229_fix_comment_textholder
Browse files Browse the repository at this point in the history
fixed comment placeholder text
  • Loading branch information
sumandari authored Jan 13, 2022
2 parents 9debebd + 03ff279 commit 418281c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
16 changes: 12 additions & 4 deletions qgis-app/base/forms/processing_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ class ResourceBaseReviewForm(forms.Form):
APPROVAL_OPTIONS = [('approve', 'Approve'), ('reject', 'Reject')]
approval = forms.ChoiceField(required=True, choices=APPROVAL_OPTIONS,
widget=forms.RadioSelect, initial='approve')
comment = forms.CharField(widget=forms.Textarea(
attrs={'placeholder': _('Please provide clear feedback if you decided '
'to not approve this GeoPackage.'),
'rows': "5"}))
comment = forms.CharField()

def __init__(self, *args, **kwargs):
self.resource_name = kwargs.pop('resource_name', 'resource')
super(ResourceBaseReviewForm, self).__init__(*args, **kwargs)
self.fields['comment'].widget = forms.Textarea(
attrs={
'placeholder': _(
'Please provide clear feedback if you decided to not '
'approve this %s.') % self.resource_name,
'rows': "5"})



class ResourceBaseSearchForm(forms.Form):
Expand Down
4 changes: 3 additions & 1 deletion qgis-app/base/views/processing_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ def get_context_data(self, **kwargs):
.username
context['reviewer'] = reviewer
if user.is_staff or is_resources_manager(user):
context['form'] = ResourceBaseReviewForm()
context['form'] = ResourceBaseReviewForm(
resource_name=self.resource_name
)
if self.is_3d_model:
context['url_viewer'] = "%s_viewer" % self.resource_name_url_base
return context
Expand Down
13 changes: 13 additions & 0 deletions qgis-app/layerdefinitions/tests/test_forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.test import TestCase

from base.forms.processing_forms import ResourceBaseReviewForm


class TestFormResourceBaseReviewForm(TestCase):
def test_review_form_comment_includes_resource_name(self):
form = ResourceBaseReviewForm(resource_name='test resource')
self.assertIn(
'placeholder="Please provide clear feedback if you decided to not '
'approve this test resource." required id="id_comment"',
form.as_table()
)

0 comments on commit 418281c

Please sign in to comment.