Add attachments for PR reviews (#16075)

* First step for multiple dropzones per page.

* Allow attachments on review comments.

* Lint.

* Fixed accidental initialize of the review textarea.

* Initialize SimpleMDE textarea.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
KN4CK3R 2021-06-15 03:12:33 +02:00 committed by GitHub
parent 0adcea9ba6
commit ebf253b841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 87 additions and 47 deletions

View file

@ -15,6 +15,11 @@
<div class="ui field">
<textarea name="content" tabindex="0" rows="2" placeholder="{{$.i18n.Tr "repo.diff.review.placeholder"}}"></textarea>
</div>
{{if .IsAttachmentEnabled}}
<div class="field">
{{template "repo/upload" .}}
</div>
{{end}}
<div class="ui divider"></div>
<button type="submit" name="type" value="approve" {{ if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID) }} disabled {{ end }} class="ui submit green tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.approve"}}</button>
<button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{$.i18n.Tr "repo.diff.review.comment"}}</button>

View file

@ -26,7 +26,6 @@
</div>
</div>
<div class="field">
<div class="files"></div>
{{template "repo/upload" .}}
</div>
{{template "repo/editor/commit_form" .}}

View file

@ -14,7 +14,6 @@
</div>
{{if .IsAttachmentEnabled}}
<div class="field">
<div class="files"></div>
{{template "repo/upload" .}}
</div>
{{end}}

View file

@ -197,7 +197,6 @@
</div>
{{if .IsAttachmentEnabled}}
<div class="field">
<div class="comment-files"></div>
{{template "repo/upload" .}}
</div>
{{end}}

View file

@ -449,6 +449,9 @@
<span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
{{end}}
</div>
{{if .Attachments}}
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
{{end}}
</div>
</div>
</div>

View file

@ -76,7 +76,6 @@
{{end}}
{{if .IsAttachmentEnabled}}
<div class="field">
<div class="files"></div>
{{template "repo/upload" .}}
</div>
{{end}}

View file

@ -1,6 +1,5 @@
<div
class="ui dropzone"
id="dropzone"
data-link-url="{{.UploadLinkUrl}}"
data-upload-url="{{.UploadUrl}}"
data-remove-url="{{.UploadRemoveUrl}}"
@ -11,4 +10,6 @@
data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}"
data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}"
data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"
></div>
>
<div class="files"></div>
</div>