Skip to content

Commit cc8ec4c

Browse files
committed
refs #2867 Disabled drag&drop input for Attach field
1 parent 8a786ba commit cc8ec4c

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

public/css/orchid.rtl.css

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/orchid.rtl.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/orchid.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/orchid.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/vendor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/vendor.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/controllers/attach_controller.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export default class extends ApplicationController {
5656
this.togglePlaceholderShow();
5757

5858
new Sortable(this.element.querySelector('.sortable-dropzone'), {
59+
disabled: this.filesTarget.disabled === true || this.filesTarget.readonly === true,
60+
filter: ".attach-file-uploader",
61+
draggable:'.pip',
5962
animation: 150,
6063
onEnd: () => {
6164
this.reorderElements();
@@ -155,7 +158,7 @@ export default class extends ApplicationController {
155158
*/
156159
togglePlaceholderShow() {
157160
this.containerTarget.classList.toggle('d-none', this.attachmentValue.length >= this.countValue);
158-
this.filesTarget.disabled = this.attachmentValue.length > 0;
161+
this.filesTarget.disabled = this.attachmentValue.length >= this.countValue;
159162

160163

161164
// Disable the nullable field if there is at least one valid value and the count equals 1.

resources/views/fields/attach.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class="attach"
2424
"
2525
>
2626
<div data-target="attach.preview" class="row row-cols-4 row-cols-lg-6 gy-3 sortable-dropzone">
27-
<div class="col order-last" data-attach-target="container">
27+
<div class="col order-last attach-file-uploader" data-attach-target="container">
2828
<label for="{{$id}}" class="border rounded bg-light attach-image-placeholder pointer-event h-100">
2929
<input class="form-control d-none"
3030
type="file"
@@ -50,7 +50,7 @@ class="attach"
5050
</div>
5151

5252

53-
<template data-target="attach.template">
53+
<template data-attach-target="template">
5454
<div class="pip col position-relative">
5555
<input type="hidden" name="{name}" value="{id}">
5656

0 commit comments

Comments
 (0)