-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.xml
117 lines (97 loc) · 3.28 KB
/
install.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Multiple Image Selector</name>
<version>1.0</version>
<author>Emre Acar</author>
<code>multiple-image-selector</code>
<description>Allows you to select multiple images for your products at once.</description>
<link>https://emreacar.com.tr</link>
<file path="admin/language/*/common/filemanager.php">
<operation>
<search><![CDATA[
$_['error_delete']
]]></search>
<add position="after"><![CDATA[
$_['button_add_all'] = "Add Selecteds";
]]></add>
</operation>
</file>
<file path="admin/view/template/common/filemanager.twig">
<operation>
<search><![CDATA[
<div class="col-sm-5">
]]></search>
<add position="replace"><![CDATA[
<div class="col-sm-6">
]]></add>
</operation>
<operation>
<search><![CDATA[
<div class="col-sm-7">
]]></search>
<add position="replace"><![CDATA[
<div class="col-sm-6">
]]></add>
</operation>
<operation>
<search><![CDATA[
<button type="button" data-toggle="tooltip" title="{{ button_delete }}" id="button-delete" class="btn btn-danger"><i class="fa fa-trash-o"></i></button>
]]></search>
<add position="before"><![CDATA[
<button type="button" data-toggle="tooltip" title="{{ button_add_all }}" id="button-add-all" class="btn btn-success"><i class="fa fa-plus"></i></button>
]]></add>
</operation>
<operation>
<search index="1"><![CDATA[
<input type="checkbox" name="path[]" value="{{ image.path }}" />
]]></search>
<add position="replace"><![CDATA[
<input type="checkbox" name="path[]" value="{{ image.path }}" class="multiple-image-input" />
]]></add>
</operation>
<operation>
<search><![CDATA[
$('a.thumbnail').on('click', function(e) {
]]></search>
<add position="before"><![CDATA[
var addSelected = function(Images) {
let totalSelected = Images.size;
var ImageInputs = $('body').find('input[id^="input-image"]').filter(function() {
return $(this).val() == "";
});
if (ImageInputs.length < totalSelected) {
let diff = totalSelected - ImageInputs.length;
for(let i = 0; i < diff; ++i) {
addImage();
}
}
var ImageInputs = $('body').find('input[id^="input-image"]').filter(function() {
return $(this).val() == "";
});
for(let i = 0; i < totalSelected; ++i) {
let source = Images.get(i);
$(ImageInputs[i]).parent().find('img').attr('src', source.thumb);
$(ImageInputs[i]).val(source.target);
}
}
$('button#button-add-all').on('click', function(e) {
e.preventDefault();
const selectedImages = $('.multiple-image-input:checked')
if( !selectedImages.length ) {
return;
}
const Images = new Map();
selectedImages.each(function(index) {
const el = $(this).parent().parent();
Images.set(index, {
thumb: el.find('img').attr('src'),
target: $(this).val()
})
})
addSelected(Images);
$('#modal-image').modal('hide');
});
]]></add>
</operation>
</file>
</modification>