@oxyshop/admin 1.3.43 → 1.3.47
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index.js +83 -0
- package/package.json +1 -1
- package/src/components/article-slug.js +65 -0
- package/src/index.js +1 -0
- package/src/plugins/ckeditor/index.js +18 -0
package/lib/index.js
CHANGED
@@ -2103,6 +2103,71 @@ class CustomerGroupingRuleConfiguration {
|
|
2103
2103
|
});
|
2104
2104
|
})(jQuery);
|
2105
2105
|
|
2106
|
+
(function ($) {
|
2107
|
+
|
2108
|
+
$.fn.extend({
|
2109
|
+
articleSlugGenerator: function () {
|
2110
|
+
let timeout;
|
2111
|
+
|
2112
|
+
$('[name*="nextgen_cms_bundle_article[translations]"][name*="[name]"]').on('input', function () {
|
2113
|
+
clearTimeout(timeout);
|
2114
|
+
let element = $(this);
|
2115
|
+
|
2116
|
+
timeout = setTimeout(function () {
|
2117
|
+
updateSlug(element);
|
2118
|
+
}, 1000);
|
2119
|
+
});
|
2120
|
+
|
2121
|
+
$('.toggle-article-slug-modification').on('click', function (e) {
|
2122
|
+
e.preventDefault();
|
2123
|
+
toggleSlugModification($(this), $(this).siblings('input'));
|
2124
|
+
});
|
2125
|
+
|
2126
|
+
function updateSlug(element) {
|
2127
|
+
let slugInput = element.parents('.content').find('[name*="[slug]"]');
|
2128
|
+
let loadableParent = slugInput.parents('.field.loadable');
|
2129
|
+
|
2130
|
+
if ('readonly' === slugInput.attr('readonly')) {
|
2131
|
+
return
|
2132
|
+
}
|
2133
|
+
|
2134
|
+
loadableParent.addClass('loading');
|
2135
|
+
|
2136
|
+
$.ajax({
|
2137
|
+
type: 'GET',
|
2138
|
+
url: slugInput.attr('data-url'),
|
2139
|
+
data: { name: element.val() },
|
2140
|
+
dataType: 'json',
|
2141
|
+
accept: 'application/json',
|
2142
|
+
success: function (data) {
|
2143
|
+
slugInput.val(data.slug);
|
2144
|
+
if (slugInput.parents('.field').hasClass('error')) {
|
2145
|
+
slugInput.parents('.field').removeClass('error');
|
2146
|
+
slugInput.parents('.field').find('.sylius-validation-error').remove();
|
2147
|
+
}
|
2148
|
+
loadableParent.removeClass('loading');
|
2149
|
+
},
|
2150
|
+
});
|
2151
|
+
}
|
2152
|
+
|
2153
|
+
function toggleSlugModification(button, slugInput) {
|
2154
|
+
if (slugInput.attr('readonly')) {
|
2155
|
+
slugInput.removeAttr('readonly');
|
2156
|
+
button.html('<i class="unlock icon"></i>');
|
2157
|
+
} else {
|
2158
|
+
slugInput.attr('readonly', 'readonly');
|
2159
|
+
button.html('<i class="lock icon"></i>');
|
2160
|
+
}
|
2161
|
+
}
|
2162
|
+
},
|
2163
|
+
});
|
2164
|
+
})(jQuery)
|
2165
|
+
;(function ($) {
|
2166
|
+
$(document).ready(function () {
|
2167
|
+
$(this).articleSlugGenerator();
|
2168
|
+
});
|
2169
|
+
})(jQuery);
|
2170
|
+
|
2106
2171
|
(function ($) {
|
2107
2172
|
|
2108
2173
|
$.fn.extend({
|
@@ -2267,6 +2332,24 @@ vendorDescriptionElements.forEach((element) => {
|
|
2267
2332
|
CKEDITOR.replace(element.name, ckEditorOptions);
|
2268
2333
|
});
|
2269
2334
|
|
2335
|
+
/**
|
2336
|
+
* Blog article
|
2337
|
+
*/
|
2338
|
+
const articleAnnotationElements = document.querySelectorAll(
|
2339
|
+
'form[name="nextgen_cms_bundle_article"] textarea[name$="[annotation]"]'
|
2340
|
+
);
|
2341
|
+
articleAnnotationElements.forEach((element) => {
|
2342
|
+
// eslint-disable-next-line no-undef
|
2343
|
+
CKEDITOR.replace(element.name, ckEditorOptions);
|
2344
|
+
});
|
2345
|
+
const articleContentElements = document.querySelectorAll(
|
2346
|
+
'form[name="nextgen_cms_bundle_article"] textarea[name$="[content]"]'
|
2347
|
+
);
|
2348
|
+
articleContentElements.forEach((element) => {
|
2349
|
+
// eslint-disable-next-line no-undef
|
2350
|
+
CKEDITOR.replace(element.name, ckEditorOptions);
|
2351
|
+
});
|
2352
|
+
|
2270
2353
|
/**
|
2271
2354
|
* Blog category
|
2272
2355
|
*/
|
package/package.json
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
;(function ($) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
$.fn.extend({
|
5
|
+
articleSlugGenerator: function () {
|
6
|
+
let timeout
|
7
|
+
|
8
|
+
$('[name*="nextgen_cms_bundle_article[translations]"][name*="[name]"]').on('input', function () {
|
9
|
+
clearTimeout(timeout)
|
10
|
+
let element = $(this)
|
11
|
+
|
12
|
+
timeout = setTimeout(function () {
|
13
|
+
updateSlug(element)
|
14
|
+
}, 1000)
|
15
|
+
})
|
16
|
+
|
17
|
+
$('.toggle-article-slug-modification').on('click', function (e) {
|
18
|
+
e.preventDefault()
|
19
|
+
toggleSlugModification($(this), $(this).siblings('input'))
|
20
|
+
})
|
21
|
+
|
22
|
+
function updateSlug(element) {
|
23
|
+
let slugInput = element.parents('.content').find('[name*="[slug]"]')
|
24
|
+
let loadableParent = slugInput.parents('.field.loadable')
|
25
|
+
|
26
|
+
if ('readonly' === slugInput.attr('readonly')) {
|
27
|
+
return
|
28
|
+
}
|
29
|
+
|
30
|
+
loadableParent.addClass('loading')
|
31
|
+
|
32
|
+
$.ajax({
|
33
|
+
type: 'GET',
|
34
|
+
url: slugInput.attr('data-url'),
|
35
|
+
data: { name: element.val() },
|
36
|
+
dataType: 'json',
|
37
|
+
accept: 'application/json',
|
38
|
+
success: function (data) {
|
39
|
+
slugInput.val(data.slug)
|
40
|
+
if (slugInput.parents('.field').hasClass('error')) {
|
41
|
+
slugInput.parents('.field').removeClass('error')
|
42
|
+
slugInput.parents('.field').find('.sylius-validation-error').remove()
|
43
|
+
}
|
44
|
+
loadableParent.removeClass('loading')
|
45
|
+
},
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
function toggleSlugModification(button, slugInput) {
|
50
|
+
if (slugInput.attr('readonly')) {
|
51
|
+
slugInput.removeAttr('readonly')
|
52
|
+
button.html('<i class="unlock icon"></i>')
|
53
|
+
} else {
|
54
|
+
slugInput.attr('readonly', 'readonly')
|
55
|
+
button.html('<i class="lock icon"></i>')
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
})
|
60
|
+
})(jQuery)
|
61
|
+
;(function ($) {
|
62
|
+
$(document).ready(function () {
|
63
|
+
$(this).articleSlugGenerator()
|
64
|
+
})
|
65
|
+
})(jQuery)
|
package/src/index.js
CHANGED
@@ -11,6 +11,7 @@ import TooltipHelpers from './components/tooltipHelpers'
|
|
11
11
|
import AdminSidebarScroller from './components/adminSidebarScroller'
|
12
12
|
import CustomerGroupingRuleConfiguration from './components/customerGroupingRuleConfiguration'
|
13
13
|
import './components/blog-slug.js'
|
14
|
+
import './components/article-slug.js'
|
14
15
|
import './components/blog-category-slug.js'
|
15
16
|
|
16
17
|
// Scripts - plugin
|
@@ -91,6 +91,24 @@ vendorDescriptionElements.forEach((element) => {
|
|
91
91
|
CKEDITOR.replace(element.name, ckEditorOptions)
|
92
92
|
})
|
93
93
|
|
94
|
+
/**
|
95
|
+
* Blog article
|
96
|
+
*/
|
97
|
+
const articleAnnotationElements = document.querySelectorAll(
|
98
|
+
'form[name="nextgen_cms_bundle_article"] textarea[name$="[annotation]"]'
|
99
|
+
)
|
100
|
+
articleAnnotationElements.forEach((element) => {
|
101
|
+
// eslint-disable-next-line no-undef
|
102
|
+
CKEDITOR.replace(element.name, ckEditorOptions)
|
103
|
+
})
|
104
|
+
const articleContentElements = document.querySelectorAll(
|
105
|
+
'form[name="nextgen_cms_bundle_article"] textarea[name$="[content]"]'
|
106
|
+
)
|
107
|
+
articleContentElements.forEach((element) => {
|
108
|
+
// eslint-disable-next-line no-undef
|
109
|
+
CKEDITOR.replace(element.name, ckEditorOptions)
|
110
|
+
})
|
111
|
+
|
94
112
|
/**
|
95
113
|
* Blog category
|
96
114
|
*/
|