@dejwcake/craftable 0.1.10 → 2.0.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.
- package/README.md +117 -3
- package/dist/buildMatchPatternFn-BV4I8r8j.js +63 -0
- package/dist/buildMatchPatternFn-T5KjFTBQ.cjs +1 -0
- package/dist/craftable.css +2 -0
- package/dist/cs-B5QMxFrl.js +682 -0
- package/dist/cs-MAoetkhe.cjs +1 -0
- package/dist/de-BlQ2ZKmc.js +526 -0
- package/dist/de-BoVLAn6U.cjs +1 -0
- package/dist/en-US-BLvEnhs4.js +443 -0
- package/dist/en-US-Dz8vkDZ_.cjs +1 -0
- package/dist/en-US-X9gX759i.cjs +1 -0
- package/dist/es-DBHDeXHI.cjs +1 -0
- package/dist/es-YEqfkBY2.js +437 -0
- package/dist/fr-B7MHC2AN.js +407 -0
- package/dist/fr-DLs3QoNB.cjs +1 -0
- package/dist/hu-BKZPI9jH.cjs +1 -0
- package/dist/hu-reoJgNxD.js +425 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +3866 -0
- package/dist/isSameWeek-CC6GX_zp.js +40 -0
- package/dist/isSameWeek-Mctj6Tdj.cjs +1 -0
- package/dist/pl-B5A0Rjp7.js +628 -0
- package/dist/pl-BMyrOO-Q.cjs +1 -0
- package/dist/sk-B7JF2MoV.cjs +1 -0
- package/dist/sk-Btro3W4S.js +602 -0
- package/package.json +68 -40
- package/scripts/publish-components.js +118 -0
- package/scss/_images.scss +1 -1
- package/scss/_variables.scss +13 -6
- package/scss/app.scss +4 -4
- package/scss/overrides/_alerts.scss +0 -2
- package/scss/overrides/_badges.scss +1 -17
- package/scss/overrides/_buttons.scss +64 -7
- package/scss/overrides/_cards.scss +4 -51
- package/scss/overrides/_checkboxes.scss +54 -59
- package/scss/overrides/_forms.scss +270 -176
- package/scss/overrides/_index.scss +18 -18
- package/scss/overrides/_keyframes.scss +6 -4
- package/scss/overrides/_layout.scss +24 -30
- package/scss/overrides/_media-wysiwyg.scss +9 -111
- package/scss/overrides/_modal.scss +0 -18
- package/scss/overrides/_multiselect.scss +63 -7
- package/scss/overrides/_nav.scss +55 -33
- package/scss/overrides/_notifications.scss +6 -1
- package/scss/overrides/_pagination.scss +3 -3
- package/scss/overrides/_sidebar.scss +84 -0
- package/scss/overrides/_tables.scss +52 -37
- package/scss/overrides/_text.scss +1 -3
- package/scss/overrides/_wysiwyg.scss +151 -48
- package/scss/styles/_auth.scss +32 -37
- package/scss/styles/_custom.scss +44 -1
- package/scss/styles/_index.scss +4 -4
- package/scss/styles/_legacy.scss +5 -81
- package/scss/styles/_others.scss +232 -337
- package/scss/vendor/_index.scss +5 -4
- package/src/auth/ActivationError.vue +23 -0
- package/src/auth/ActivationForm.vue +69 -0
- package/src/auth/ForgotPasswordForm.vue +74 -0
- package/src/auth/LoginForm.vue +107 -0
- package/src/auth/ResetPasswordForm.vue +122 -0
- package/src/components/ConfirmModal.vue +65 -0
- package/src/components/UserDetailTooltip.vue +88 -0
- package/src/components/form/CkeditorEditor.vue +205 -0
- package/src/components/form/FormCheckbox.vue +29 -0
- package/src/components/form/FormDatePicker.vue +52 -0
- package/src/components/form/FormEmail.vue +17 -0
- package/src/components/form/FormInput.vue +31 -0
- package/src/components/form/FormLocalizedInput.vue +47 -0
- package/src/components/form/FormLocalizedWysiwyg.vue +55 -0
- package/src/components/form/FormLocalizedWysiwygSimple.vue +55 -0
- package/src/components/form/FormMultiSelect.vue +36 -0
- package/src/components/form/FormPasswordConfirm.vue +49 -0
- package/src/components/form/FormSelect.vue +35 -0
- package/src/components/form/FormSubmit.vue +13 -0
- package/src/components/form/FormTextarea.vue +31 -0
- package/src/components/form/FormWysiwyg.vue +31 -0
- package/src/components/form/FormWysiwygSimple.vue +31 -0
- package/src/components/form/LocalizationBar.vue +90 -0
- package/src/components/form/MediaUpload.vue +317 -0
- package/src/components/form/TiptapEditor.vue +238 -0
- package/src/components/listing/BulkCheckboxHeader.vue +18 -0
- package/src/components/listing/BulkCheckboxRow.vue +21 -0
- package/src/components/listing/BulkOperationsBar.vue +41 -0
- package/src/components/listing/DeleteButton.vue +46 -0
- package/src/components/listing/EditButton.vue +17 -0
- package/src/components/listing/EmptyState.vue +25 -0
- package/src/components/listing/ListingHeader.vue +24 -0
- package/src/components/listing/Pagination.vue +158 -0
- package/src/components/listing/PerPage.vue +15 -0
- package/src/components/listing/PublishedAtColumn.vue +226 -0
- package/src/components/listing/Search.vue +81 -0
- package/src/components/listing/Sortable.vue +28 -0
- package/src/components/listing/ToggleSwitch.vue +47 -0
- package/src/composables/useAdmin.js +39 -0
- package/src/composables/useBaseAuth.js +81 -0
- package/src/composables/useBaseForm.js +265 -0
- package/src/composables/useBaseListing.js +316 -0
- package/src/composables/useResponsiveColumns.js +62 -0
- package/src/index.js +62 -0
- package/src/translation/TranslationListing.vue +230 -0
- package/src/translation/modals/TranslationEditModal.vue +86 -0
- package/src/translation/modals/TranslationExportModal.vue +74 -0
- package/src/translation/modals/TranslationImportModal.vue +255 -0
- package/src/ui/index.js +99 -0
- package/src/utils/ckeditorHelpers.js +36 -0
- package/src/utils/dateFnsLocale.js +24 -0
- package/src/utils/dateFormatters.js +30 -0
- package/src/utils/mediaProps.js +14 -0
- package/src/utils/notify.js +22 -0
- package/dist/admin/Admin.js +0 -42
- package/dist/auth/Form.js +0 -15
- package/dist/base-components/Form/BaseForm.js +0 -395
- package/dist/base-components/Form/BaseUpload.js +0 -188
- package/dist/base-components/Form/bootstrap.js +0 -21
- package/dist/base-components/Listing/BaseListing.js +0 -454
- package/dist/base-components/Listing/components/Pagination.js +0 -105
- package/dist/base-components/Listing/components/Sortable.js +0 -48
- package/dist/base-components/Listing/components/UserDetailTooltip.js +0 -55
- package/dist/index.js +0 -70
- package/dist/overrides/trumbowyg.edit-embed-template.js +0 -72
- package/dist/overrides/trumbowyg.reupload.js +0 -146
- package/dist/overrides/trumbowyg.template.js +0 -67
- package/dist/translation/Form.js +0 -15
- package/dist/translation/Listing.js +0 -283
- package/dist/ui/index.js +0 -33
- package/scss/overrides/_switches.scss +0 -25
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _vue2Dropzone = require('vue2-dropzone');
|
|
8
|
-
|
|
9
|
-
var _vue2Dropzone2 = _interopRequireDefault(_vue2Dropzone);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
var BaseUpload = {
|
|
14
|
-
components: {
|
|
15
|
-
Dropzone: _vue2Dropzone2.default
|
|
16
|
-
},
|
|
17
|
-
props: {
|
|
18
|
-
url: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true
|
|
21
|
-
},
|
|
22
|
-
collection: {
|
|
23
|
-
type: String,
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
maxNumberOfFiles: {
|
|
27
|
-
type: Number,
|
|
28
|
-
required: false,
|
|
29
|
-
default: 1
|
|
30
|
-
},
|
|
31
|
-
maxFileSizeInMb: {
|
|
32
|
-
type: Number,
|
|
33
|
-
required: false,
|
|
34
|
-
default: 2
|
|
35
|
-
},
|
|
36
|
-
acceptedFileTypes: {
|
|
37
|
-
type: String,
|
|
38
|
-
required: false
|
|
39
|
-
},
|
|
40
|
-
thumbnailWidth: {
|
|
41
|
-
type: Number,
|
|
42
|
-
required: false,
|
|
43
|
-
default: 200
|
|
44
|
-
},
|
|
45
|
-
uploadedImages: {
|
|
46
|
-
type: Array,
|
|
47
|
-
required: false,
|
|
48
|
-
default: function _default() {
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
data: function data() {
|
|
54
|
-
return {
|
|
55
|
-
mutableUploadedImages: this.uploadedImages,
|
|
56
|
-
headers: {
|
|
57
|
-
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
template: '<dropzone :id="collection" \n :url="url" \n v-bind:preview-template="template"\n v-on:vdropzone-success="onSuccess"\n v-on:vdropzone-error="onUploadError"\n v-on:vdropzone-removed-file="onFileDelete"\n v-on:vdropzone-file-added="onFileAdded"\n :useFontAwesome="true" \n :ref="collection"\n :maxNumberOfFiles="maxNumberOfFiles"\n :maxFileSizeInMB="maxFileSizeInMb"\n :acceptedFileTypes="acceptedFileTypes"\n :thumbnailWidth="thumbnailWidth"\n :headers="headers">\n \n <input type="hidden" name="collection" :value="collection">\n </dropzone>',
|
|
62
|
-
mounted: function mounted() {
|
|
63
|
-
this.attachAlreadyUploadedMedia();
|
|
64
|
-
},
|
|
65
|
-
methods: {
|
|
66
|
-
onSuccess: function onSuccess(file, response) {
|
|
67
|
-
if (!file.type.includes('image')) {
|
|
68
|
-
setTimeout(function () {
|
|
69
|
-
//FIXME jquery
|
|
70
|
-
$(file.previewElement).removeClass('dz-file-preview');
|
|
71
|
-
}, 3000);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
onUploadError: function onUploadError(file, error) {
|
|
76
|
-
var errorMessage = typeof error == 'string' ? error : error.message;
|
|
77
|
-
this.$notify({ type: 'error', title: 'Error!', text: errorMessage });
|
|
78
|
-
$(file.previewElement).find('.dz-error-message span').text(errorMessage);
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
onFileAdded: function onFileAdded(file) {
|
|
82
|
-
this.placeIcon(file);
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
onFileDelete: function onFileDelete(file, error, xhr) {
|
|
86
|
-
var deletedFileIndex = _.findIndex(this.mutableUploadedImages, { url: file.url });
|
|
87
|
-
if (this.mutableUploadedImages[deletedFileIndex]) {
|
|
88
|
-
this.mutableUploadedImages[deletedFileIndex]['deleted'] = true;
|
|
89
|
-
|
|
90
|
-
//dontSubstractMaxFiles fix
|
|
91
|
-
var currentMax = this.$refs[this.collection].dropzone.options.maxFiles;
|
|
92
|
-
this.$refs[this.collection].setOption('maxFiles', currentMax + 1);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
attachAlreadyUploadedMedia: function attachAlreadyUploadedMedia() {
|
|
97
|
-
var _this = this;
|
|
98
|
-
|
|
99
|
-
this.$nextTick(function () {
|
|
100
|
-
if (_this.mutableUploadedImages) {
|
|
101
|
-
_.each(_this.mutableUploadedImages, function (file, key) {
|
|
102
|
-
|
|
103
|
-
_this.$refs[_this.collection].manuallyAddFile({ name: file['name'],
|
|
104
|
-
size: file['size'],
|
|
105
|
-
type: file['type'],
|
|
106
|
-
url: file['url']
|
|
107
|
-
}, file['thumb_url'], false, false, {
|
|
108
|
-
dontSubstractMaxFiles: false,
|
|
109
|
-
addToFiles: true
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
getFiles: function getFiles() {
|
|
117
|
-
var _this2 = this;
|
|
118
|
-
|
|
119
|
-
var files = [];
|
|
120
|
-
|
|
121
|
-
_.each(this.mutableUploadedImages, function (file, key) {
|
|
122
|
-
if (file.deleted) {
|
|
123
|
-
files.push({
|
|
124
|
-
id: file.id,
|
|
125
|
-
collection_name: _this2.collection,
|
|
126
|
-
action: 'delete'
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
_.each(this.$refs[this.collection].getAcceptedFiles(), function (file, key) {
|
|
132
|
-
var response = JSON.parse(file.xhr.response);
|
|
133
|
-
|
|
134
|
-
if (response.path) {
|
|
135
|
-
files.push({
|
|
136
|
-
id: file.id,
|
|
137
|
-
collection_name: _this2.collection,
|
|
138
|
-
path: response.path,
|
|
139
|
-
action: file.deleted ? 'delete' : 'add', //TODO: update ie. meta_data.name
|
|
140
|
-
meta_data: {
|
|
141
|
-
name: file.name, //TODO: editable in the future
|
|
142
|
-
file_name: file.name,
|
|
143
|
-
width: file.width,
|
|
144
|
-
height: file.height
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
return files;
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
placeIcon: function placeIcon(file) {
|
|
154
|
-
//FIXME cele to je jqueryoidne, asi si budeme musiet spravit vlastny vue wrapper, tento je zbugovany
|
|
155
|
-
var $previewElement = $(file.previewElement);
|
|
156
|
-
|
|
157
|
-
if (file.url) {
|
|
158
|
-
$previewElement.find('.dz-filename').html('<a href="' + file.url + '" target="_BLANK" class="dz-btn dz-custom-download">' + file.name + '</a>');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (file.type.includes('image')) {
|
|
162
|
-
//nothing, default thumb
|
|
163
|
-
} else if (file.type.includes('pdf')) {
|
|
164
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-pdf-o"></i><p>' + file.name + '</p>');
|
|
165
|
-
} else if (file.type.includes('word')) {
|
|
166
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-word-o"></i><p>' + file.name + '</p>');
|
|
167
|
-
} else if (file.type.includes('spreadsheet') || file.type.includes('csv')) {
|
|
168
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-excel-o"></i><p>' + file.name + '</p>');
|
|
169
|
-
} else if (file.type.includes('presentation')) {
|
|
170
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-powerpoint-o"></i><p>' + file.name + '</p>');
|
|
171
|
-
} else if (file.type.includes('video')) {
|
|
172
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-video-o"></i><p>' + file.name + '</p>');
|
|
173
|
-
} else if (file.type.includes('text')) {
|
|
174
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-text-o"></i><p>' + file.name + '</p>');
|
|
175
|
-
} else if (file.type.includes('zip') || file.type.includes('rar')) {
|
|
176
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-archive-o"></i><p>' + file.name + '</p>');
|
|
177
|
-
} else {
|
|
178
|
-
$previewElement.find('.dz-image').html('<i class="fa fa-file-o"></i><p>' + file.name + '</p>');
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
template: function template() {
|
|
183
|
-
return '\n <div class="dz-preview dz-file-preview">\n <div class="dz-image">\n <img data-dz-thumbnail />\n </div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark"><i class="fa fa-check"></i></div>\n <div class="dz-error-mark"><i class="fa fa-close"></i></div>\n </div>\n ';
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
exports.default = BaseUpload;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _vue = require('vue');
|
|
4
|
-
|
|
5
|
-
var _vue2 = _interopRequireDefault(_vue);
|
|
6
|
-
|
|
7
|
-
var _jquery = require('jquery');
|
|
8
|
-
|
|
9
|
-
var _jquery2 = _interopRequireDefault(_jquery);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
// This file is here only to ensure backwards compatibility
|
|
14
|
-
|
|
15
|
-
window.$ = window.jQuery = _jquery2.default;
|
|
16
|
-
window.Vue = _vue2.default;
|
|
17
|
-
|
|
18
|
-
var token = document.head.querySelector('meta[name="csrf-token"]');
|
|
19
|
-
if (token) {
|
|
20
|
-
$.ajaxSetup({ headers: { 'X-CSRF-TOKEN': token.content } });
|
|
21
|
-
}
|
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _moment = require('moment');
|
|
8
|
-
|
|
9
|
-
var _moment2 = _interopRequireDefault(_moment);
|
|
10
|
-
|
|
11
|
-
require('moment-timezone');
|
|
12
|
-
|
|
13
|
-
var _Pagination = require('./components/Pagination');
|
|
14
|
-
|
|
15
|
-
var _Pagination2 = _interopRequireDefault(_Pagination);
|
|
16
|
-
|
|
17
|
-
var _Sortable = require('./components/Sortable');
|
|
18
|
-
|
|
19
|
-
var _Sortable2 = _interopRequireDefault(_Sortable);
|
|
20
|
-
|
|
21
|
-
var _vTooltip = require('v-tooltip');
|
|
22
|
-
|
|
23
|
-
var _UserDetailTooltip = require('./components/UserDetailTooltip');
|
|
24
|
-
|
|
25
|
-
var _UserDetailTooltip2 = _interopRequireDefault(_UserDetailTooltip);
|
|
26
|
-
|
|
27
|
-
var _lodash = require('lodash');
|
|
28
|
-
|
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
-
|
|
31
|
-
Vue.directive('tooltip', _vTooltip.VTooltip);
|
|
32
|
-
Vue.directive('close-popover', _vTooltip.VClosePopover);
|
|
33
|
-
Vue.component('v-popover', _vTooltip.VPopover);
|
|
34
|
-
|
|
35
|
-
exports.default = {
|
|
36
|
-
data: function data() {
|
|
37
|
-
return {
|
|
38
|
-
pagination: {
|
|
39
|
-
state: {
|
|
40
|
-
per_page: this.$cookie.get('per_page') || 10, // required
|
|
41
|
-
current_page: 1, // required
|
|
42
|
-
last_page: 1, // required
|
|
43
|
-
from: 1,
|
|
44
|
-
to: 10 // required
|
|
45
|
-
},
|
|
46
|
-
options: {
|
|
47
|
-
alwaysShowPrevNext: true
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
orderBy: {
|
|
51
|
-
column: 'id',
|
|
52
|
-
direction: 'asc'
|
|
53
|
-
},
|
|
54
|
-
filters: {},
|
|
55
|
-
search: '',
|
|
56
|
-
collection: null,
|
|
57
|
-
now: (0, _moment2.default)().tz(this.timezone).format('YYYY-MM-DD HH:mm:ss'),
|
|
58
|
-
datetimePickerConfig: {
|
|
59
|
-
enableTime: true,
|
|
60
|
-
time_24hr: true,
|
|
61
|
-
enableSeconds: true,
|
|
62
|
-
dateFormat: 'Y-m-d H:i:S',
|
|
63
|
-
altInput: true,
|
|
64
|
-
altFormat: 'd.m.Y H:i:S',
|
|
65
|
-
locale: null,
|
|
66
|
-
inline: true
|
|
67
|
-
},
|
|
68
|
-
bulkItems: {},
|
|
69
|
-
bulkCheckingAllLoader: false,
|
|
70
|
-
dummy: null
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
props: {
|
|
74
|
-
'url': {
|
|
75
|
-
type: String,
|
|
76
|
-
required: true
|
|
77
|
-
},
|
|
78
|
-
'data': {
|
|
79
|
-
type: Object,
|
|
80
|
-
default: function _default() {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
'timezone': {
|
|
85
|
-
type: String,
|
|
86
|
-
required: false,
|
|
87
|
-
default: function _default() {
|
|
88
|
-
return "UTC";
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
'trans': {
|
|
92
|
-
required: false,
|
|
93
|
-
default: function _default() {
|
|
94
|
-
return {
|
|
95
|
-
duplicateDialog: {
|
|
96
|
-
title: 'Warning!',
|
|
97
|
-
text: 'Do you really want to duplicate this item?',
|
|
98
|
-
yes: 'Yes, duplicate.',
|
|
99
|
-
no: 'No, cancel.',
|
|
100
|
-
success_title: 'Success!',
|
|
101
|
-
success: 'Item successfully duplicated.',
|
|
102
|
-
error_title: 'Error!',
|
|
103
|
-
error: 'An error has occured.'
|
|
104
|
-
},
|
|
105
|
-
deleteDialog: {
|
|
106
|
-
title: 'Warning!',
|
|
107
|
-
text: 'Do you really want to delete this item?',
|
|
108
|
-
yes: 'Yes, delete.',
|
|
109
|
-
no: 'No, cancel.',
|
|
110
|
-
success_title: 'Success!',
|
|
111
|
-
success: 'Item successfully deleted.',
|
|
112
|
-
error_title: 'Error!',
|
|
113
|
-
error: 'An error has occured.'
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
components: {
|
|
120
|
-
'pagination': _Pagination2.default,
|
|
121
|
-
'sortable': _Sortable2.default,
|
|
122
|
-
'user-detail-tooltip': _UserDetailTooltip2.default
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
watch: {
|
|
126
|
-
pagination: {
|
|
127
|
-
handler: function handler() {
|
|
128
|
-
this.dummy = Math.random();
|
|
129
|
-
},
|
|
130
|
-
deep: true
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
created: function created() {
|
|
135
|
-
if (this.data != null) {
|
|
136
|
-
this.populateCurrentStateAndData(this.data);
|
|
137
|
-
} else {
|
|
138
|
-
this.loadData();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
var _this = this;
|
|
142
|
-
setInterval(function () {
|
|
143
|
-
_this.now = (0, _moment2.default)().tz(_this.timezone).format('YYYY-MM-DD HH:mm:ss');
|
|
144
|
-
}, 1000);
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
computed: {
|
|
148
|
-
isClickedAll: {
|
|
149
|
-
get: function get() {
|
|
150
|
-
var dummy = this.dummy; //we hack pagination watcher don't recalculate computed property
|
|
151
|
-
return this.clickedBulkItemsCount >= this.pagination.state.to - this.pagination.state.from + 1 && this.clickedBulkItemsCount > 0 && this.allClickedItemsAreSame();
|
|
152
|
-
},
|
|
153
|
-
set: function set(clicked) {}
|
|
154
|
-
},
|
|
155
|
-
clickedBulkItemsCount: function clickedBulkItemsCount() {
|
|
156
|
-
return Object.values(this.bulkItems).filter(function (item) {
|
|
157
|
-
return item === true;
|
|
158
|
-
}).length;
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
filters: {
|
|
163
|
-
date: function date(date) {
|
|
164
|
-
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD';
|
|
165
|
-
|
|
166
|
-
var date = (0, _moment2.default)(date);
|
|
167
|
-
return date.isValid() ? date.format(format) : "";
|
|
168
|
-
},
|
|
169
|
-
datetime: function datetime(_datetime) {
|
|
170
|
-
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
|
|
171
|
-
|
|
172
|
-
var date = (0, _moment2.default)(_datetime);
|
|
173
|
-
return date.isValid() ? date.format(format) : "";
|
|
174
|
-
},
|
|
175
|
-
time: function time(_time) {
|
|
176
|
-
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HH:mm:ss';
|
|
177
|
-
|
|
178
|
-
// '2000-01-01' is here just because momentjs needs a date
|
|
179
|
-
var date = (0, _moment2.default)('2000-01-01 ' + _time);
|
|
180
|
-
return date.isValid() ? date.format(format) : "";
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
methods: {
|
|
185
|
-
allClickedItemsAreSame: function allClickedItemsAreSame() {
|
|
186
|
-
var itemsInPaginationIds = Object.values(this.collection).map(function (_ref) {
|
|
187
|
-
var id = _ref.id;
|
|
188
|
-
return id;
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
//for loop is used because you can't return false in .forEach() method
|
|
192
|
-
for (var i = 0; i < itemsInPaginationIds.length; i++) {
|
|
193
|
-
var itemInPaginationId = itemsInPaginationIds[i];
|
|
194
|
-
if (this.bulkItems[itemInPaginationId] === undefined || this.bulkItems[itemInPaginationId] === false) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return true;
|
|
200
|
-
},
|
|
201
|
-
onBulkItemClicked: function onBulkItemClicked(id) {
|
|
202
|
-
this.bulkItems[id] === undefined ? Vue.set(this.bulkItems, id, true) : this.bulkItems[id] = !this.bulkItems[id];
|
|
203
|
-
},
|
|
204
|
-
onBulkItemsClickedAll: function onBulkItemsClickedAll(url) {
|
|
205
|
-
var _this2 = this;
|
|
206
|
-
|
|
207
|
-
var options = {
|
|
208
|
-
params: {
|
|
209
|
-
bulk: true
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
this.bulkCheckingAllLoader = true;
|
|
214
|
-
Object.assign(options.params, this.filters);
|
|
215
|
-
|
|
216
|
-
axios.get(url, options).then(function (response) {
|
|
217
|
-
_this2.checkAllItems(response.data.bulkItems);
|
|
218
|
-
}, function (error) {
|
|
219
|
-
_this2.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : 'An error has occured.' });
|
|
220
|
-
}).finally(function () {
|
|
221
|
-
_this2.bulkCheckingAllLoader = false;
|
|
222
|
-
});
|
|
223
|
-
},
|
|
224
|
-
onBulkItemsClickedAllWithPagination: function onBulkItemsClickedAllWithPagination() {
|
|
225
|
-
var itemsInPagination = Object.values(this.collection).map(function (_ref2) {
|
|
226
|
-
var id = _ref2.id;
|
|
227
|
-
return id;
|
|
228
|
-
});
|
|
229
|
-
if (!this.isClickedAll) {
|
|
230
|
-
this.bulkCheckingAllLoader = true;
|
|
231
|
-
this.checkAllItems(itemsInPagination);
|
|
232
|
-
this.bulkCheckingAllLoader = false;
|
|
233
|
-
} else {
|
|
234
|
-
this.onBulkItemsClickedAllUncheck(itemsInPagination);
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
checkAllItems: function checkAllItems(itemsToCheck) {
|
|
238
|
-
var _this3 = this;
|
|
239
|
-
|
|
240
|
-
itemsToCheck.forEach(function (itemId) {
|
|
241
|
-
Vue.set(_this3.bulkItems, itemId, true);
|
|
242
|
-
});
|
|
243
|
-
},
|
|
244
|
-
onBulkItemsClickedAllUncheck: function onBulkItemsClickedAllUncheck() {
|
|
245
|
-
var _this4 = this;
|
|
246
|
-
|
|
247
|
-
var bulkItemsToUncheck = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
248
|
-
|
|
249
|
-
if (bulkItemsToUncheck === null) {
|
|
250
|
-
this.bulkItems = {};
|
|
251
|
-
} else {
|
|
252
|
-
Object.values(this.collection).map(function (_ref3) {
|
|
253
|
-
var id = _ref3.id;
|
|
254
|
-
return id;
|
|
255
|
-
}).forEach(function (itemsInPaginationIds) {
|
|
256
|
-
_this4.bulkItems[itemsInPaginationIds] = false;
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
bulkDelete: function bulkDelete(url) {
|
|
261
|
-
var _this5 = this;
|
|
262
|
-
|
|
263
|
-
var itemsToDelete = (0, _lodash.keys)((0, _lodash.pickBy)(this.bulkItems));
|
|
264
|
-
var self = this;
|
|
265
|
-
|
|
266
|
-
this.$modal.show('dialog', {
|
|
267
|
-
title: 'Warning!',
|
|
268
|
-
text: 'Do you really want to delete ' + this.clickedBulkItemsCount + ' selected items ?',
|
|
269
|
-
buttons: [{ title: 'No, cancel.' }, {
|
|
270
|
-
title: '<span class="btn-dialog btn-danger">Yes, delete.<span>',
|
|
271
|
-
handler: function handler() {
|
|
272
|
-
_this5.$modal.hide('dialog');
|
|
273
|
-
axios.post(url, {
|
|
274
|
-
data: {
|
|
275
|
-
'ids': itemsToDelete
|
|
276
|
-
}
|
|
277
|
-
}).then(function (response) {
|
|
278
|
-
self.bulkItems = {};
|
|
279
|
-
_this5.loadData();
|
|
280
|
-
_this5.$notify({ type: 'success', title: 'Success!', text: response.data.message ? response.data.message : 'Item successfully deleted.' });
|
|
281
|
-
}, function (error) {
|
|
282
|
-
_this5.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : 'An error has occured.' });
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}]
|
|
286
|
-
});
|
|
287
|
-
},
|
|
288
|
-
loadData: function loadData(resetCurrentPage) {
|
|
289
|
-
var _this6 = this;
|
|
290
|
-
|
|
291
|
-
var options = {
|
|
292
|
-
params: {
|
|
293
|
-
per_page: this.pagination.state.per_page,
|
|
294
|
-
page: this.pagination.state.current_page,
|
|
295
|
-
orderBy: this.orderBy.column,
|
|
296
|
-
orderDirection: this.orderBy.direction
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
if (resetCurrentPage === true) {
|
|
301
|
-
options.params.page = 1;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
Object.assign(options.params, this.filters);
|
|
305
|
-
|
|
306
|
-
axios.get(this.url, options).then(function (response) {
|
|
307
|
-
return _this6.populateCurrentStateAndData(response.data.data);
|
|
308
|
-
}, function (error) {
|
|
309
|
-
// TODO handle error
|
|
310
|
-
});
|
|
311
|
-
},
|
|
312
|
-
filter: function filter(column, value) {
|
|
313
|
-
if (value == '') {
|
|
314
|
-
delete this.filters[column];
|
|
315
|
-
} else {
|
|
316
|
-
this.filters[column] = value;
|
|
317
|
-
}
|
|
318
|
-
// when we change filter, we must reset pagination, because the total items count may has changed
|
|
319
|
-
this.loadData(true);
|
|
320
|
-
},
|
|
321
|
-
populateCurrentStateAndData: function populateCurrentStateAndData(object) {
|
|
322
|
-
|
|
323
|
-
if (object.current_page > object.last_page && object.total > 0) {
|
|
324
|
-
this.pagination.state.current_page = object.last_page;
|
|
325
|
-
this.loadData();
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
this.collection = object.data;
|
|
330
|
-
this.pagination.state.current_page = object.current_page;
|
|
331
|
-
this.pagination.state.last_page = object.last_page;
|
|
332
|
-
this.pagination.state.total = object.total;
|
|
333
|
-
this.pagination.state.per_page = object.per_page;
|
|
334
|
-
this.pagination.state.to = object.to;
|
|
335
|
-
this.pagination.state.from = object.from;
|
|
336
|
-
},
|
|
337
|
-
deleteItem: function deleteItem(url) {
|
|
338
|
-
var _this7 = this;
|
|
339
|
-
|
|
340
|
-
this.$modal.show('dialog', {
|
|
341
|
-
title: 'Warning!',
|
|
342
|
-
text: 'Do you really want to delete this item?',
|
|
343
|
-
buttons: [{ title: 'No, cancel.' }, {
|
|
344
|
-
title: '<span class="btn-dialog btn-danger">Yes, delete.<span>',
|
|
345
|
-
handler: function handler() {
|
|
346
|
-
_this7.$modal.hide('dialog');
|
|
347
|
-
axios.delete(url).then(function (response) {
|
|
348
|
-
_this7.loadData();
|
|
349
|
-
_this7.$notify({ type: 'success', title: 'Success!', text: response.data.message ? response.data.message : 'Item successfully deleted.' });
|
|
350
|
-
}, function (error) {
|
|
351
|
-
_this7.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : 'An error has occured.' });
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
}]
|
|
355
|
-
});
|
|
356
|
-
},
|
|
357
|
-
toggleSwitch: function toggleSwitch(url, col, row) {
|
|
358
|
-
var _this8 = this;
|
|
359
|
-
|
|
360
|
-
axios.post(url, row).then(function (response) {
|
|
361
|
-
_this8.$notify({ type: 'success', title: 'Success!', text: response.data.message ? response.data.message : 'Item successfully changed.' });
|
|
362
|
-
}, function (error) {
|
|
363
|
-
row[col] = !row[col];
|
|
364
|
-
_this8.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : 'An error has occured.' });
|
|
365
|
-
});
|
|
366
|
-
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
publishNow: function publishNow(url, row, dialogType) {
|
|
370
|
-
var _this = this;
|
|
371
|
-
if (!dialogType) dialogType = 'publishNowDialog';
|
|
372
|
-
|
|
373
|
-
this.$modal.show('dialog', {
|
|
374
|
-
title: _this.trans[dialogType].title,
|
|
375
|
-
text: _this.trans[dialogType].text,
|
|
376
|
-
buttons: [{ title: _this.trans[dialogType].no }, {
|
|
377
|
-
title: '<span class="btn-dialog btn-success">' + _this.trans[dialogType].yes + '<span>',
|
|
378
|
-
handler: function handler() {
|
|
379
|
-
_this.$modal.hide('dialog');
|
|
380
|
-
|
|
381
|
-
axios.post(url, { publish_now: true }).then(function (response) {
|
|
382
|
-
row.published_at = response.data.object.published_at;
|
|
383
|
-
_this.$notify({ type: 'success', title: 'Success!', text: response.data.message ? response.data.message : _this.trans[dialogType].success });
|
|
384
|
-
}, function (error) {
|
|
385
|
-
|
|
386
|
-
_this.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : _this.trans[dialogType].error });
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
}]
|
|
390
|
-
});
|
|
391
|
-
},
|
|
392
|
-
|
|
393
|
-
unpublishNow: function unpublishNow(url, row, additionalWarning) {
|
|
394
|
-
var _this = this;
|
|
395
|
-
var dialogType = 'unpublishNowDialog';
|
|
396
|
-
|
|
397
|
-
this.$modal.show('dialog', {
|
|
398
|
-
title: _this.trans[dialogType].title,
|
|
399
|
-
text: _this.trans[dialogType].text + (additionalWarning ? '<br /><span class="text-danger">' + additionalWarning + '</span>' : ''),
|
|
400
|
-
buttons: [{ title: _this.trans[dialogType].no }, {
|
|
401
|
-
title: '<span class="btn-dialog btn-danger">' + _this.trans[dialogType].yes + '<span>',
|
|
402
|
-
handler: function handler() {
|
|
403
|
-
_this.$modal.hide('dialog');
|
|
404
|
-
|
|
405
|
-
axios.post(url, { unpublish_now: true }).then(function (response) {
|
|
406
|
-
row.published_at = response.data.object.published_at;
|
|
407
|
-
row.published_to = response.data.object.published_to;
|
|
408
|
-
_this.$notify({ type: 'success', title: 'Success!', text: response.data.message ? response.data.message : _this.trans[dialogType].success });
|
|
409
|
-
}, function (error) {
|
|
410
|
-
|
|
411
|
-
_this.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : _this.trans[dialogType].error });
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
}]
|
|
415
|
-
});
|
|
416
|
-
},
|
|
417
|
-
|
|
418
|
-
publishLater: function publishLater(url, row, dialogType) {
|
|
419
|
-
var _this = this;
|
|
420
|
-
if (!dialogType) dialogType = 'publishLaterDialog';
|
|
421
|
-
|
|
422
|
-
this.$modal.show({
|
|
423
|
-
template: '\n <div class="vue-dialog">\n <div class="card-body">\n <p>{{ trans.text }}</p>\n <div class="form-group row align-items-center">\n <div class="col">\n <datetime \n \n v-model="mutablePublishedAt"\n :config="datetimePickerConfig" \n v-validate="\'date_format:yyyy-MM-dd HH:mm:ss\'" \n class="flatpickr" \n >\n </datetime>\n </div>\n </div>\n <div class="row">\n <div class="col">\n <button class="col btn btn-secondary" @click="$emit(\'close\')">{{trans.no}}</button> \n </div>\n <div class="col">\n <button class="col btn btn-success" type="button" @click="save(mutablePublishedAt)">{{trans.yes}}</button>\n </div>\n </div>\n </div> \n </div> \n ',
|
|
424
|
-
props: ['trans', 'published_at', 'datetimePickerConfig', 'save'],
|
|
425
|
-
data: function data() {
|
|
426
|
-
return {
|
|
427
|
-
mutablePublishedAt: row.published_at
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
}, {
|
|
431
|
-
published_at: row.published_at,
|
|
432
|
-
datetimePickerConfig: _this.datetimePickerConfig,
|
|
433
|
-
trans: _this.trans[dialogType],
|
|
434
|
-
save: function save(mutablePublishedAt) {
|
|
435
|
-
_this.$modal.hide('PublishLaterDialog');
|
|
436
|
-
|
|
437
|
-
axios.post(url, { published_at: mutablePublishedAt }).then(function (response) {
|
|
438
|
-
row.published_at = response.data.object.published_at;
|
|
439
|
-
_this.$notify({ type: 'success', title: 'Success!', text: response.data.message ? response.data.message : _this.trans[dialogType].success });
|
|
440
|
-
}, function (error) {
|
|
441
|
-
|
|
442
|
-
_this.$notify({ type: 'error', title: 'Error!', text: error.response.data.message ? error.response.data.message : _this.trans[dialogType].error });
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
}, {
|
|
447
|
-
width: 350,
|
|
448
|
-
height: 'auto',
|
|
449
|
-
name: 'PublishLaterDialog'
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
};
|