effective_bootstrap 1.21.16 → 1.21.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective_article_editor/initialize.js.coffee +5 -0
- data/app/assets/javascripts/effective_file/initialize.js.coffee +40 -1
- data/app/assets/stylesheets/effective_file/input.scss +10 -0
- data/app/models/effective/form_inputs/article_editor.rb +1 -1
- data/app/models/effective/form_inputs/file_field.rb +4 -2
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 64de3114cb44191a5ad9d4b30dd1f833896acad490d49fc8dc271fabf0150480
|
|
4
|
+
data.tar.gz: 1b605eb69132875095ac0931af2f9258081c8eb498a4c0f6e60ecfe27aa341ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9303be0c0fc5e730e3bbdcadbc3c948ba9eb4484057368b567ffbb7c0cc560634a14720d33c1eafa55116e54c161c0a65d9b2af99e1fe2c27df2e84c3abad41
|
|
7
|
+
data.tar.gz: b2b0a1be778d7865f3d37779ff029c936690af09a0645f427d54a150afafbda5474da64cc425be4057898f233c1dd0d495499ed410e54928eec004c5e3c3c3bc
|
|
@@ -50,6 +50,11 @@ uploadActiveStorage = (editor, data) ->
|
|
|
50
50
|
.after(attachment)
|
|
51
51
|
.addClass(classes)
|
|
52
52
|
|
|
53
|
+
doc
|
|
54
|
+
.find("img[data-hover-src^='#{rails_url}']:not(.effective-article-editor-hover-attachment)")
|
|
55
|
+
.after(attachment)
|
|
56
|
+
.addClass('effective-article-editor-hover-attachment')
|
|
57
|
+
|
|
53
58
|
doc
|
|
54
59
|
.find("a[data-file][data-name='#{file.name}']:not(.action-text-attachment)")
|
|
55
60
|
.after(attachment)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
$(document).on 'direct-upload:initialize', (event) ->
|
|
2
2
|
$target = $(event.target)
|
|
3
3
|
template = $target.data('progress-template').replace('$ID$', event.detail.id).replace('$FILENAME$', event.detail.file.name)
|
|
4
|
-
$target.siblings('.uploads').append(template)
|
|
4
|
+
$target.closest('.effective-file-drop-zone').siblings('.uploads').append(template)
|
|
5
5
|
|
|
6
6
|
$(document).on 'direct-upload:start', (event) ->
|
|
7
7
|
$("[data-direct-upload-id=#{event.detail.id}]").removeClass('direct-upload--pending')
|
|
@@ -28,3 +28,42 @@ $(document).on 'direct-upload:end', (event) ->
|
|
|
28
28
|
|
|
29
29
|
$(document).on 'change', "input[type='file'][data-click-submit]", (event) ->
|
|
30
30
|
$(event.currentTarget).closest('form').find('button[type=submit],input[type=submit]').first().click()
|
|
31
|
+
|
|
32
|
+
# Drag-and-drop support for file inputs
|
|
33
|
+
$(document).on 'dragover', '.effective-file-drop-zone', (event) ->
|
|
34
|
+
event.preventDefault()
|
|
35
|
+
event.originalEvent.dataTransfer.dropEffect = 'copy'
|
|
36
|
+
|
|
37
|
+
$(document).on 'dragenter', '.effective-file-drop-zone', (event) ->
|
|
38
|
+
event.preventDefault()
|
|
39
|
+
$zone = $(event.currentTarget)
|
|
40
|
+
count = ($zone.data('drag-count') || 0) + 1
|
|
41
|
+
$zone.data('drag-count', count)
|
|
42
|
+
$zone.addClass('drag-over')
|
|
43
|
+
|
|
44
|
+
$(document).on 'dragleave', '.effective-file-drop-zone', (event) ->
|
|
45
|
+
event.preventDefault()
|
|
46
|
+
$zone = $(event.currentTarget)
|
|
47
|
+
count = ($zone.data('drag-count') || 0) - 1
|
|
48
|
+
$zone.data('drag-count', count)
|
|
49
|
+
$zone.removeClass('drag-over') if count <= 0
|
|
50
|
+
|
|
51
|
+
$(document).on 'drop', '.effective-file-drop-zone', (event) ->
|
|
52
|
+
event.preventDefault()
|
|
53
|
+
$zone = $(event.currentTarget)
|
|
54
|
+
$zone.removeClass('drag-over').data('drag-count', 0)
|
|
55
|
+
|
|
56
|
+
$input = $zone.find('input[type=file]')
|
|
57
|
+
return if $input.prop('disabled') || $input.prop('readonly')
|
|
58
|
+
|
|
59
|
+
files = event.originalEvent.dataTransfer.files
|
|
60
|
+
return unless files.length > 0
|
|
61
|
+
|
|
62
|
+
if $input.prop('multiple')
|
|
63
|
+
$input[0].files = files
|
|
64
|
+
else
|
|
65
|
+
dt = new DataTransfer()
|
|
66
|
+
dt.items.add(files[0])
|
|
67
|
+
$input[0].files = dt.files
|
|
68
|
+
|
|
69
|
+
$input.trigger('change')
|
|
@@ -43,6 +43,16 @@ table.effective_file_attachments {
|
|
|
43
43
|
img { max-width: 128px; max-height: 128px;}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.effective-file-drop-zone {
|
|
47
|
+
position: relative;
|
|
48
|
+
|
|
49
|
+
&.drag-over input.form-control-file {
|
|
50
|
+
border-color: $primary;
|
|
51
|
+
border-style: dashed;
|
|
52
|
+
background-color: rgba($primary, 0.05);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
input.form-control-file {
|
|
47
57
|
border: solid 1px;
|
|
48
58
|
padding: 1rem 0 1rem 1rem !important;
|
|
@@ -101,7 +101,7 @@ module Effective
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
outset: false, # tricky to design around
|
|
104
|
-
plugins: ['blockcode', 'carousel', 'cellcolor', 'collapse', 'filelink', 'imageposition', 'imageresize', 'inlineformat', 'listitem', 'makebutton', 'removeformat', 'reorder', 'style'],
|
|
104
|
+
plugins: ['blockcode', 'carousel', 'cellcolor', 'collapse', 'filelink', 'imagehover', 'imageposition', 'imageresize', 'inlineformat', 'listitem', 'makebutton', 'removeformat', 'reorder', 'style'],
|
|
105
105
|
|
|
106
106
|
quote: {
|
|
107
107
|
template: '<blockquote class="blockquote text-center"><p class="mb-0"><strong>A well-known quote, contained in a blockquote element.</strong></p></blockquote>'
|
|
@@ -142,13 +142,15 @@ module Effective
|
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
def build_uploads_and_purge(super_file_field)
|
|
145
|
+
wrapped_input = content_tag(:div, super_file_field, class: 'effective-file-drop-zone')
|
|
146
|
+
|
|
145
147
|
if purge? && attachments_present?
|
|
146
148
|
content_tag(:div) do
|
|
147
|
-
content_tag(:div, (build_uploads +
|
|
149
|
+
content_tag(:div, (build_uploads + wrapped_input), class: 'mb-3') +
|
|
148
150
|
content_tag(:div, build_purge)
|
|
149
151
|
end
|
|
150
152
|
else
|
|
151
|
-
build_uploads +
|
|
153
|
+
build_uploads + wrapped_input
|
|
152
154
|
end
|
|
153
155
|
end
|
|
154
156
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_bootstrap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.21.
|
|
4
|
+
version: 1.21.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|