vue_crud 0.1.10.8.1 → 0.1.10.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vue_crud/version.rb +1 -1
- data/vendor/assets/javascripts/vue_crud.js +47 -46
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d97a3b73c315fef985c78e9f9e6d83a4b051a08
|
4
|
+
data.tar.gz: e1afbcba32bae987e929b7a0554f31b062cb8330
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba8d4e5708461e9f1e82ff6521f042a157faa64f15eb03547b22a678d66e30a5ca98d8796ab62ac9783a2402a4d285f48578f59222066b955290447e4120e396
|
7
|
+
data.tar.gz: fda38526ca19fd9d4b763e6de1f34f796e3d5e9fdfd4d40c19162812ec19adbc9fcd527c1130d00d2676204bf6f843bd389080d5f29f506bf23f67d9c4011184
|
data/lib/vue_crud/version.rb
CHANGED
@@ -116,8 +116,8 @@ function vueCRUD_init(params = {}) {
|
|
116
116
|
}
|
117
117
|
},
|
118
118
|
mounted: function() {
|
119
|
-
event_hub.$on('update_error', function(
|
120
|
-
this.
|
119
|
+
event_hub.$on('update_error', function(errors) {
|
120
|
+
this.errors = errors;
|
121
121
|
}.bind(this));
|
122
122
|
event_hub.$on('update_action_name', function(action_name) {
|
123
123
|
this.action_name = action_name;
|
@@ -177,13 +177,14 @@ function vueCRUD_init(params = {}) {
|
|
177
177
|
observeChanges: true,
|
178
178
|
transition: 'fade down',
|
179
179
|
onShow: function() {
|
180
|
-
|
180
|
+
that.errors = {};
|
181
|
+
$('.needRefresh').froalaEditor('reset');
|
181
182
|
$(this).find('select.ui.dropdown').dropdown();
|
182
183
|
$(this).find('.ui.checkbox').checkbox();
|
183
184
|
if(typeof modalOpen !== "undefined") modalOpen(this);
|
184
185
|
},
|
185
186
|
onVisible: function() {
|
186
|
-
|
187
|
+
$('.needRefresh').froalaEditor('refresh');
|
187
188
|
},
|
188
189
|
onHide: function() {
|
189
190
|
event_hub.$emit('cancel_customMode');
|
@@ -263,28 +264,26 @@ function vueCRUD_init(params = {}) {
|
|
263
264
|
}.bind(this));
|
264
265
|
event_hub.$emit('openModal');
|
265
266
|
},
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
});
|
287
|
-
},
|
267
|
+
var that = this;
|
268
|
+
$.ajax({
|
269
|
+
method: 'POST',
|
270
|
+
data: obj_to_json(that.model),
|
271
|
+
url: that.info.url_prefix + options.suffix + location.search,
|
272
|
+
success: function(res) {
|
273
|
+
that.model = res;
|
274
|
+
that.deleteMode = false;
|
275
|
+
that.is_deleted = false;
|
276
|
+
that.is_success = true;
|
277
|
+
sleep(1500).then(() => {
|
278
|
+
that.is_success = false;
|
279
|
+
});
|
280
|
+
},
|
281
|
+
error: function(res) {
|
282
|
+
that.is_deleted = false;
|
283
|
+
that.is_restore_failed = true;
|
284
|
+
alert('復原失敗,請記錄資料並重新建立');
|
285
|
+
}
|
286
|
+
});
|
288
287
|
// restoreModel: function() {
|
289
288
|
// if(confirm("Are you sure?") == true) {
|
290
289
|
// event_hub.$emit('restoreCreate', this.model);
|
@@ -296,25 +295,27 @@ function vueCRUD_init(params = {}) {
|
|
296
295
|
deleteModel: function () {
|
297
296
|
var that = this;
|
298
297
|
that.deleteMode = true;
|
298
|
+
var id = that.model.ID || that.model.id;
|
299
|
+
|
299
300
|
if(confirm("Are you sure?") == true) {
|
300
301
|
$.ajax({
|
301
302
|
method: 'DELETE',
|
302
|
-
url: that.info.url_prefix + '/' +
|
303
|
+
url: that.info.url_prefix + '/' + id + options.suffix + location.search,
|
303
304
|
success: function(res) {
|
304
305
|
that.is_deleted = true;
|
305
|
-
event_hub.$on('toggleRestoreSuccess', function() {
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
}.bind(this));
|
313
|
-
event_hub.$on('toggleRestoreFail', function() {
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
}.bind(this));
|
306
|
+
// event_hub.$on('toggleRestoreSuccess', function() {
|
307
|
+
// that.deleteMode = false;
|
308
|
+
// that.is_deleted = false;
|
309
|
+
// that.is_success = true;
|
310
|
+
// sleep(1500).then(() => {
|
311
|
+
// that.is_success = false;
|
312
|
+
// });
|
313
|
+
// }.bind(this));
|
314
|
+
// event_hub.$on('toggleRestoreFail', function() {
|
315
|
+
// that.is_deleted = false;
|
316
|
+
// that.is_restore_failed = true;
|
317
|
+
// alert('復原失敗,請記錄資料並重新建立');
|
318
|
+
// }.bind(this));
|
318
319
|
},
|
319
320
|
error: function(res) {
|
320
321
|
that.deleteMode = false;
|
@@ -327,12 +328,12 @@ function vueCRUD_init(params = {}) {
|
|
327
328
|
},
|
328
329
|
updateModel: function() {
|
329
330
|
var that = this;
|
331
|
+
var id = that.model.ID || that.model.id;
|
330
332
|
$.ajax({
|
331
333
|
method: 'PATCH',
|
332
|
-
data:
|
333
|
-
url: that.info.url_prefix + '/' +
|
334
|
+
data: obj_to_json(that.model),
|
335
|
+
url: that.info.url_prefix + '/' + id + options.suffix + location.search,
|
334
336
|
beforeSend: function() {
|
335
|
-
console.log(JSON.stringify(that.model));
|
336
337
|
event_hub.$emit('dimmerOn');
|
337
338
|
$('.progress-bar').css('width', '0');
|
338
339
|
},
|
@@ -487,7 +488,7 @@ function vueCRUD_init(params = {}) {
|
|
487
488
|
// var that = this;
|
488
489
|
// $.ajax({
|
489
490
|
// method: 'POST',
|
490
|
-
// data:
|
491
|
+
// data: obj_to_json(that.model),
|
491
492
|
// url: that.info.url_prefix + options.suffix + location.search,
|
492
493
|
// success: function(res) {
|
493
494
|
// event_hub.$emit('toggleRestoreSuccess');
|
@@ -501,10 +502,10 @@ function vueCRUD_init(params = {}) {
|
|
501
502
|
var that = this;
|
502
503
|
$.ajax({
|
503
504
|
method: 'POST',
|
504
|
-
data:
|
505
|
+
data: obj_to_json(that.model),
|
505
506
|
url: that.info.url_prefix + options.suffix + location.search,
|
506
507
|
beforeSend: function() {
|
507
|
-
console.log(
|
508
|
+
console.log(obj_to_json(that.model));
|
508
509
|
event_hub.$emit('dimmerOn');
|
509
510
|
$('.progress-bar').css('width', '0');
|
510
511
|
},
|