vue_crud 0.1.10.8 → 0.1.10.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4d35cb3cc6a53e90199ea471f8ff4919dec9520
4
- data.tar.gz: 914949c5d210d2355b8434e3b789bb2b7c680a36
3
+ metadata.gz: b8c349fa0bacbe31044a9fcc06ff8dd89d3fb2d5
4
+ data.tar.gz: 8ef1d77f86d941020ed6a7c5805ae11dd1df0611
5
5
  SHA512:
6
- metadata.gz: 04b9e30b501d631c444470ffdacc5ce5a6e94c3909c6e273f39c96e49e2e48fbba9d3ee77948f7a2b2084511b054125c4e139b28c8c498d8b7559b5ff2f6662e
7
- data.tar.gz: 762c6576c879917a3e82902c8964d4fb7d8166eb8755cd03f807eef4749b171c9f8019f6f0d508c0433e4778643d9d77a1c21dca04e5ab81823b5ce5e5e90987
6
+ metadata.gz: 3deebc20543bc55bf122a6775bcc0eb09f94e374ecf411edbef16bf13aca164723adfe3ccaa85f5e99a9cdd147f5d2b6e0491ab25688505039e26e393058d43f
7
+ data.tar.gz: db220e80e754a81a8fd042bf478b418ce3fba0a6706e4ac710664e41587309585a7dace10acc9b4f7349875973a6f95a2c767fe6bcf5f6ece41c906ac2e06329
data/.DS_Store CHANGED
Binary file
data/lib/.DS_Store CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  module VueCrud
2
- VERSION = "0.1.10.8"
2
+ VERSION = "0.1.10.8.1"
3
3
  end
data/vendor/.DS_Store CHANGED
Binary file
Binary file
@@ -116,8 +116,8 @@ function vueCRUD_init(params = {}) {
116
116
  }
117
117
  },
118
118
  mounted: function() {
119
- event_hub.$on('update_error', function(errors) {
120
- this.errors = errors;
119
+ event_hub.$on('update_error', function(error) {
120
+ this.error = error;
121
121
  }.bind(this));
122
122
  event_hub.$on('update_action_name', function(action_name) {
123
123
  this.action_name = action_name;
@@ -177,14 +177,13 @@ function vueCRUD_init(params = {}) {
177
177
  observeChanges: true,
178
178
  transition: 'fade down',
179
179
  onShow: function() {
180
- that.errors = {};
181
- $('.needRefresh').froalaEditor('reset');
180
+ // $('.needRefresh').froalaEditor('reset');
182
181
  $(this).find('select.ui.dropdown').dropdown();
183
182
  $(this).find('.ui.checkbox').checkbox();
184
183
  if(typeof modalOpen !== "undefined") modalOpen(this);
185
184
  },
186
185
  onVisible: function() {
187
- $('.needRefresh').froalaEditor('refresh');
186
+ // $('.needRefresh').froalaEditor('refresh');
188
187
  },
189
188
  onHide: function() {
190
189
  event_hub.$emit('cancel_customMode');
@@ -264,23 +263,43 @@ function vueCRUD_init(params = {}) {
264
263
  }.bind(this));
265
264
  event_hub.$emit('openModal');
266
265
  },
267
- restoreModel: function() {
268
- if(confirm("Are you sure?") == true) {
269
- event_hub.$emit('restoreCreate', this.model);
270
- }
271
- else {
272
-
273
- }
266
+ restoreModel: function () {
267
+ var that = this;
268
+ $.ajax({
269
+ method: 'POST',
270
+ data: JSON.stringify(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
+ });
274
287
  },
288
+ // restoreModel: function() {
289
+ // if(confirm("Are you sure?") == true) {
290
+ // event_hub.$emit('restoreCreate', this.model);
291
+ // }
292
+ // else {
293
+ //
294
+ // }
295
+ // },
275
296
  deleteModel: function () {
276
297
  var that = this;
277
298
  that.deleteMode = true;
278
- var id = that.model.ID || that.model.id;
279
-
280
299
  if(confirm("Are you sure?") == true) {
281
300
  $.ajax({
282
301
  method: 'DELETE',
283
- url: that.info.url_prefix + '/' + id + options.suffix + location.search,
302
+ url: that.info.url_prefix + '/' + that.model.ID + options.suffix + location.search,
284
303
  success: function(res) {
285
304
  that.is_deleted = true;
286
305
  event_hub.$on('toggleRestoreSuccess', function() {
@@ -308,12 +327,12 @@ function vueCRUD_init(params = {}) {
308
327
  },
309
328
  updateModel: function() {
310
329
  var that = this;
311
- var id = that.model.ID || that.model.id;
312
330
  $.ajax({
313
331
  method: 'PATCH',
314
- data: obj_to_json(that.model),
315
- url: that.info.url_prefix + '/' + id + options.suffix + location.search,
332
+ data: JSON.stringify(that.model),
333
+ url: that.info.url_prefix + '/' + that.model.ID + options.suffix + location.search,
316
334
  beforeSend: function() {
335
+ console.log(JSON.stringify(that.model));
317
336
  event_hub.$emit('dimmerOn');
318
337
  $('.progress-bar').css('width', '0');
319
338
  },
@@ -464,28 +483,28 @@ function vueCRUD_init(params = {}) {
464
483
  this.currentPage = idx;
465
484
  updateQueryStringParam('p', this.currentPage);
466
485
  },
467
- restoreModel: function () {
468
- var that = this;
469
- $.ajax({
470
- method: 'POST',
471
- data: obj_to_json(that.model),
472
- url: that.info.url_prefix + options.suffix + location.search,
473
- success: function(res) {
474
- event_hub.$emit('toggleRestoreSuccess');
475
- },
476
- error: function(res) {
477
- event_hub.$emit('toggleRestoreFail');
478
- }
479
- });
480
- },
486
+ // restoreModel: function () {
487
+ // var that = this;
488
+ // $.ajax({
489
+ // method: 'POST',
490
+ // data: JSON.stringify(that.model),
491
+ // url: that.info.url_prefix + options.suffix + location.search,
492
+ // success: function(res) {
493
+ // event_hub.$emit('toggleRestoreSuccess');
494
+ // },
495
+ // error: function(res) {
496
+ // event_hub.$emit('toggleRestoreFail');
497
+ // }
498
+ // });
499
+ // },
481
500
  createModel: function () {
482
501
  var that = this;
483
502
  $.ajax({
484
503
  method: 'POST',
485
- data: obj_to_json(that.model),
504
+ data: JSON.stringify(that.model),
486
505
  url: that.info.url_prefix + options.suffix + location.search,
487
506
  beforeSend: function() {
488
- console.log(obj_to_json(that.model));
507
+ console.log(JSON.stringify(that.model));
489
508
  event_hub.$emit('dimmerOn');
490
509
  $('.progress-bar').css('width', '0');
491
510
  },
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vue_crud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10.8
4
+ version: 0.1.10.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Chiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler