card-mod-carrierwave 0.14.2 → 0.15.0
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/assets/script/upload.js.coffee +72 -0
- data/assets/style/file.scss +30 -0
- data/data/files/favicon/image-icon.png +0 -0
- data/data/files/favicon/image-large.png +0 -0
- data/data/files/favicon/image-medium.png +0 -0
- data/data/files/favicon/image-original.png +0 -0
- data/data/files/favicon/image-small.png +0 -0
- data/data/files/favicon.png +0 -0
- data/data/files/file1.txt +1 -0
- data/data/files/file2.txt +1 -0
- data/data/files/file3.txt +1 -0
- data/data/files/logo/image-original.svg +1 -0
- data/data/files/logo.svg +1 -0
- data/data/files/mao2.jpg +0 -0
- data/data/files/mod_carrierwave_script_asset_output/file.js +2 -0
- data/data/files/rails.gif +0 -0
- data/data/real.yml +118 -0
- data/lib/card/mod/carrierwave.rb +6 -0
- data/lib/carrier_wave/card_mount.rb +2 -2
- data/lib/carrier_wave/test_file.rb +8 -0
- data/locales/en.yml +6 -0
- data/set/abstract/attachment.rb +15 -2
- data/set/all/file_utils.rb +6 -4
- data/set/self/admin.rb +8 -22
- data/set/self/search.rb +8 -0
- data/set/type/file/preview_editor.haml +13 -17
- data/set/type/image/html_views.rb +5 -1
- data/set/type/image.rb +6 -3
- metadata +44 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a249b3cb9824547e04d317283684d5c36e27824cf9ed6dc8b8a1754ebe00f161
|
4
|
+
data.tar.gz: 0a6b53cec1fa1132f36b0753c0b7812fbc1beb92ec5c56a9b9f3c54b7a54410a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f50f32137fd27d10eebcf066ddb08d2d3f4d9ad7e2502209985ff75986c2d4827e83488432fecba7650cc7594fb1f1bf0a277c7ee5017c1c1419ce7a8b563136
|
7
|
+
data.tar.gz: '0819efe2f7570fc0a5494e69dd463eb6696351a7435bcb28f7f1998ffa45f4405d5e1cace72ae6056a0b7dabb68e50d171656f735eec4fa3af1fd0f0c798cec1'
|
@@ -0,0 +1,72 @@
|
|
1
|
+
decko.editors.init[".file-upload"] = -> decko.upload_file(this)
|
2
|
+
|
3
|
+
$.extend decko,
|
4
|
+
upload_file: (fileupload) ->
|
5
|
+
# for file as a subcard in a form,
|
6
|
+
# excess parameters are included in the request which cause errors.
|
7
|
+
# only the file, type_id and attachment_card_name are needed
|
8
|
+
# attachment_card_name is the original card name,
|
9
|
+
# ex: card[subcards][+logo][image], card[file]
|
10
|
+
$(fileupload).on 'fileuploadsubmit', (e,data) ->
|
11
|
+
$_this = $(this)
|
12
|
+
card_name = $_this.siblings(".attachment_card_name:first").attr("name")
|
13
|
+
type_id = $_this.siblings("#attachment_type_id").val()
|
14
|
+
data.formData = {
|
15
|
+
"card[type_id]": type_id,
|
16
|
+
"attachment_upload": card_name
|
17
|
+
}
|
18
|
+
$_fileupload = $(fileupload)
|
19
|
+
if $_fileupload.closest("form").attr("action").indexOf("update") > -1
|
20
|
+
url = "card/update/"+$(fileupload).siblings("#file_card_name").val()
|
21
|
+
else
|
22
|
+
url = "card/create"
|
23
|
+
$(fileupload).fileupload(
|
24
|
+
url: decko.path(url),
|
25
|
+
dataType: 'html',
|
26
|
+
done: decko.doneFile,
|
27
|
+
add: decko.chooseFile,
|
28
|
+
progressall: decko.progressallFile
|
29
|
+
)#, forceIframeTransport: true )
|
30
|
+
|
31
|
+
chooseFile: (e, data) ->
|
32
|
+
data.form.find('button[type=submit]').attr('disabled',true)
|
33
|
+
editor = $(this).closest '.card-editor'
|
34
|
+
$('#progress').show()
|
35
|
+
editor.append '<input type="hidden" class="extra_upload_param" ' +
|
36
|
+
'value="true" name="attachment_upload">'
|
37
|
+
editor.append '<input type="hidden" class="extra_upload_param" ' +
|
38
|
+
'value="preview_editor" name="view">'
|
39
|
+
data.submit()
|
40
|
+
editor.find('.choose-file').hide()
|
41
|
+
# editor.find(".file-upload").prop "disabled", true
|
42
|
+
editor.find('.extra_upload_param').remove()
|
43
|
+
|
44
|
+
progressallFile: (e, data) ->
|
45
|
+
progress = parseInt(data.loaded / data.total * 100, 10)
|
46
|
+
$('#progress .progress-bar').css('width', progress + '%')
|
47
|
+
|
48
|
+
doneFile: (e, data) ->
|
49
|
+
editor = $(this).closest '.card-editor'
|
50
|
+
editor.find('.chosen-file').replaceWith data.result
|
51
|
+
data.form.find('button[type=submit]').attr('disabled',false)
|
52
|
+
|
53
|
+
$(window).ready ->
|
54
|
+
$('body').on 'click', '.cancel-upload', ->
|
55
|
+
editor = $(this).closest '.card-editor'
|
56
|
+
editor.find('.choose-file').show()
|
57
|
+
# editor.find(".file-upload").prop "disabled", false
|
58
|
+
editor.find('.chosen-file').empty()
|
59
|
+
editor.find('.progress').show()
|
60
|
+
editor.find('#progress .progress-bar').css('width', '0%')
|
61
|
+
editor.find('#progress').hide()
|
62
|
+
|
63
|
+
$('body').on "submit", "form", ->
|
64
|
+
disableUploader this, true
|
65
|
+
|
66
|
+
$("body").on "ajax:complete", "form", ->
|
67
|
+
disableUploader this, false
|
68
|
+
|
69
|
+
disableUploader = (form, toggle) ->
|
70
|
+
uploader = $(form).find ".file-upload[type=file]"
|
71
|
+
if uploader[0]
|
72
|
+
uploader.prop "disabled", toggle
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/* -- file upload -- */
|
2
|
+
.fileupload-buttonbar .btn, .fileupload-buttonbar .toggle {
|
3
|
+
margin-bottom: 5px;
|
4
|
+
}
|
5
|
+
|
6
|
+
.fileinput-button {
|
7
|
+
position: relative;
|
8
|
+
overflow: hidden;
|
9
|
+
display: inline-block;
|
10
|
+
input {
|
11
|
+
position: absolute;
|
12
|
+
top: 0;
|
13
|
+
right: 0;
|
14
|
+
margin: 0;
|
15
|
+
opacity: 0;
|
16
|
+
-ms-filter: 'alpha(opacity=0)';
|
17
|
+
font-size: 200px;
|
18
|
+
direction: ltr;
|
19
|
+
cursor: pointer;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
.TYPE-image {
|
24
|
+
.d0-card-content, .d0-card-body, &.d0-card-content {
|
25
|
+
img {
|
26
|
+
max-width: 100%;
|
27
|
+
max-height: 100%;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
file1
|
@@ -0,0 +1 @@
|
|
1
|
+
file2
|
@@ -0,0 +1 @@
|
|
1
|
+
file3, man.
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="min-width:65px;min-height:45px;margin-top:-12px;margin-bottom:-14px" version="1.1" viewBox="0 0 242 218"><title>b&w_logo</title><desc>Created with Sketch.</desc><defs><rect id="path-1" width="157.28" height="190.607" x="35.33" y="10.485" rx="12.491"/><filter id="filter-2" width="125.4%" height="121%" x="-12.1%" y="-10.5%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter><rect id="path-3" width="123.953" height="171.161" x="51.988" y="19.404" rx="9.689"/><filter id="filter-4" width="132.3%" height="123.4%" x="-15.3%" y="-11.7%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter><path id="path-5" d="M70.1050368,35.6666109 L159.089911,35.6666109 L159.089911,35.6666109 C163.678051,35.6666109 167.397473,39.386033 167.397473,43.9741728 L167.397473,87.717145 L167.397473,166.808436 L167.397473,166.808436 C167.397473,171.396576 163.678051,175.115998 159.089911,175.115998 L70.1050368,175.115998 L70.1050368,175.115998 C65.516897,175.115998 61.7974749,171.396576 61.7974749,166.808436 L61.7974749,43.9741728 L61.7974749,43.9741728 C61.7974749,39.386033 65.516897,35.6666109 70.1050368,35.6666109 Z"/><filter id="filter-6" width="137.9%" height="128.7%" x="-18%" y="-14.3%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter><rect id="path-7" width="92.149" height="107.187" x="70.764" y="49.853" rx="7.866"/><filter id="filter-8" width="143.4%" height="137.3%" x="-20.6%" y="-18.7%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.102553216 0"/></filter></defs><g id="Page-3" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="b&w_logo" fill-rule="nonzero"><g id="Decko-Logo-" transform="translate(7.000000, 4.000000)"><g id="g5642"><g id="svg-card-1" transform="translate(113.969540, 105.788552) scale(-1, 1) rotate(105.855860) translate(-113.969540, -105.788552)"><use fill="#000" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"/><use fill="#4D4D4D" fill-rule="evenodd" xlink:href="#path-1"/></g><g id="svg-card-2" opacity=".88" transform="translate(113.964538, 104.984820) scale(-1, 1) rotate(117.480003) translate(-113.964538, -104.984820)"><use fill="#000" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-3"/><use fill="#FFF" fill-rule="evenodd" xlink:href="#path-3"/></g><g id="svg-card-3" transform="translate(114.597474, 105.391304) scale(-1, 1) rotate(133.539993) translate(-114.597474, -105.391304)"><use fill="#000" fill-opacity="1" filter="url(#filter-6)" xlink:href="#path-5"/><use fill="#4C4C4C" fill-rule="evenodd" xlink:href="#path-5"/></g><g id="svg-card-4" opacity=".88" transform="translate(116.838368, 103.446228) scale(-1, 1) rotate(142.690002) translate(-116.838368, -103.446228)"><use fill="#000" fill-opacity="1" filter="url(#filter-8)" xlink:href="#path-7"/><use fill="#FFF" fill-rule="evenodd" xlink:href="#path-7"/></g></g></g></g></g></svg>
|
data/data/files/logo.svg
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="min-width:65px;min-height:45px;margin-top:-12px;margin-bottom:-14px" version="1.1" viewBox="0 0 242 218"><title>b&w_logo</title><desc>Created with Sketch.</desc><defs><rect id="path-1" width="157.28" height="190.607" x="35.33" y="10.485" rx="12.491"/><filter id="filter-2" width="125.4%" height="121%" x="-12.1%" y="-10.5%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter><rect id="path-3" width="123.953" height="171.161" x="51.988" y="19.404" rx="9.689"/><filter id="filter-4" width="132.3%" height="123.4%" x="-15.3%" y="-11.7%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter><path id="path-5" d="M70.1050368,35.6666109 L159.089911,35.6666109 L159.089911,35.6666109 C163.678051,35.6666109 167.397473,39.386033 167.397473,43.9741728 L167.397473,87.717145 L167.397473,166.808436 L167.397473,166.808436 C167.397473,171.396576 163.678051,175.115998 159.089911,175.115998 L70.1050368,175.115998 L70.1050368,175.115998 C65.516897,175.115998 61.7974749,171.396576 61.7974749,166.808436 L61.7974749,43.9741728 L61.7974749,43.9741728 C61.7974749,39.386033 65.516897,35.6666109 70.1050368,35.6666109 Z"/><filter id="filter-6" width="137.9%" height="128.7%" x="-18%" y="-14.3%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/></filter><rect id="path-7" width="92.149" height="107.187" x="70.764" y="49.853" rx="7.866"/><filter id="filter-8" width="143.4%" height="137.3%" x="-20.6%" y="-18.7%" filterUnits="objectBoundingBox"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="5.5"/><feColorMatrix in="shadowBlurOuter1" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.102553216 0"/></filter></defs><g id="Page-3" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="b&w_logo" fill-rule="nonzero"><g id="Decko-Logo-" transform="translate(7.000000, 4.000000)"><g id="g5642"><g id="svg-card-1" transform="translate(113.969540, 105.788552) scale(-1, 1) rotate(105.855860) translate(-113.969540, -105.788552)"><use fill="#000" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"/><use fill="#4D4D4D" fill-rule="evenodd" xlink:href="#path-1"/></g><g id="svg-card-2" opacity=".88" transform="translate(113.964538, 104.984820) scale(-1, 1) rotate(117.480003) translate(-113.964538, -104.984820)"><use fill="#000" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-3"/><use fill="#FFF" fill-rule="evenodd" xlink:href="#path-3"/></g><g id="svg-card-3" transform="translate(114.597474, 105.391304) scale(-1, 1) rotate(133.539993) translate(-114.597474, -105.391304)"><use fill="#000" fill-opacity="1" filter="url(#filter-6)" xlink:href="#path-5"/><use fill="#4C4C4C" fill-rule="evenodd" xlink:href="#path-5"/></g><g id="svg-card-4" opacity=".88" transform="translate(116.838368, 103.446228) scale(-1, 1) rotate(142.690002) translate(-116.838368, -103.446228)"><use fill="#000" fill-opacity="1" filter="url(#filter-8)" xlink:href="#path-7"/><use fill="#FFF" fill-rule="evenodd" xlink:href="#path-7"/></g></g></g></g></g></svg>
|
data/data/files/mao2.jpg
ADDED
Binary file
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// upload.js.coffee
|
2
|
+
(function(){var e;decko.editors.init[".file-upload"]=function(){return decko.upload_file(this)},$.extend(decko,{upload_file:function(e){var t;return $(e).on("fileuploadsubmit",function(e,t){var r,i,a;return i=(r=$(this)).siblings(".attachment_card_name:first").attr("name"),a=r.siblings("#attachment_type_id").val(),t.formData={"card[type_id]":a,attachment_upload:i}}),t=$(e).closest("form").attr("action").indexOf("update")>-1?"card/update/"+$(e).siblings("#file_card_name").val():"card/create",$(e).fileupload({url:decko.path(t),dataType:"html",done:decko.doneFile,add:decko.chooseFile,progressall:decko.progressallFile})},chooseFile:function(e,t){var r;return t.form.find("button[type=submit]").attr("disabled",!0),r=$(this).closest(".card-editor"),$("#progress").show(),r.append('<input type="hidden" class="extra_upload_param" value="true" name="attachment_upload">'),r.append('<input type="hidden" class="extra_upload_param" value="preview_editor" name="view">'),t.submit(),r.find(".choose-file").hide(),r.find(".extra_upload_param").remove()},progressallFile:function(e,t){var r;return r=parseInt(t.loaded/t.total*100,10),$("#progress .progress-bar").css("width",r+"%")},doneFile:function(e,t){return $(this).closest(".card-editor").find(".chosen-file").replaceWith(t.result),t.form.find("button[type=submit]").attr("disabled",!1)}}),$(window).ready(function(){return $("body").on("click",".cancel-upload",function(){var e;return(e=$(this).closest(".card-editor")).find(".choose-file").show(),e.find(".chosen-file").empty(),e.find(".progress").show(),e.find("#progress .progress-bar").css("width","0%"),e.find("#progress").hide()}),$("body").on("submit","form",function(){return e(this,!0)}),$("body").on("ajax:complete","form",function(){return e(this,!1)})}),e=function(e,t){var r;if((r=$(e).find(".file-upload[type=file]"))[0])return r.prop("disabled",t)}}).call(this);
|
Binary file
|
data/data/real.yml
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
#---
|
2
|
+
- :name: File
|
3
|
+
:type: :cardtype
|
4
|
+
:codename: file
|
5
|
+
:fields:
|
6
|
+
:description: |-
|
7
|
+
<p>
|
8
|
+
Upload images to these cards and include them anywhere.
|
9
|
+
[[http://decko.org/Image|more]]
|
10
|
+
</p>
|
11
|
+
|
12
|
+
- :name: Image
|
13
|
+
:type: :cardtype
|
14
|
+
:codename: image
|
15
|
+
:fields:
|
16
|
+
:description: |-
|
17
|
+
<p>
|
18
|
+
File cards are for uploading and downloading files.
|
19
|
+
[[http://decko.org/File|more]]
|
20
|
+
</p>
|
21
|
+
- :name:
|
22
|
+
- :image
|
23
|
+
- :right
|
24
|
+
- :default
|
25
|
+
:type: :image
|
26
|
+
|
27
|
+
- :name: "*logo"
|
28
|
+
:type: :image
|
29
|
+
:codename: logo
|
30
|
+
:storage_type: :coded
|
31
|
+
:image: logo.svg
|
32
|
+
:fields:
|
33
|
+
:self:
|
34
|
+
:fields:
|
35
|
+
:read: Anyone
|
36
|
+
- :name: "*favicon"
|
37
|
+
:type: :image
|
38
|
+
:codename: favicon
|
39
|
+
:image: favicon.png
|
40
|
+
:storage_type: :coded
|
41
|
+
|
42
|
+
|
43
|
+
- :name: "*new file"
|
44
|
+
:type: :file
|
45
|
+
:codename: new_file
|
46
|
+
:skip: validate_file_exist
|
47
|
+
- :name: "*new image"
|
48
|
+
:type: :image
|
49
|
+
:codename: new_image
|
50
|
+
:skip: validate_file_exist
|
51
|
+
|
52
|
+
# TODO: move to code. should not be editable
|
53
|
+
# Probably not in this mod, though. Needed to come after :image for eating, but it would
|
54
|
+
# probably make more sense to have this in the format mod in code.
|
55
|
+
- :name:
|
56
|
+
- :credit
|
57
|
+
- :image
|
58
|
+
:type: :html
|
59
|
+
:content: |-
|
60
|
+
<svg style="width:18px; height:14px;" viewBox="0 0 242 220" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
61
|
+
<!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
|
62
|
+
<title>b&w_logo</title>
|
63
|
+
<desc>Created with Sketch.</desc>
|
64
|
+
<defs>
|
65
|
+
<rect id="path-1" x="35.3297422" y="10.484836" width="157.279595" height="190.607432" rx="12.491335"></rect>
|
66
|
+
<filter x="-12.1%" y="-10.5%" width="125.4%" height="121.0%" filterUnits="objectBoundingBox" id="filter-2">
|
67
|
+
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
|
68
|
+
<feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
|
69
|
+
<feGaussianBlur stdDeviation="5.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
70
|
+
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
71
|
+
</filter>
|
72
|
+
<rect id="path-3" x="51.9878879" y="19.404077" width="123.9533" height="171.161486" rx="9.6888466"></rect>
|
73
|
+
<filter x="-15.3%" y="-11.7%" width="132.3%" height="123.4%" filterUnits="objectBoundingBox" id="filter-4">
|
74
|
+
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
|
75
|
+
<feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
|
76
|
+
<feGaussianBlur stdDeviation="5.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
77
|
+
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
78
|
+
</filter>
|
79
|
+
<path d="M70.1050368,35.6666109 L159.089911,35.6666109 L159.089911,35.6666109 C163.678051,35.6666109 167.397473,39.386033 167.397473,43.9741728 L167.397473,87.717145 L167.397473,166.808436 L167.397473,166.808436 C167.397473,171.396576 163.678051,175.115998 159.089911,175.115998 L70.1050368,175.115998 L70.1050368,175.115998 C65.516897,175.115998 61.7974749,171.396576 61.7974749,166.808436 L61.7974749,43.9741728 L61.7974749,43.9741728 C61.7974749,39.386033 65.516897,35.6666109 70.1050368,35.6666109 Z" id="path-5"></path>
|
80
|
+
<filter x="-18.0%" y="-14.3%" width="137.9%" height="128.7%" filterUnits="objectBoundingBox" id="filter-6">
|
81
|
+
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
|
82
|
+
<feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
|
83
|
+
<feGaussianBlur stdDeviation="5.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
84
|
+
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
85
|
+
</filter>
|
86
|
+
<rect id="path-7" x="70.7637805" y="49.8525134" width="92.149175" height="107.18743" rx="7.8659801"></rect>
|
87
|
+
<filter x="-20.6%" y="-18.7%" width="143.4%" height="137.3%" filterUnits="objectBoundingBox" id="filter-8">
|
88
|
+
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
|
89
|
+
<feOffset dx="1" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
|
90
|
+
<feGaussianBlur stdDeviation="5.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
91
|
+
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.102553216 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
92
|
+
</filter>
|
93
|
+
</defs>
|
94
|
+
<g id="Page-3" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
95
|
+
<g id="b&w_logo" fill-rule="nonzero">
|
96
|
+
<g id="Decko-Logo-" transform="translate(7.000000, 4.000000)">
|
97
|
+
<g id="g5642">
|
98
|
+
<g id="svg-card-1" transform="translate(113.969540, 105.788552) scale(-1, 1) rotate(105.855860) translate(-113.969540, -105.788552) ">
|
99
|
+
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
|
100
|
+
<use fill="#4D4D4D" fill-rule="evenodd" xlink:href="#path-1"></use>
|
101
|
+
</g>
|
102
|
+
<g id="svg-card-2" opacity="0.879999995" transform="translate(113.964538, 104.984820) scale(-1, 1) rotate(117.480003) translate(-113.964538, -104.984820) ">
|
103
|
+
<use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-3"></use>
|
104
|
+
<use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-3"></use>
|
105
|
+
</g>
|
106
|
+
<g id="svg-card-3" transform="translate(114.597474, 105.391304) scale(-1, 1) rotate(133.539993) translate(-114.597474, -105.391304) ">
|
107
|
+
<use fill="black" fill-opacity="1" filter="url(#filter-6)" xlink:href="#path-5"></use>
|
108
|
+
<use fill="#4C4C4C" fill-rule="evenodd" xlink:href="#path-5"></use>
|
109
|
+
</g>
|
110
|
+
<g id="svg-card-4" opacity="0.879999995" transform="translate(116.838368, 103.446228) scale(-1, 1) rotate(142.690002) translate(-116.838368, -103.446228) ">
|
111
|
+
<use fill="black" fill-opacity="1" filter="url(#filter-8)" xlink:href="#path-7"></use>
|
112
|
+
<use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-7"></use>
|
113
|
+
</g>
|
114
|
+
</g>
|
115
|
+
</g>
|
116
|
+
</g>
|
117
|
+
</g>
|
118
|
+
</svg>
|
@@ -81,11 +81,11 @@ module CarrierWave
|
|
81
81
|
|
82
82
|
def assign_file file
|
83
83
|
db_column = _mounter(:#{column}).serialization_column
|
84
|
-
send(:"\#{db_column}_will_change!")
|
84
|
+
send(:"\#{db_column}_will_change!") unless duplicate?
|
85
85
|
if web?
|
86
86
|
self.content = file
|
87
87
|
else
|
88
|
-
send(:"#{column}_will_change!")
|
88
|
+
send(:"#{column}_will_change!") unless duplicate?
|
89
89
|
yield
|
90
90
|
end
|
91
91
|
end
|
data/locales/en.yml
CHANGED
@@ -11,3 +11,9 @@ en:
|
|
11
11
|
carrierwave_replace_item: Replace %{attachment_name}...
|
12
12
|
carrierwave_unknown_storage_type: unknown storage type %{new_storage_type}
|
13
13
|
carrierwave_url_is_missing: url is missing
|
14
|
+
|
15
|
+
# carrierwave_task_move_files_link_text: "Move Files"
|
16
|
+
# carrierwave_task_move_files_description: "Move Files!"
|
17
|
+
|
18
|
+
carrierwave_task_delete_upload_tmp_files_link_text: "Delete upload tmp files"
|
19
|
+
carrierwave_task_delete_upload_tmp_files_description: "Delete upload tmp files!"
|
data/set/abstract/attachment.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
Card.action_specific_attributes << :duplicate_file
|
2
|
+
|
1
3
|
attr_writer :empty_ok
|
2
4
|
|
3
5
|
def self.included host_class
|
@@ -21,7 +23,7 @@ event :save_original_filename, :prepare_to_store, on: :save, when: :file_ready_t
|
|
21
23
|
@current_action.update! comment: original_filename
|
22
24
|
end
|
23
25
|
|
24
|
-
event :validate_file_exist, :validate, on: :create do
|
26
|
+
event :validate_file_exist, :validate, on: :create, skip: :allowed do
|
25
27
|
return if empty_ok?
|
26
28
|
|
27
29
|
if web?
|
@@ -80,10 +82,21 @@ end
|
|
80
82
|
def assign_set_specific_attributes
|
81
83
|
@attaching = set_specific[attachment_name].present?
|
82
84
|
# reset content if we really have something to upload
|
83
|
-
self.content = nil if @attaching
|
85
|
+
self.content = nil if @attaching && !duplicate?
|
84
86
|
super
|
85
87
|
end
|
86
88
|
|
89
|
+
# FIXME: this is weak duplicate detection and currently only catches duplicate
|
90
|
+
# updates to coded cards. Tried #read but wasn't getting the same value on both
|
91
|
+
# files even when they were definitely duplicates.
|
92
|
+
def duplicate?
|
93
|
+
real? &&
|
94
|
+
storage_type == :coded &&
|
95
|
+
(old = attachment.file) &&
|
96
|
+
(new = set_specific[attachment_name]) &&
|
97
|
+
old.size == new.size
|
98
|
+
end
|
99
|
+
|
87
100
|
def delete_files_for_action action
|
88
101
|
with_selected_action_id(action.id) do
|
89
102
|
attachment.file.delete
|
data/set/all/file_utils.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# TODO: move to lib
|
2
|
+
# eg, create new Card::File class in lib/card/file
|
1
3
|
module ClassMethods
|
2
|
-
def update_all_storage_locations
|
3
|
-
|
4
|
-
|
5
|
-
end
|
4
|
+
# def update_all_storage_locations
|
5
|
+
# Card.search(type_id: ["in", Card::FileID, Card::ImageID])
|
6
|
+
# .each(&:update_storage_location!)
|
7
|
+
# end
|
6
8
|
|
7
9
|
def delete_tmp_files_of_cached_uploads
|
8
10
|
cards_with_disposable_attachments do |card, action|
|
data/set/self/admin.rb
CHANGED
@@ -1,22 +1,8 @@
|
|
1
|
-
basket[:tasks]
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# task: "update_file_storage_locations"
|
10
|
-
}
|
11
|
-
},
|
12
|
-
{
|
13
|
-
name: :delete_upload_tmp_files,
|
14
|
-
execute_policy: -> { Card.delete_tmp_files_of_cached_uploads },
|
15
|
-
stats: {
|
16
|
-
title: "tmp files of canceled uploads",
|
17
|
-
count: -> { ::Card.draft_actions_with_attachment },
|
18
|
-
link_text: "delete tmp files",
|
19
|
-
task: "delete_tmp_files_of_cached_uploads"
|
20
|
-
}
|
21
|
-
}
|
22
|
-
]
|
1
|
+
basket[:tasks][:delete_upload_tmp_files] = {
|
2
|
+
mod: :carrierwave,
|
3
|
+
execute_policy: -> { Card.delete_tmp_files_of_cached_uploads }
|
4
|
+
}
|
5
|
+
|
6
|
+
# { name: :move_files,
|
7
|
+
# mod: :carrierwave,
|
8
|
+
# execute_policy: -> { Card.update_all_storage_locations } },
|
data/set/self/search.rb
ADDED
@@ -1,19 +1,15 @@
|
|
1
1
|
.chosen-file
|
2
2
|
%input{ name: cached_upload_card_name, type: "hidden", value: card.selected_action_id }
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
%
|
10
|
-
|
11
|
-
|
12
|
-
%
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
%button.btn.btn-danger.delete.cancel-upload{ "data-type": "DELETE" }
|
17
|
-
= icon_tag :delete
|
18
|
-
%span
|
19
|
-
= preview_editor_delete_text
|
3
|
+
.d-flex
|
4
|
+
= preview
|
5
|
+
.d-flex.flex-column.justify-content-between.ml-2.w-100
|
6
|
+
%div
|
7
|
+
%p.name
|
8
|
+
= card.original_filename
|
9
|
+
%span.size
|
10
|
+
= number_to_human_size card.attachment.size
|
11
|
+
.align-self-end
|
12
|
+
%button.btn.btn-danger.delete.cancel-upload{ "data-type": "DELETE" }
|
13
|
+
= icon_tag :delete
|
14
|
+
%span
|
15
|
+
= preview_editor_delete_text
|
@@ -3,7 +3,7 @@ format :html do
|
|
3
3
|
|
4
4
|
# core HTML image view.
|
5
5
|
view :core do
|
6
|
-
return card.attachment.read if
|
6
|
+
return card.attachment.read.html_safe if svg?
|
7
7
|
|
8
8
|
with_valid_source do |source|
|
9
9
|
image_tag source, alt: card.name
|
@@ -76,4 +76,8 @@ format :html do
|
|
76
76
|
Card::Content::Diff.render_added_chunk _render_core
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
def goto_autocomplete_icon
|
81
|
+
render :core, size: :small
|
82
|
+
end
|
79
83
|
end
|
data/set/type/image.rb
CHANGED
@@ -12,6 +12,7 @@ end
|
|
12
12
|
|
13
13
|
format do
|
14
14
|
include File::Format
|
15
|
+
delegate :svg?, to: :card
|
15
16
|
|
16
17
|
view :one_line_content do
|
17
18
|
_render_core size: :icon
|
@@ -32,10 +33,12 @@ format do
|
|
32
33
|
|
33
34
|
def selected_version
|
34
35
|
size = determine_image_size
|
35
|
-
|
36
|
-
|
36
|
+
image = card.image
|
37
|
+
|
38
|
+
if size && size != :original && !svg?
|
39
|
+
image.versions[size]
|
37
40
|
else
|
38
|
-
|
41
|
+
image
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-carrierwave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-01-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.105.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.105.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: carrierwave
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,34 +54,48 @@ dependencies:
|
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '4.2'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: ssrf_filter
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.0.7
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.0.7
|
57
71
|
- !ruby/object:Gem::Dependency
|
58
72
|
name: card-mod-history
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
60
74
|
requirements:
|
61
75
|
- - '='
|
62
76
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
77
|
+
version: 0.15.0
|
64
78
|
type: :runtime
|
65
79
|
prerelease: false
|
66
80
|
version_requirements: !ruby/object:Gem::Requirement
|
67
81
|
requirements:
|
68
82
|
- - '='
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
84
|
+
version: 0.15.0
|
71
85
|
- !ruby/object:Gem::Dependency
|
72
86
|
name: card-mod-permissions
|
73
87
|
requirement: !ruby/object:Gem::Requirement
|
74
88
|
requirements:
|
75
89
|
- - '='
|
76
90
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
91
|
+
version: 0.15.0
|
78
92
|
type: :runtime
|
79
93
|
prerelease: false
|
80
94
|
version_requirements: !ruby/object:Gem::Requirement
|
81
95
|
requirements:
|
82
96
|
- - '='
|
83
97
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
98
|
+
version: 0.15.0
|
85
99
|
description: ''
|
86
100
|
email:
|
87
101
|
- info@decko.org
|
@@ -89,12 +103,31 @@ executables: []
|
|
89
103
|
extensions: []
|
90
104
|
extra_rdoc_files: []
|
91
105
|
files:
|
106
|
+
- assets/script/upload.js.coffee
|
107
|
+
- assets/style/file.scss
|
108
|
+
- data/files/favicon.png
|
109
|
+
- data/files/favicon/image-icon.png
|
110
|
+
- data/files/favicon/image-large.png
|
111
|
+
- data/files/favicon/image-medium.png
|
112
|
+
- data/files/favicon/image-original.png
|
113
|
+
- data/files/favicon/image-small.png
|
114
|
+
- data/files/file1.txt
|
115
|
+
- data/files/file2.txt
|
116
|
+
- data/files/file3.txt
|
117
|
+
- data/files/logo.svg
|
118
|
+
- data/files/logo/image-original.svg
|
119
|
+
- data/files/mao2.jpg
|
120
|
+
- data/files/mod_carrierwave_script_asset_output/file.js
|
121
|
+
- data/files/rails.gif
|
122
|
+
- data/real.yml
|
92
123
|
- init/early/carrierwave.rb
|
93
124
|
- init/early/mini_magick.rb
|
125
|
+
- lib/card/mod/carrierwave.rb
|
94
126
|
- lib/carrier_wave/card_mount.rb
|
95
127
|
- lib/carrier_wave/file_card_uploader.rb
|
96
128
|
- lib/carrier_wave/file_card_uploader/path.rb
|
97
129
|
- lib/carrier_wave/image_card_uploader.rb
|
130
|
+
- lib/carrier_wave/test_file.rb
|
98
131
|
- locales/de.yml
|
99
132
|
- locales/en.yml
|
100
133
|
- set/abstract/attachment.rb
|
@@ -110,6 +143,7 @@ files:
|
|
110
143
|
- set/self/favicon.rb
|
111
144
|
- set/self/new_file.rb
|
112
145
|
- set/self/new_image.rb
|
146
|
+
- set/self/search.rb
|
113
147
|
- set/type/file.rb
|
114
148
|
- set/type/file/core.haml
|
115
149
|
- set/type/file/file_chooser.haml
|
@@ -126,6 +160,7 @@ metadata:
|
|
126
160
|
wiki_uri: https://decko.org
|
127
161
|
documentation_url: http://docs.decko.org/
|
128
162
|
card-mod: carrierwave
|
163
|
+
card-mod-group: gem-defaults
|
129
164
|
post_install_message:
|
130
165
|
rdoc_options: []
|
131
166
|
require_paths:
|
@@ -141,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
176
|
- !ruby/object:Gem::Version
|
142
177
|
version: '0'
|
143
178
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
179
|
+
rubygems_version: 3.3.11
|
145
180
|
signing_key:
|
146
181
|
specification_version: 4
|
147
182
|
summary: File and Image handling
|