@dejwcake/craftable 0.0.1
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.
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/admin/Admin.js +42 -0
- package/dist/auth/Form.js +15 -0
- package/dist/base-components/Form/BaseForm.js +392 -0
- package/dist/base-components/Form/BaseUpload.js +188 -0
- package/dist/base-components/Form/bootstrap.js +21 -0
- package/dist/base-components/Listing/BaseListing.js +454 -0
- package/dist/base-components/Listing/components/Pagination.js +105 -0
- package/dist/base-components/Listing/components/Sortable.js +48 -0
- package/dist/base-components/Listing/components/UserDetailTooltip.js +55 -0
- package/dist/index.js +70 -0
- package/dist/overrides/trumbowyg.edit-embed-template.js +72 -0
- package/dist/overrides/trumbowyg.reupload.js +146 -0
- package/dist/overrides/trumbowyg.template.js +67 -0
- package/dist/translation/Form.js +15 -0
- package/dist/translation/Listing.js +283 -0
- package/dist/ui/index.js +33 -0
- package/img/favicon.png +0 -0
- package/img/logo.png +0 -0
- package/package.json +64 -0
- package/scss/_images.scss +18 -0
- package/scss/_variables.scss +17 -0
- package/scss/app.scss +9 -0
- package/scss/overrides/_alerts.scss +19 -0
- package/scss/overrides/_badges.scss +15 -0
- package/scss/overrides/_buttons.scss +62 -0
- package/scss/overrides/_cards.scss +72 -0
- package/scss/overrides/_checkboxes.scss +84 -0
- package/scss/overrides/_forms.scss +231 -0
- package/scss/overrides/_index.scss +19 -0
- package/scss/overrides/_keyframes.scss +23 -0
- package/scss/overrides/_layout.scss +47 -0
- package/scss/overrides/_media-wysiwyg.scss +111 -0
- package/scss/overrides/_modal.scss +26 -0
- package/scss/overrides/_multiselect.scss +39 -0
- package/scss/overrides/_nav.scss +87 -0
- package/scss/overrides/_notifications.scss +7 -0
- package/scss/overrides/_pagination.scss +38 -0
- package/scss/overrides/_switches.scss +23 -0
- package/scss/overrides/_tables.scss +64 -0
- package/scss/overrides/_text.scss +15 -0
- package/scss/overrides/_wysiwyg.scss +62 -0
- package/scss/styles/_auth.scss +92 -0
- package/scss/styles/_custom.scss +1 -0
- package/scss/styles/_index.scss +5 -0
- package/scss/styles/_legacy.scss +87 -0
- package/scss/styles/_others.scss +604 -0
- package/scss/vendor/_index.scss +4 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _BaseForm = require('./base-components/Form/BaseForm');
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'BaseForm', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _interopRequireDefault(_BaseForm).default;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var _BaseUpload = require('./base-components/Form/BaseUpload');
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, 'BaseUpload', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _interopRequireDefault(_BaseUpload).default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _BaseListing = require('./base-components/Listing/BaseListing');
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(exports, 'BaseListing', {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function get() {
|
|
30
|
+
return _interopRequireDefault(_BaseListing).default;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
var _Admin = require('./admin/Admin');
|
|
35
|
+
|
|
36
|
+
Object.defineProperty(exports, 'Admin', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _interopRequireDefault(_Admin).default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var _Form = require('./auth/Form');
|
|
44
|
+
|
|
45
|
+
Object.defineProperty(exports, 'Auth', {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function get() {
|
|
48
|
+
return _interopRequireDefault(_Form).default;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var _Form2 = require('./translation/Form');
|
|
53
|
+
|
|
54
|
+
Object.defineProperty(exports, 'TranslationForm', {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _interopRequireDefault(_Form2).default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
var _Listing = require('./translation/Listing');
|
|
62
|
+
|
|
63
|
+
Object.defineProperty(exports, 'TranslationListing', {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function get() {
|
|
66
|
+
return _interopRequireDefault(_Listing).default;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
(function ($) {
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
// My plugin default options
|
|
7
|
+
|
|
8
|
+
var defaultOptions = {
|
|
9
|
+
noEmbedEndpoint: 'https://noembed.com/embed?nowrap=on'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
$.extend(true, $.trumbowyg, {
|
|
13
|
+
// Add some translations
|
|
14
|
+
langs: {
|
|
15
|
+
en: {
|
|
16
|
+
editNoEmbedTemplate: 'Edit embed'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
// Add our plugin to Trumbowyg registred plugins
|
|
20
|
+
plugins: {
|
|
21
|
+
editNoEmbedTemplate: {
|
|
22
|
+
init: function init(trumbowyg) {
|
|
23
|
+
// Fill current Trumbowyg instance with my plugin default options
|
|
24
|
+
trumbowyg.o.plugins.editNoEmbedTemplate = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.editNoEmbedTemplate || {});
|
|
25
|
+
|
|
26
|
+
setTimeout(function () {
|
|
27
|
+
trumbowyg.$ed.on('dblclick', '.wysiwyg-noembed', function () {
|
|
28
|
+
var $iframe = $(this).find('iframe');
|
|
29
|
+
var $editor = $iframe.closest('.trumbowyg-editor');
|
|
30
|
+
var options = {
|
|
31
|
+
url: {
|
|
32
|
+
label: 'URL',
|
|
33
|
+
value: $iframe.attr('src'),
|
|
34
|
+
required: true
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
trumbowyg.openModalInsert(trumbowyg.lang.editNoEmbedTemplate, options, function (value) {
|
|
39
|
+
$.ajax({
|
|
40
|
+
url: trumbowyg.o.plugins.editNoEmbedTemplate.noEmbedEndpoint,
|
|
41
|
+
type: 'GET',
|
|
42
|
+
data: value,
|
|
43
|
+
cache: false,
|
|
44
|
+
dataType: 'jsonp',
|
|
45
|
+
crossOrigin: true,
|
|
46
|
+
success: trumbowyg.o.plugins.editNoEmbedTemplate.success || function (data) {
|
|
47
|
+
if (data.html) {
|
|
48
|
+
$iframe.replaceWith($(data.html));
|
|
49
|
+
trumbowyg.html($editor.html());
|
|
50
|
+
setTimeout(function () {
|
|
51
|
+
trumbowyg.closeModal();
|
|
52
|
+
}, 250);
|
|
53
|
+
} else {
|
|
54
|
+
trumbowyg.addErrorOnModalField($('input[type=text]', $modal), data.error);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
error: trumbowyg.o.plugins.editNoEmbedTemplate.error || function () {
|
|
58
|
+
trumbowyg.addErrorOnModalField($('input[type=text]', $modal), trumbowyg.lang.noembedError);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}, 300);
|
|
64
|
+
},
|
|
65
|
+
tagHandler: function tagHandler(element, trumbowyg) {
|
|
66
|
+
return [];
|
|
67
|
+
},
|
|
68
|
+
destroy: function destroy() {}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
})(jQuery);
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
(function ($) {
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
// My plugin default options
|
|
7
|
+
|
|
8
|
+
var defaultOptions = {};
|
|
9
|
+
|
|
10
|
+
$.extend(true, $.trumbowyg, {
|
|
11
|
+
// Add some translations
|
|
12
|
+
langs: {
|
|
13
|
+
en: {
|
|
14
|
+
reupload: 'Reupload',
|
|
15
|
+
reuploadImage: 'Reupload Image',
|
|
16
|
+
description: 'Alt Text'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
// Add our plugin to Trumbowyg registred plugins
|
|
20
|
+
plugins: {
|
|
21
|
+
reupload: {
|
|
22
|
+
init: function init(trumbowyg) {
|
|
23
|
+
// Fill current Trumbowyg instance with my plugin default options
|
|
24
|
+
trumbowyg.o.plugins.reupload = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.reupload || {});
|
|
25
|
+
|
|
26
|
+
trumbowyg.o.imgDblClickHandler = function () {
|
|
27
|
+
var t = trumbowyg;
|
|
28
|
+
|
|
29
|
+
return function () {
|
|
30
|
+
var $img = $(this),
|
|
31
|
+
src = $img.attr('src'),
|
|
32
|
+
base64 = '(Base64)';
|
|
33
|
+
|
|
34
|
+
if (src.indexOf('data:image') === 0) {
|
|
35
|
+
src = base64;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var options = {
|
|
39
|
+
url: {
|
|
40
|
+
label: 'URL',
|
|
41
|
+
value: src,
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
reupload: {
|
|
45
|
+
label: trumbowyg.lang.reuploadImage,
|
|
46
|
+
value: src,
|
|
47
|
+
type: 'file',
|
|
48
|
+
attributes: {
|
|
49
|
+
accept: 'image/*'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
alt: {
|
|
53
|
+
label: t.lang.description,
|
|
54
|
+
value: $img.attr('alt')
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (t.o.imageWidthModalEdit) {
|
|
59
|
+
options.width = {
|
|
60
|
+
value: $img.attr('width') ? $img.attr('width') : ''
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var $modal = t.openModalInsert(t.lang.insertImage, options, function (v) {
|
|
65
|
+
$img.attr({
|
|
66
|
+
alt: v.alt
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (t.o.imageWidthModalEdit) {
|
|
70
|
+
if (parseInt(v.width) > 0) {
|
|
71
|
+
$img.attr({
|
|
72
|
+
width: v.width
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
$img.removeAttr('width');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (v.src !== base64 && !v.reupload) {
|
|
80
|
+
$img.attr({
|
|
81
|
+
src: v.url
|
|
82
|
+
});
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (v.reupload) {
|
|
87
|
+
var prefix = trumbowyg.o.prefix;
|
|
88
|
+
var data = new FormData();
|
|
89
|
+
data.append(trumbowyg.o.plugins.upload.fileFieldName, $('.trumbowyg-modal input[type=file]').get(0).files[0]);
|
|
90
|
+
|
|
91
|
+
trumbowyg.o.plugins.upload.data.map(function (cur) {
|
|
92
|
+
data.append(cur.name, cur.value);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
$.map(v, function (curr, key) {
|
|
96
|
+
if (key !== 'file') {
|
|
97
|
+
data.append(key, curr);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
if ($('.' + prefix + 'progress', $modal).length === 0) {
|
|
102
|
+
$('.' + prefix + 'modal-title', $modal).after($('<div/>', {
|
|
103
|
+
'class': prefix + 'progress'
|
|
104
|
+
}).append($('<div/>', {
|
|
105
|
+
'class': prefix + 'progress-bar'
|
|
106
|
+
})));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
$.ajax({
|
|
110
|
+
url: trumbowyg.o.plugins.upload.serverPath,
|
|
111
|
+
headers: trumbowyg.o.plugins.upload.headers,
|
|
112
|
+
xhrFields: trumbowyg.o.plugins.upload.xhrFields,
|
|
113
|
+
type: 'POST',
|
|
114
|
+
data: data,
|
|
115
|
+
cache: false,
|
|
116
|
+
dataType: 'json',
|
|
117
|
+
processData: false,
|
|
118
|
+
contentType: false,
|
|
119
|
+
|
|
120
|
+
progressUpload: function progressUpload(e) {
|
|
121
|
+
$('.' + prefix + 'progress-bar').css('width', Math.round(e.loaded * 100 / e.total) + '%');
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
success: function success(data) {
|
|
125
|
+
trumbowyg.o.plugins.reupload.success(data, trumbowyg, $modal, v, $img);
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
error: trumbowyg.o.plugins.upload.error || function () {
|
|
129
|
+
trumbowyg.addErrorOnModalField($('input[type=file]', $modal), trumbowyg.lang.uploadError);
|
|
130
|
+
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return false;
|
|
136
|
+
};
|
|
137
|
+
}();
|
|
138
|
+
},
|
|
139
|
+
tagHandler: function tagHandler(element, trumbowyg) {
|
|
140
|
+
return [];
|
|
141
|
+
},
|
|
142
|
+
destroy: function destroy() {}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
})(jQuery);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
(function ($) {
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
// Adds the language variables
|
|
7
|
+
|
|
8
|
+
$.extend(true, $.trumbowyg, {
|
|
9
|
+
langs: {
|
|
10
|
+
en: {
|
|
11
|
+
template: 'Template'
|
|
12
|
+
},
|
|
13
|
+
fr: {
|
|
14
|
+
template: 'Patron'
|
|
15
|
+
},
|
|
16
|
+
nl: {
|
|
17
|
+
template: 'Sjabloon'
|
|
18
|
+
},
|
|
19
|
+
ru: {
|
|
20
|
+
template: 'Шаблон'
|
|
21
|
+
},
|
|
22
|
+
ja: {
|
|
23
|
+
template: 'テンプレート'
|
|
24
|
+
},
|
|
25
|
+
tr: {
|
|
26
|
+
template: 'Şablon'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Adds the extra button definition
|
|
32
|
+
$.extend(true, $.trumbowyg, {
|
|
33
|
+
plugins: {
|
|
34
|
+
template: {
|
|
35
|
+
shouldInit: function shouldInit(trumbowyg) {
|
|
36
|
+
return trumbowyg.o.plugins.hasOwnProperty('templates');
|
|
37
|
+
},
|
|
38
|
+
init: function init(trumbowyg) {
|
|
39
|
+
trumbowyg.addBtnDef('template', {
|
|
40
|
+
dropdown: templateSelector(trumbowyg),
|
|
41
|
+
hasIcon: false,
|
|
42
|
+
text: trumbowyg.lang.template
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Creates the template-selector dropdown.
|
|
50
|
+
function templateSelector(trumbowyg) {
|
|
51
|
+
var available = trumbowyg.o.plugins.templates;
|
|
52
|
+
var templates = [];
|
|
53
|
+
|
|
54
|
+
$.each(available, function (index, template) {
|
|
55
|
+
trumbowyg.addBtnDef('template_' + index, {
|
|
56
|
+
fn: function fn() {
|
|
57
|
+
trumbowyg.execCmd('insertHTML', template.html + '<br>');
|
|
58
|
+
},
|
|
59
|
+
hasIcon: false,
|
|
60
|
+
title: template.name
|
|
61
|
+
});
|
|
62
|
+
templates.push('template_' + index);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return templates;
|
|
66
|
+
}
|
|
67
|
+
})(jQuery);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _vue = require('vue');
|
|
4
|
+
|
|
5
|
+
var _vue2 = _interopRequireDefault(_vue);
|
|
6
|
+
|
|
7
|
+
var _BaseForm = require('../base-components/Form/BaseForm');
|
|
8
|
+
|
|
9
|
+
var _BaseForm2 = _interopRequireDefault(_BaseForm);
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
_vue2.default.component('translation-form', {
|
|
14
|
+
mixins: [_BaseForm2.default]
|
|
15
|
+
});
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _vue = require('vue');
|
|
4
|
+
|
|
5
|
+
var _vue2 = _interopRequireDefault(_vue);
|
|
6
|
+
|
|
7
|
+
var _BaseListing = require('../base-components/Listing/BaseListing');
|
|
8
|
+
|
|
9
|
+
var _BaseListing2 = _interopRequireDefault(_BaseListing);
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
$(document).ready(function ($) {
|
|
14
|
+
$(document).on('click', '.close_button', function (e) {
|
|
15
|
+
$(this).closest('.show').removeClass('show');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
$(document).on('click', '.dropdown-menu.dropdown-menu-dont-auto-close', function (e) {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
_vue2.default.component('translation-listing', {
|
|
24
|
+
|
|
25
|
+
mixins: [_BaseListing2.default],
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: function _default() {
|
|
31
|
+
return 'All groups';
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
stepCount: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: function _default() {
|
|
37
|
+
return 3;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
locales: {}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
data: function data() {
|
|
44
|
+
var exportMultiselect = {};
|
|
45
|
+
Object.values(this.locales).forEach(function (value) {
|
|
46
|
+
exportMultiselect[value] = true;
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
templateChecked: false,
|
|
50
|
+
exportMultiselect: exportMultiselect,
|
|
51
|
+
languagesToExport: this.locales,
|
|
52
|
+
importLanguage: '',
|
|
53
|
+
file: null,
|
|
54
|
+
onlyMissing: false,
|
|
55
|
+
currentStep: 1,
|
|
56
|
+
scanning: false,
|
|
57
|
+
filters: {
|
|
58
|
+
group: null
|
|
59
|
+
},
|
|
60
|
+
translationId: null,
|
|
61
|
+
translationDefault: '',
|
|
62
|
+
numberOfSuccessfullyImportedTranslations: 0,
|
|
63
|
+
numberOfSuccessfullyUpdatedTranslations: 0,
|
|
64
|
+
numberOfFoundTranslations: 0,
|
|
65
|
+
numberOfTranslationsToReview: 0,
|
|
66
|
+
translationsToImport: null,
|
|
67
|
+
translations: {},
|
|
68
|
+
importedFile: null
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
watch: {
|
|
73
|
+
exportMultiselect: {
|
|
74
|
+
handler: function handler(newVal, oldVal) {
|
|
75
|
+
var _this = this;
|
|
76
|
+
|
|
77
|
+
this.languagesToExport = [];
|
|
78
|
+
|
|
79
|
+
Object.keys(newVal).forEach(function (key) {
|
|
80
|
+
if (newVal[key]) {
|
|
81
|
+
_this.languagesToExport.push(key);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
deep: true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
computed: {
|
|
90
|
+
filteredGroup: function filteredGroup() {
|
|
91
|
+
return this.filters.group === null ? this.label : this.filters.group;
|
|
92
|
+
},
|
|
93
|
+
lastStep: function lastStep() {
|
|
94
|
+
return this.currentStep === this.stepCount;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
rescan: function rescan(url) {
|
|
99
|
+
var _this2 = this;
|
|
100
|
+
|
|
101
|
+
this.scanning = true;
|
|
102
|
+
axios.post(url).then(function (response) {
|
|
103
|
+
_this2.scanning = false;
|
|
104
|
+
_this2.loadData(true);
|
|
105
|
+
}, function (error) {
|
|
106
|
+
_this2.scanning = false;
|
|
107
|
+
_this2.$notify({ type: 'error', title: 'Error!', text: 'An error has occured.' });
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
filterGroup: function filterGroup(group) {
|
|
111
|
+
this.filters.group = group;
|
|
112
|
+
this.loadData(true);
|
|
113
|
+
},
|
|
114
|
+
resetGroup: function resetGroup() {
|
|
115
|
+
this.filters.group = null;
|
|
116
|
+
this.loadData(true);
|
|
117
|
+
},
|
|
118
|
+
editTranslation: function editTranslation(item) {
|
|
119
|
+
this.$modal.show('edit-translation', item);
|
|
120
|
+
},
|
|
121
|
+
showImport: function showImport() {
|
|
122
|
+
this.$modal.show('import-translation');
|
|
123
|
+
},
|
|
124
|
+
showExport: function showExport() {
|
|
125
|
+
this.$modal.show('export-translation');
|
|
126
|
+
},
|
|
127
|
+
nextStep: function nextStep() {
|
|
128
|
+
var _this3 = this;
|
|
129
|
+
|
|
130
|
+
if (this.currentStep === 1) {
|
|
131
|
+
return this.$validator.validateAll().then(function (result) {
|
|
132
|
+
if (!result) {
|
|
133
|
+
_this3.$notify({ type: 'error', title: 'Error!', text: 'The form contains invalid fields.' });
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var url = '/admin/translations/import';
|
|
138
|
+
var formData = new FormData();
|
|
139
|
+
|
|
140
|
+
formData.append('fileImport', _this3.file);
|
|
141
|
+
formData.append('importLanguage', _this3.importLanguage);
|
|
142
|
+
formData.append('onlyMissing', _this3.onlyMissing);
|
|
143
|
+
|
|
144
|
+
axios.post(url, formData, {
|
|
145
|
+
headers: {
|
|
146
|
+
'Content-Type': 'multipart/form-data'
|
|
147
|
+
}
|
|
148
|
+
}).then(function (response) {
|
|
149
|
+
if (response.data.hasOwnProperty('numberOfImportedTranslations') && response.data.hasOwnProperty('numberOfUpdatedTranslations')) {
|
|
150
|
+
_this3.currentStep = 3;
|
|
151
|
+
_this3.numberOfSuccessfullyImportedTranslations = response.data.numberOfImportedTranslations;
|
|
152
|
+
_this3.numberOfSuccessfullyUpdatedTranslations = response.data.numberOfUpdatedTranslations;
|
|
153
|
+
_this3.loadData();
|
|
154
|
+
} else {
|
|
155
|
+
_this3.currentStep = 2;
|
|
156
|
+
_this3.numberOfFoundTranslations = Object.keys(response.data).length;
|
|
157
|
+
_this3.translationsToImport = response.data;
|
|
158
|
+
|
|
159
|
+
for (var i = 0; i < _this3.translationsToImport.length; i++) {
|
|
160
|
+
if (_this3.translationsToImport[i].hasOwnProperty('has_conflict')) {
|
|
161
|
+
if (_this3.translationsToImport[i].has_conflict) {
|
|
162
|
+
_this3.numberOfTranslationsToReview++;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, function (error) {
|
|
168
|
+
if (error.response.data === "Wrong syntax in your import") _this3.$notify({ type: 'error', title: 'Error!', text: 'Wrong syntax in your import.' });else if (error.response.data === "Unsupported file type") _this3.$notify({ type: 'error', title: 'Error!', text: 'Unsupported file type.' });else _this3.$notify({ type: 'error', title: 'Error!', text: 'An error has occured.' });
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
} else if (this.currentStep === 2) {
|
|
172
|
+
return this.$validator.validateAll().then(function (result) {
|
|
173
|
+
if (!result) {
|
|
174
|
+
_this3.$notify({ type: 'error', title: 'Error!', text: 'The form contains invalid fields.' });
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (var i = 0; i < _this3.translationsToImport.length; i++) {
|
|
179
|
+
if (_this3.translationsToImport[i].hasOwnProperty('checkedCurrent')) {
|
|
180
|
+
if (_this3.translationsToImport[i].checkedCurrent) {
|
|
181
|
+
_this3.translationsToImport[i][_this3.importLanguage.toLowerCase()] = _this3.translationsToImport[i].current_value;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
var url = '/admin/translations/import/conflicts';
|
|
187
|
+
var data = {
|
|
188
|
+
importLanguage: _this3.importLanguage,
|
|
189
|
+
resolvedTranslations: _this3.translationsToImport
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
axios.post(url, data).then(function (response) {
|
|
193
|
+
_this3.currentStep = 3;
|
|
194
|
+
_this3.numberOfSuccessfullyImportedTranslations = response.data.numberOfImportedTranslations;
|
|
195
|
+
_this3.numberOfSuccessfullyUpdatedTranslations = response.data.numberOfUpdatedTranslations;
|
|
196
|
+
_this3.loadData();
|
|
197
|
+
}, function (error) {
|
|
198
|
+
_this3.$notify({ type: 'error', title: 'Error!', text: 'An error has occured.' });
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
previousStep: function previousStep() {
|
|
204
|
+
this.currentStep--;
|
|
205
|
+
},
|
|
206
|
+
beforeModalOpen: function beforeModalOpen(_ref) {
|
|
207
|
+
var params = _ref.params;
|
|
208
|
+
|
|
209
|
+
this.translationId = params.id;
|
|
210
|
+
this.translationDefault = params.key;
|
|
211
|
+
this.translations = {};
|
|
212
|
+
var _iteratorNormalCompletion = true;
|
|
213
|
+
var _didIteratorError = false;
|
|
214
|
+
var _iteratorError = undefined;
|
|
215
|
+
|
|
216
|
+
try {
|
|
217
|
+
for (var _iterator = Object.keys(params.text)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
218
|
+
var key = _step.value;
|
|
219
|
+
|
|
220
|
+
this.translations[key] = params.text[key];
|
|
221
|
+
}
|
|
222
|
+
} catch (err) {
|
|
223
|
+
_didIteratorError = true;
|
|
224
|
+
_iteratorError = err;
|
|
225
|
+
} finally {
|
|
226
|
+
try {
|
|
227
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
228
|
+
_iterator.return();
|
|
229
|
+
}
|
|
230
|
+
} finally {
|
|
231
|
+
if (_didIteratorError) {
|
|
232
|
+
throw _iteratorError;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
onSubmit: function onSubmit() {
|
|
238
|
+
var _this4 = this;
|
|
239
|
+
|
|
240
|
+
var url = '/admin/translations/' + this.translationId;
|
|
241
|
+
var data = {
|
|
242
|
+
text: this.translations
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
axios.post(url, data).then(function (response) {
|
|
246
|
+
_this4.$modal.hide('edit-translation');
|
|
247
|
+
_this4.$notify({ type: 'success', title: 'Success!', text: 'Item successfully changed.' });
|
|
248
|
+
_this4.loadData();
|
|
249
|
+
}, function (error) {
|
|
250
|
+
_this4.$notify({ type: 'error', title: 'Error!', text: 'An error has occured.' });
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
onSubmitExport: function onSubmitExport() {
|
|
254
|
+
var _this5 = this;
|
|
255
|
+
|
|
256
|
+
return this.$validator.validateAll().then(function (result) {
|
|
257
|
+
if (!result) {
|
|
258
|
+
_this5.$notify({ type: 'error', title: 'Error!', text: 'The form contains invalid fields.' });
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var data = {
|
|
263
|
+
exportLanguages: _this5.languagesToExport
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
var url = '/admin/translations/export?' + $.param(data);
|
|
267
|
+
window.location = url;
|
|
268
|
+
_this5.$modal.hide('export-translation');
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
handleImportFileUpload: function handleImportFileUpload(e) {
|
|
272
|
+
this.file = this.$refs.file.files[0];
|
|
273
|
+
this.importedFile = e.target.files[0];
|
|
274
|
+
},
|
|
275
|
+
onCloseImportModal: function onCloseImportModal() {
|
|
276
|
+
this.currentStep = 1;
|
|
277
|
+
this.importedFile = '';
|
|
278
|
+
this.importLanguage = '';
|
|
279
|
+
this.onlyMissing = false;
|
|
280
|
+
this.translationsToImport = null;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
});
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('popper.js');
|
|
4
|
+
|
|
5
|
+
require('bootstrap');
|
|
6
|
+
|
|
7
|
+
require('@coreui/coreui');
|
|
8
|
+
|
|
9
|
+
$(function () {
|
|
10
|
+
// spinner buttons
|
|
11
|
+
$('.btn-spinner').on('click', function (e) {
|
|
12
|
+
if (!(e.shiftKey || e.ctrlKey || e.metaKey)) {
|
|
13
|
+
$(this).css({ 'pointer-events': 'none' });
|
|
14
|
+
$(this).find('i').removeClass().addClass('fa fa-spinner');
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// dropdown Menu
|
|
19
|
+
$('.dropdown-toggle').on('click', function () {
|
|
20
|
+
$(this).parent().toggleClass('open');
|
|
21
|
+
});
|
|
22
|
+
$('.dropdown-item').on('click', function () {
|
|
23
|
+
$(this).closest('.open').removeClass('open');
|
|
24
|
+
});
|
|
25
|
+
$('.dropdown-menu').on('mouseleave', function () {
|
|
26
|
+
$(this).parent('.dropdown').removeClass('open');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// remove empty nav titles when no children there
|
|
30
|
+
$('.nav-title').filter(function () {
|
|
31
|
+
return !$(this).next().hasClass('nav-item');
|
|
32
|
+
}).hide();
|
|
33
|
+
});
|
package/img/favicon.png
ADDED
|
Binary file
|