Skip to content

Commit b869dfd

Browse files
committed
Fixes #494
1 parent ab9c897 commit b869dfd

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

validation/forms.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,24 @@ class EditIssueWithPhrase(forms.ModelForm):
191191
transcription = forms.CharField(
192192
max_length=412,
193193
required=False,
194-
widget=forms.Textarea(attrs={"class": "form-control"}),
194+
widget=forms.Textarea(attrs={"class": "form-control", "rows": 4}),
195195
)
196196

197197
translation = forms.CharField(
198198
max_length=412,
199199
required=False,
200-
widget=forms.Textarea(attrs={"class": "form-control"}),
200+
widget=forms.Textarea(attrs={"class": "form-control", "rows": 4}),
201+
)
202+
203+
comment = forms.CharField(
204+
max_length=2048,
205+
required=False,
206+
widget=forms.Textarea(attrs={"class": "form-control", "rows": 4}),
201207
)
202208

203209
class Meta:
204210
model = Phrase
205-
fields = ["transcription", "translation"]
211+
fields = ["transcription", "translation", "comment"]
206212

207213

208214
class RecordNewPhrase(forms.ModelForm):

validation/jinja2/validation/view_issue_detail.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,15 @@ <h3>Current Information</h3>
8080
</section>
8181

8282
<section style="flex: 1">
83-
<h3>Updates</h3>
8483
{% if form %}
8584
<form action="" method="POST">
85+
<div class="d-flex justify-content-between">
86+
<h3 class="float-start">Updates</h3>
8687
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
88+
<input data-cy="save-button" type="submit" class="button button--success float-end float-right" value="Resolve issue and return to list">
89+
</div>
90+
<br />
8791
{{ form }}
88-
<input data-cy="save-button" type="submit" class="button button--success" value="Resolve issue and return to list">
8992
</form>
9093
{% endif %}
9194
</section>

validation/views.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,11 @@ def entries(request, language):
239239
else:
240240
all_phrases = all_phrases.filter(status=mode)
241241

242-
all_phrases = all_phrases.prefetch_related("recording_set__speaker")
242+
all_phrases = (
243+
all_phrases.prefetch_related("recording_set__speaker")
244+
.annotate(total_recordings=Count("recording", distinct=True))
245+
.filter(total_recordings__gt=0)
246+
)
243247

244248
sessions = (
245249
RecordingSession.objects.order_by("id").values("id", "date").distinct()
@@ -370,6 +374,8 @@ def search_phrases(request, language):
370374
.exclude(status=Phrase.USER)
371375
.filter(language=language_object)
372376
.prefetch_related("recording_set__speaker")
377+
.annotate(total_recordings=Count("recording", distinct=True))
378+
.filter(total_recordings__gt=0)
373379
)
374380
all_matches = list(all_matches)
375381
all_matches.sort(key=lambda phrase: phrase.transcription)
@@ -998,11 +1004,15 @@ def view_issue_detail(request, language, issue_id):
9981004
translation_initial = issue.target_language_suggestion
9991005
if not translation_initial:
10001006
translation_initial = issue.phrase.translation
1007+
comment_initial = issue.phrase.comment
1008+
if not comment_initial:
1009+
comment_initial = issue.comment
10011010

10021011
form = EditIssueWithPhrase(
10031012
initial={
10041013
"transcription": transcription_initial,
10051014
"translation": translation_initial,
1015+
"comment": comment_initial,
10061016
}
10071017
)
10081018

0 commit comments

Comments
 (0)