spree_cm_commissioner 1.17.0.pre.pre4 → 1.17.0.pre.pre6
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/Gemfile.lock +1 -1
- data/app/assets/javascripts/spree_cm_commissioner/tenant_payment_icon_fields.js +52 -74
- data/app/assets/stylesheets/spree_cm_commissioner/backend/tenant_payment_icon_fields.scss +21 -8
- data/app/views/spree/admin/tenants/_form.html.erb +66 -74
- data/lib/spree_cm_commissioner/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: 22af33dbb7a3b02cec407695525b7745f8fee24b4b6fd60d5a18b85c5fd3566e
|
4
|
+
data.tar.gz: 4dc584a0641e4463531a66ef87d2b596b69dd41edd9d11c498fa80569b5aadae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3486c5f18f49a85918ed8b6f78440955fbff5f86820b66327b36eb028ffb884517428ecf4a822301d73b91c3f0ce729f9285381c91ee58fce424f03efce9e41
|
7
|
+
data.tar.gz: a1c6454f5da6873e47cd7ffc4cda002a879ad764d72c925cb8d83dc0b645e5f34b3d0a19c80652b7666c8e4c968210f3e59c2b8e9fe458019f115cde5a18caa8
|
data/Gemfile.lock
CHANGED
@@ -1,87 +1,65 @@
|
|
1
|
-
function
|
2
|
-
|
3
|
-
if (
|
4
|
-
|
1
|
+
document.addEventListener('DOMContentLoaded', function () {
|
2
|
+
// Initialize Select2 for all tenant-payment-icon-select elements
|
3
|
+
if (window.$ && $.fn.select2) {
|
4
|
+
$('.tenant-payment-icon-select').each(function () {
|
5
|
+
$(this).select2({
|
6
|
+
width: '100%'
|
7
|
+
});
|
8
|
+
});
|
5
9
|
}
|
6
|
-
return '/assets/' + path;
|
7
|
-
}
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
// Handle icon selection change
|
12
|
+
document.querySelectorAll('.tenant-payment-icon-select').forEach(function (select) {
|
13
|
+
select.addEventListener('change', function (e) {
|
14
|
+
const field = e.target.name.match(/\[([^\]]*)\]$/)[1]; // Extract field name
|
15
|
+
const preview = document.getElementById(`icon-preview-${field}`);
|
16
|
+
const removeBtn = document.querySelector(`.remove-icon-btn[data-target="${field}"]`);
|
17
|
+
const iconPath = e.target.value;
|
13
18
|
|
14
|
-
|
15
|
-
field.value = '';
|
16
|
-
}
|
17
|
-
if (preview) {
|
18
|
-
preview.src = '';
|
19
|
-
preview.style.display = 'none';
|
20
|
-
}
|
21
|
-
if (removeBtn) {
|
22
|
-
removeBtn.classList.add('hidden');
|
23
|
-
}
|
19
|
+
if (!preview || !removeBtn) return;
|
24
20
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
}
|
30
|
-
|
31
|
-
function formatIconOption(icon) {
|
32
|
-
if (!icon.id) return icon.text;
|
33
|
-
return $(`<span>
|
34
|
-
<img src="${getAssetUrl(icon.id)}" style="height:20px;width:auto;margin-right:5px;" />
|
35
|
-
${icon.text}
|
36
|
-
</span>`);
|
37
|
-
}
|
38
|
-
|
39
|
-
function formatIconSelection(icon) {
|
40
|
-
if (!icon.id) return icon.text;
|
41
|
-
return $(`<span>
|
42
|
-
<img src="${getAssetUrl(icon.id)}" style="height:20px;width:auto;margin-right:5px;" />
|
43
|
-
${icon.text}
|
44
|
-
</span>`);
|
45
|
-
}
|
21
|
+
if (!iconPath) {
|
22
|
+
preview.innerHTML = '<span class="no-icon-placeholder"></span>';
|
23
|
+
removeBtn.classList.add('hidden');
|
24
|
+
return;
|
25
|
+
}
|
46
26
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
27
|
+
// Fetch SVG for the selected icon
|
28
|
+
fetch(`/admin/vector_icons/svg?path=${encodeURIComponent(iconPath)}`)
|
29
|
+
.then((response) => {
|
30
|
+
if (!response.ok) throw new Error('Failed to fetch SVG');
|
31
|
+
return response.text();
|
32
|
+
})
|
33
|
+
.then((svg) => {
|
34
|
+
preview.innerHTML = svg;
|
35
|
+
removeBtn.classList.remove('hidden');
|
36
|
+
})
|
37
|
+
.catch((error) => {
|
38
|
+
console.error('Error fetching SVG:', error);
|
39
|
+
preview.innerHTML = '<span class="no-icon-placeholder">Error loading icon</span>';
|
40
|
+
});
|
41
|
+
});
|
52
42
|
});
|
53
43
|
|
54
|
-
|
55
|
-
|
56
|
-
allowClear: true,
|
57
|
-
placeholder: 'None',
|
58
|
-
templateResult: formatIconOption,
|
59
|
-
templateSelection: formatIconSelection
|
60
|
-
});
|
44
|
+
document.addEventListener('click', function (e) {
|
45
|
+
if (!e.target.classList.contains('remove-icon-btn')) return;
|
61
46
|
|
62
|
-
|
63
|
-
const
|
64
|
-
const
|
65
|
-
const
|
66
|
-
const removeBtnId = $(this).data('remove_btn');
|
47
|
+
const field = e.target.getAttribute('data-target');
|
48
|
+
const select = document.querySelector(`.tenant-payment-icon-select[name*="[${field}]"]`);
|
49
|
+
const preview = document.getElementById(`icon-preview-${field}`);
|
50
|
+
const removeBtn = e.target;
|
67
51
|
|
68
|
-
|
69
|
-
const preview = document.getElementById(previewId);
|
70
|
-
const removeBtn = document.getElementById(removeBtnId);
|
52
|
+
if (!select || !preview || !removeBtn) return;
|
71
53
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
if (
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if (removeBtn) {
|
80
|
-
if (selectedIcon) {
|
81
|
-
removeBtn.classList.remove('hidden');
|
82
|
-
} else {
|
83
|
-
removeBtn.classList.add('hidden');
|
84
|
-
}
|
54
|
+
// Clear the select input
|
55
|
+
select.value = '';
|
56
|
+
|
57
|
+
if (window.$ && $(select).hasClass('select2-hidden-accessible')) {
|
58
|
+
$(select).val('').trigger('change.select2');
|
59
|
+
} else {
|
60
|
+
select.dispatchEvent(new Event('change', { bubbles: true }));
|
85
61
|
}
|
62
|
+
preview.innerHTML = '<span class="no-icon-placeholder"></span>';
|
63
|
+
removeBtn.classList.add('hidden');
|
86
64
|
});
|
87
65
|
});
|
@@ -1,14 +1,27 @@
|
|
1
1
|
.payment-icon-preview {
|
2
|
-
|
3
|
-
|
4
|
-
min-height: 60px;
|
5
|
-
min-width: 120px;
|
2
|
+
width: 80px;
|
3
|
+
height: 80px;
|
6
4
|
background: #f8f9fa;
|
7
5
|
border: 1px dashed #ccc;
|
8
|
-
display: inline-
|
9
|
-
|
6
|
+
display: inline-flex;
|
7
|
+
align-items: center;
|
8
|
+
justify-content: center;
|
10
9
|
cursor: pointer;
|
11
|
-
|
10
|
+
}
|
11
|
+
|
12
|
+
.payment-icon-preview svg {
|
13
|
+
width: 100%;
|
14
|
+
height: 100%;
|
15
|
+
object-fit: contain;
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
.no-icon-placeholder {
|
20
|
+
width: 40px;
|
21
|
+
height: 40px;
|
22
|
+
border: 1px dashed #ddd;
|
23
|
+
background: #f8f9fa;
|
24
|
+
display: inline-block;
|
12
25
|
}
|
13
26
|
|
14
27
|
.icon-preview-container {
|
@@ -44,4 +57,4 @@
|
|
44
57
|
|
45
58
|
.remove-icon-btn.hidden {
|
46
59
|
display: none;
|
47
|
-
}
|
60
|
+
}
|
@@ -47,21 +47,22 @@
|
|
47
47
|
<div class="col-12">
|
48
48
|
<%= f.field_container :preferred_assetlinks do %>
|
49
49
|
<%= f.label :preferred_assetlinks, raw(Spree.t(:assetlinks)) %>
|
50
|
-
<%= f.text_area :preferred_assetlinks, class: 'form-control', rows: 5,
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
<%= f.text_area :preferred_assetlinks, class: 'form-control', rows: 5,
|
51
|
+
placeholder: <<~JSON.strip
|
52
|
+
example:
|
53
|
+
[
|
54
|
+
{
|
55
|
+
"relation": ["delegate_permission/common.handle_all_urls"],
|
56
|
+
"target": {
|
57
|
+
"namespace": "android_app",
|
58
|
+
"package_name": "com.yourapp.app",
|
59
|
+
"sha256_cert_fingerprints": [
|
60
|
+
"SHA256_CERTIFICATE_FINGERPRINT_HERE"
|
61
|
+
]
|
62
|
+
}
|
63
|
+
}
|
60
64
|
]
|
61
|
-
|
62
|
-
}
|
63
|
-
]
|
64
|
-
JSON
|
65
|
+
JSON
|
65
66
|
%>
|
66
67
|
<% if f.object.errors[:preferred_assetlinks].any? %>
|
67
68
|
<div class="error text-danger"><%= f.object.errors[:preferred_assetlinks].join(', ') %></div>
|
@@ -73,25 +74,26 @@
|
|
73
74
|
<div class="col-12">
|
74
75
|
<%= f.field_container :preferred_apple_app_site_association do %>
|
75
76
|
<%= f.label :preferred_apple_app_site_association, raw(Spree.t(:apple_app_site_association)) %>
|
76
|
-
<%= f.text_area :preferred_apple_app_site_association, class: 'form-control', rows: 5,
|
77
|
-
|
78
|
-
|
79
|
-
"webcredentials": {
|
80
|
-
"apps": [
|
81
|
-
"TEAM_ID.com.yourapp.app"
|
82
|
-
]
|
83
|
-
},
|
84
|
-
"applinks": {
|
85
|
-
"apps": [],
|
86
|
-
"details": [
|
77
|
+
<%= f.text_area :preferred_apple_app_site_association, class: 'form-control', rows: 5,
|
78
|
+
placeholder: <<~JSON.strip
|
79
|
+
example:
|
87
80
|
{
|
88
|
-
"
|
89
|
-
|
81
|
+
"webcredentials": {
|
82
|
+
"apps": [
|
83
|
+
"TEAM_ID.com.yourapp.app"
|
84
|
+
]
|
85
|
+
},
|
86
|
+
"applinks": {
|
87
|
+
"apps": [],
|
88
|
+
"details": [
|
89
|
+
{
|
90
|
+
"appID": "TEAM_ID.com.yourapp.app",
|
91
|
+
"paths": ["*"]
|
92
|
+
}
|
93
|
+
]
|
94
|
+
}
|
90
95
|
}
|
91
|
-
|
92
|
-
}
|
93
|
-
}
|
94
|
-
JSON
|
96
|
+
JSON
|
95
97
|
%>
|
96
98
|
<% if f.object.errors[:preferred_apple_app_site_association].any? %>
|
97
99
|
<div class="error text-danger"><%= f.object.errors[:preferred_apple_app_site_association].join(', ') %></div>
|
@@ -115,55 +117,45 @@
|
|
115
117
|
</div>
|
116
118
|
|
117
119
|
<div data-hook="admin_tenant_form_fields" class="row">
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
120
|
+
<div class="col-12">
|
121
|
+
<div class="row gy-4">
|
122
|
+
<% payment_icon_fields = [
|
123
|
+
{ field: :preferred_payment_checkout_image, label: Spree.t(:payment_checkout_image), target: 'checkout' },
|
124
|
+
{ field: :preferred_payment_failed_image, label: Spree.t(:payment_failed_image), target: 'failed' },
|
125
|
+
{ field: :preferred_payment_success_image, label: Spree.t(:payment_success_image), target: 'success' },
|
126
|
+
{ field: :preferred_payment_loader, label: Spree.t(:payment_loader), target: 'loader' }
|
127
|
+
] %>
|
128
|
+
|
129
|
+
<% payment_icon_fields.each do |icon| %>
|
130
|
+
<div class="col-md-3">
|
131
|
+
<%= f.field_container icon[:field] do %>
|
132
|
+
<div class="d-flex flex-column align-items-center text-center">
|
133
|
+
<label class="form-label fw-bold mb-2" for="tenant_<%= icon[:field] %>">
|
134
|
+
<%= icon[:label] %>
|
135
|
+
</label>
|
129
136
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
id="remove_<%= config[:field] %>"
|
140
|
-
title="Remove icon"
|
141
|
-
onclick="removeIcon('<%= config[:field] %>')"
|
142
|
-
>
|
143
|
-
×
|
144
|
-
</button>
|
137
|
+
<div class="icon-preview-container mb-2" id="icon-preview-container-<%= icon[:field] %>">
|
138
|
+
<span class="payment-icon-preview" id="icon-preview-<%= icon[:field] %>">
|
139
|
+
<% if f.object.send(icon[:field]).present? %>
|
140
|
+
<%= render_vector_icon(f.object.send(icon[:field])) %>
|
141
|
+
<% else %>
|
142
|
+
<span class="no-icon-placeholder"></span>
|
143
|
+
<% end %>
|
144
|
+
</span>
|
145
|
+
<span class="remove-icon-btn <%= 'hidden' unless f.object.send(icon[:field]).present? %>" data-target="<%= icon[:field] %>">×</span>
|
145
146
|
</div>
|
146
147
|
</div>
|
147
148
|
|
148
|
-
<%= f.
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
class: 'form-control select2-icon-picker',
|
155
|
-
data: {
|
156
|
-
target_field: config[:field],
|
157
|
-
target_preview: "preview_#{config[:field]}",
|
158
|
-
remove_btn: "remove_#{config[:field]}"
|
159
|
-
} %>
|
160
|
-
|
161
|
-
<% if f.object.errors[config[:field]].any? %>
|
162
|
-
<div class="error text-danger"><%= f.object.errors[config[:field]].join(', ') %></div>
|
149
|
+
<%= f.collection_select icon[:field],
|
150
|
+
@vector_icons, :path, :path,
|
151
|
+
{ include_blank: 'None' },
|
152
|
+
{ class: 'select2 form-control tenant-payment-icon-select mt-2', data: { target: icon[:target] } } %>
|
153
|
+
<% if f.object.errors[icon[:field]].any? %>
|
154
|
+
<div class="text-danger small mt-1"><%= f.object.errors[icon[:field]].join(', ') %></div>
|
163
155
|
<% end %>
|
164
156
|
<% end %>
|
165
157
|
</div>
|
166
|
-
|
158
|
+
<% end %>
|
167
159
|
</div>
|
168
|
-
|
160
|
+
</div>
|
169
161
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_cm_commissioner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.17.0.pre.
|
4
|
+
version: 1.17.0.pre.pre6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree
|