@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
|
@@ -0,0 +1,454 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var Pagination = {
|
|
7
|
+
template: '<nav>\n <ul class="pagination sizeClass" v-if="pagination.last_page > 1">\n <li v-if="showPrevious()" :class="{ \'disabled\' : pagination.current_page <= 1, \'page-item\': true }">\n <span v-if="pagination.current_page <= 1" class="page-link">\n <span aria-hidden="true">{{ config.previousText }}</span>\n </span>\n\n <a href="#" v-if="pagination.current_page > 1 " :aria-label="config.ariaPrevioius" @click.prevent="changePage(pagination.current_page - 1)" class="page-link">\n <span aria-hidden="true">{{ config.previousText }}</span>\n </a>\n </li>\n\n <li v-for="num in array" :class="{ \'active\': num === pagination.current_page, \'page-item\': true }">\n <a href="#" @click.prevent="changePage(num)" class="page-link">{{ num }}</a>\n </li>\n\n <li v-if="showNext()" :class="{ \'disabled\' : pagination.current_page === pagination.last_page || pagination.last_page === 0, \'page-item\': true }">\n <span v-if="pagination.current_page === pagination.last_page || pagination.last_page === 0" class="page-link">\n <span aria-hidden="true">{{ config.nextText }}</span>\n </span>\n\n <a href="#" v-if="pagination.current_page < pagination.last_page" :aria-label="config.ariaNext" @click.prevent="changePage(pagination.current_page + 1)" class="page-link">\n <span aria-hidden="true">{{ config.nextText }}</span>\n </a>\n </li>\n </ul>\n </nav>',
|
|
8
|
+
props: {
|
|
9
|
+
pagination: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: function _default() {
|
|
12
|
+
return this.$parent.pagination.state;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
callback: {
|
|
16
|
+
type: Function,
|
|
17
|
+
default: function _default() {
|
|
18
|
+
return this.$parent.loadData();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
options: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: function _default() {
|
|
24
|
+
if (!!this.$parent.pagination.options) {
|
|
25
|
+
return this.$parent.pagination.options;
|
|
26
|
+
} else {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: String
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
array: function array() {
|
|
37
|
+
if (this.pagination.last_page <= 0) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var from = this.pagination.current_page - this.config.offset;
|
|
42
|
+
if (from < 1) {
|
|
43
|
+
from = 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var to = from + this.config.offset * 2;
|
|
47
|
+
if (to >= this.pagination.last_page) {
|
|
48
|
+
to = this.pagination.last_page;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var arr = [];
|
|
52
|
+
while (from <= to) {
|
|
53
|
+
arr.push(from);
|
|
54
|
+
from++;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return arr;
|
|
58
|
+
},
|
|
59
|
+
config: function config() {
|
|
60
|
+
return Object.assign({
|
|
61
|
+
offset: 3,
|
|
62
|
+
ariaPrevious: 'Previous',
|
|
63
|
+
ariaNext: 'Next',
|
|
64
|
+
previousText: '«',
|
|
65
|
+
nextText: '»',
|
|
66
|
+
alwaysShowPrevNext: false
|
|
67
|
+
}, this.options);
|
|
68
|
+
},
|
|
69
|
+
sizeClass: function sizeClass() {
|
|
70
|
+
if (this.size === 'large') {
|
|
71
|
+
return 'pagination-lg';
|
|
72
|
+
} else if (this.size === 'small') {
|
|
73
|
+
return 'pagination-sm';
|
|
74
|
+
} else {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
watch: {
|
|
80
|
+
'pagination.per_page': function paginationPer_page(newVal, oldVal) {
|
|
81
|
+
if (+newVal !== +oldVal) {
|
|
82
|
+
this.$cookie.set('per_page', newVal);
|
|
83
|
+
this.callback();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
showPrevious: function showPrevious() {
|
|
89
|
+
return this.config.alwaysShowPrevNext || this.pagination.current_page > 1;
|
|
90
|
+
},
|
|
91
|
+
showNext: function showNext() {
|
|
92
|
+
return this.config.alwaysShowPrevNext || this.pagination.current_page < this.pagination.last_page;
|
|
93
|
+
},
|
|
94
|
+
changePage: function changePage(page) {
|
|
95
|
+
if (this.pagination.current_page === page) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.$set(this.pagination, 'current_page', page);
|
|
100
|
+
this.callback();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
exports.default = Pagination;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var Sortable = {
|
|
7
|
+
props: {
|
|
8
|
+
'column': {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
'orderBy': {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: function _default() {
|
|
16
|
+
return this.$parent.orderBy;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
'callback': {
|
|
21
|
+
type: Function,
|
|
22
|
+
default: function _default() {
|
|
23
|
+
return this.$parent.loadData();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
methods: {
|
|
29
|
+
|
|
30
|
+
sort: function sort(column) {
|
|
31
|
+
if (this.orderBy.column == column) {
|
|
32
|
+
this.orderBy.direction = this.orderBy.direction == 'asc' ? 'desc' : 'asc';
|
|
33
|
+
} else {
|
|
34
|
+
this.orderBy.column = column;
|
|
35
|
+
this.orderBy.direction = 'asc'; // I guess we do want to reset direction when changing column, but I'm not sure :)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.callback();
|
|
39
|
+
|
|
40
|
+
// FIXME callback should have return a Promise which can success or end with an error
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
template: '<th>' + '<a @click.stop="sort(column)"><span class="fa" :class="{\'fa-sort-amount-asc\': orderBy.column == column && orderBy.direction == \'asc\', \'fa-sort-amount-desc\': orderBy.column == column && orderBy.direction == \'desc\' }"></span> <slot></slot></a>' + '</th>'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.default = Sortable;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var UserDetailTooltip = {
|
|
7
|
+
template: '\n\t<v-popover class="avatar-tooltip-trigger"\n\t\ttrigger="click" \n :placement="placement"\n\t\toffset="5"\n\t\tcontainer="body"\n\t\t:auto-hide="true"\n\t>\n\n <img :src="user.avatar_thumb_url" class="avatar-photo" :alt="user.full_name" v-if="user.avatar_thumb_url">\n <div class="avatar-initials" v-if="!user.avatar_thumb_url">\n\t\t\t{{ abbr }}\n\t\t</div>\n\n\t\t<div class="avatar-full-name" v-if="options.showFullNameLabel">\n\t\t\t{{ user.full_name }}\n\t\t\t<span v-if="edit && datetime != \'\'">\n\t\t\t <br>\n\t\t\t <span class="user-info-span">{{datetime}}</span>\n\t\t\t</span>\n\t\t</div>\n\n\t\t<template slot="popover">\n\t\t\t<div class="user-avatar">\n\t\t\t\t<img :src="user.avatar_thumb_url" class="avatar-photo" :alt="user.full_name" v-if="user.avatar_thumb_url">\n\t\t\t\t<div class="avatar-initials" v-else>\n\t\t\t\t\t{{ abbr }}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class="user-info">\n\t\t\t\t<h3>{{ user.full_name }} <small v-if="userText">| <strong style="text-transform: uppercase">{{ userText }}</strong></small></h3>\n\t\t\t\t<a v-if="user.email" v-bind:href="[\'mailto:\' + user.email]">{{ user.email }}</a>\n\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t</template>\n </v-popover>\n',
|
|
8
|
+
|
|
9
|
+
props: {
|
|
10
|
+
user: {
|
|
11
|
+
type: Object,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
userText: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: function _default() {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
text: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: function _default() {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
options: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: function _default() {
|
|
29
|
+
return {
|
|
30
|
+
showFullNameLabel: true
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
placement: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: function _default() {
|
|
37
|
+
return 'top';
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
edit: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: function _default() {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
datetime: ''
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
abbr: function abbr() {
|
|
50
|
+
return '' + this.user.first_name.slice(0, 1) + this.user.last_name.slice(0, 1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.default = UserDetailTooltip;
|