effective_bootstrap 0.11.1 → 0.11.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b431b1f3e7adc1ea92ceb9946b973f1b70c38cf25182d24942871527db67247
|
4
|
+
data.tar.gz: 1bd6e459a769f553967f7f91bae9b8c125f91aaa274b08e32333bee8424b7ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2884964c49192265300a9cf6ec09e182995e2a67dcfbcec170bf17c0a2736d9351368809c5136afd410e271241c2f85149a7508e5f28324211aa3f86e821b5d
|
7
|
+
data.tar.gz: f5745093c35b40bfe4fe83f0a1ac09a6fe10628f91401728353d75e0b198ce0b52fca611fabbe68934a9841c693daceafbce2ed4e158b1385b5e7a4cf167e42d
|
@@ -1,19 +1,45 @@
|
|
1
1
|
# https://imperavi.com/article/
|
2
2
|
|
3
|
+
sendMarkPublicRequest = (editor, blob, authenticity_token) ->
|
4
|
+
editor.ajax.post(
|
5
|
+
url: "/storage/#{blob.signed_id}/mark_public",
|
6
|
+
data: {
|
7
|
+
id: blob.signed_id,
|
8
|
+
authenticity_token: authenticity_token
|
9
|
+
}
|
10
|
+
)
|
11
|
+
|
3
12
|
uploadActiveStorage = (editor, data) ->
|
4
13
|
rails_url = '/rails/active_storage/blobs/redirect/'
|
5
14
|
|
15
|
+
# The editor is actually the popup form
|
16
|
+
$form = editor.$element.closest('form')
|
17
|
+
|
18
|
+
if $form.length == 0
|
19
|
+
$form = editor.$element.closest('.arx-popup')
|
20
|
+
|
21
|
+
permission_public = $form.find("input[name=public_permission]").val() || false
|
22
|
+
|
23
|
+
# This is an effective_form with the article editor in it
|
24
|
+
$parentForm = editor.app.$element.closest('form')
|
25
|
+
authenticity_token = $parentForm.find("input[name=authenticity_token]").val() || 'missing authenticity token'
|
26
|
+
|
27
|
+
# Attachment classes
|
28
|
+
classes = (if permission_public then 'effective-article-editor-attachment effective-article-editor-attachment-permission-public' else 'effective-article-editor-attachment')
|
29
|
+
|
6
30
|
for file in data.files
|
7
31
|
upload = new ActiveStorage.DirectUpload(file, '/rails/active_storage/direct_uploads')
|
8
32
|
|
9
33
|
upload.create (error, blob) =>
|
34
|
+
sendMarkPublicRequest(editor, blob, authenticity_token) if permission_public
|
35
|
+
|
10
36
|
url = rails_url + blob.signed_id + '/' + blob.filename
|
11
37
|
editor.complete({ file: { url: url, name: blob.filename, content_type: blob.content_type }}, data.e)
|
12
38
|
|
13
39
|
# We append this nested attachment html
|
14
40
|
attachment = $('<action-text-attachment>')
|
15
41
|
.attr('sgid', blob.attachable_sgid)
|
16
|
-
.attr('class',
|
42
|
+
.attr('class', classes)
|
17
43
|
|
18
44
|
attachment = $('<div>').append(attachment).html()
|
19
45
|
|
@@ -22,12 +48,12 @@ uploadActiveStorage = (editor, data) ->
|
|
22
48
|
doc
|
23
49
|
.find("img[src^='#{rails_url}']:not(.effective-article-editor-attachment)")
|
24
50
|
.after(attachment)
|
25
|
-
.addClass(
|
51
|
+
.addClass(classes)
|
26
52
|
|
27
53
|
doc
|
28
54
|
.find("a[data-file][data-name='#{file.name}']:not(.action-text-attachment)")
|
29
55
|
.after(attachment)
|
30
|
-
.addClass(
|
56
|
+
.addClass(classes)
|
31
57
|
.removeAttr('data-file')
|
32
58
|
.removeAttr('data-name')
|
33
59
|
|
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: 0.11.
|
4
|
+
version: 0.11.2
|
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: 2022-08-
|
11
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|