vue_crud 0.2.0.4 → 0.2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71097ddc2018e4fcc3e8633bd2c7208ac9947d3c
4
- data.tar.gz: f9651d796b1a6cd2144fea361c10dc74749129c9
3
+ metadata.gz: c844059d406166143174ba9db8cfd5042e83867e
4
+ data.tar.gz: 42b56026739e215d96c9c61aa44a7b913e42d963
5
5
  SHA512:
6
- metadata.gz: 538ae320dd2813ad31a432f39470d04d32e5a9f0f9a711e9d34f55b7b57403f8925b1ad399787248188563d013e4c9cb18bdeae3e106813adddc1ac80eb3e4d3
7
- data.tar.gz: 6636f4982d50af544e98a0e75e84c182c0debfd1f59a772239300e663e7816e817d4b04e01aa435261a1ae42701f94229b08289490da10e635f7e36faaf48b23
6
+ metadata.gz: 6c8c6bb9f756e52f13a29d2896dc6628d063c8bc985a89d6dbf582f9caf937fe64a100c52108f8fefee2acf4ad9e291bb64c234fcd199590195133aa20fa3ca1
7
+ data.tar.gz: 7559938ad28712c5563888224ae0a98ca9f09b69b4bce2d834db45785b7784f17df2768f48196c1d181f29aadd4d57d7ebb8ef7c263e851686dca4e4541624be
@@ -1,3 +1,3 @@
1
1
  module VueCrud
2
- VERSION = "0.2.0.4"
2
+ VERSION = "0.2.0.5"
3
3
  end
@@ -279,6 +279,38 @@ function vueCRUD_init(params = {}) {
279
279
  }
280
280
  },
281
281
  methods: {
282
+ toggleTrue: function(name) {
283
+ var that = this;
284
+ var toggle_data = {};
285
+ toggle_data[name] = true;
286
+ $.ajax({
287
+ method: that.info.actions.update.method,
288
+ data: toggle_data,
289
+ url: urlParser(that.info.actions.update.url, that.model, that.info.actions.update.suffix),
290
+ success: function(res) {
291
+ that.model[name] = true;
292
+ sleep(1500).then(() => {
293
+ that.modified = false;
294
+ });
295
+ }
296
+ });
297
+ },
298
+ toggleFalse: function(name) {
299
+ var that = this;
300
+ var toggle_data = {};
301
+ toggle_data[name] = false;
302
+ $.ajax({
303
+ method: that.info.actions.update.method,
304
+ data: toggle_data,
305
+ url: urlParser(that.info.actions.update.url, that.model, that.info.actions.update.suffix),
306
+ success: function(res) {
307
+ that.model[name] = false;
308
+ sleep(1500).then(() => {
309
+ that.modified = false;
310
+ });
311
+ }
312
+ });
313
+ },
282
314
  editModel: function(action_name) {
283
315
  var url = this.info.actions.delete.url;
284
316
  event_hub.$emit('openModal');
@@ -340,8 +372,6 @@ function vueCRUD_init(params = {}) {
340
372
  data: obj_to_json(that.model),
341
373
  url: urlParser(that.info.actions.update.url, that.model, that.info.actions.update.suffix),
342
374
  beforeSend: function() {
343
- console.log(obj_to_json(that.model));
344
-
345
375
  event_hub.$emit('dimmerOn');
346
376
  $('.progress-bar').css('width', '0');
347
377
  },
@@ -432,6 +462,9 @@ function vueCRUD_init(params = {}) {
432
462
  success: function(res) {
433
463
  that.info = res;
434
464
  that.model = {};
465
+ $.each(res.model_attributes, function(i, attribute){
466
+ that.model[attribute.name] = attribute.default_value;
467
+ })
435
468
  var default_url = that.info.actions.index.url + that.info.actions.index.suffix + location.search;
436
469
  default_url = removeParam("p", default_url);
437
470
  default_url = removeParam("q", default_url);
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.2.0.4
4
+ version: 0.2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Chiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-23 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler