vue_crud 0.2.0 → 0.2.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c480e6c99ea378f8bc13f03581794e8071cd194b
|
4
|
+
data.tar.gz: 68674c81d559ec005bbc5c1af21fa044494126e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28043b1108259c6d52c3e184c26c33d27157ac1c5a8766bfdce093974ac794cd9e8799841229b1d9cb9ca0042df531dd3b26496be905946202cc0d6ef7ee2fa
|
7
|
+
data.tar.gz: 36b4bbc0a3d202e6c512da91a60073921673aed9ed732978f69eecfd0e43ca88d135474fc66b86a6f0e1aa0557c3b44fab87878952ec5cd2471d0a1415b0f151
|
@@ -209,7 +209,7 @@ $(document).ready(function() {
|
|
209
209
|
<div class="ui top attached label gray">{{ info.titles.display_name }}</div>
|
210
210
|
<div class="header">{{ model[info.titles.title_attribute] }}</div>
|
211
211
|
<div class="meta">創建於 {{ model[info.titles.created_at_attribute] | datetime }}</div>
|
212
|
-
<div class="ui horizontal divider" v-toggle><h3><i class="bar chart icon"></i>欄位資料</h3></div>
|
212
|
+
<div class="ui horizontal divider" v-toggle><h3><i class="bar chart icon"></i><span>點擊查看</span>欄位資料</h3></div>
|
213
213
|
<div class="description attribute">
|
214
214
|
<div class="item" v-for="attribute in info.model_attributes" v-if="attribute.visible" :class="{highlight: attribute.name == selected_attribute}">
|
215
215
|
<div v-if="attribute.input_type == 'token'">
|
data/lib/vue_crud/version.rb
CHANGED
@@ -32,7 +32,7 @@ function obj_to_json(obj) {
|
|
32
32
|
// }
|
33
33
|
// return false;
|
34
34
|
// };
|
35
|
-
function urlParser(url, obj) {
|
35
|
+
function urlParser(url, obj, suffix) {
|
36
36
|
var parser = document.createElement('a');
|
37
37
|
parser.href = url;
|
38
38
|
parser.parameters = parser.pathname.split('/').filter(function (str) {
|
@@ -42,7 +42,7 @@ function urlParser(url, obj) {
|
|
42
42
|
$.each(parser.parameters, function(i, key){
|
43
43
|
parser.pathname = parser.pathname.replace(key, obj[key.replace(":", "")]);
|
44
44
|
});
|
45
|
-
url += parser.pathname + location.search;
|
45
|
+
url += parser.pathname + suffix + location.search;
|
46
46
|
return url;
|
47
47
|
}
|
48
48
|
function removeParam(key, sourceURL) {
|
@@ -232,7 +232,7 @@ function vueCRUD_init(params = {}) {
|
|
232
232
|
},
|
233
233
|
data: function() {
|
234
234
|
return {
|
235
|
-
model: {},
|
235
|
+
// model: {},
|
236
236
|
progress: '0',
|
237
237
|
errors: {},
|
238
238
|
modified: false,
|
@@ -258,6 +258,7 @@ function vueCRUD_init(params = {}) {
|
|
258
258
|
},
|
259
259
|
mounted: function() {
|
260
260
|
this.model = this.original_model;
|
261
|
+
|
261
262
|
event_hub.$on('update_progress', function(progress) {
|
262
263
|
this.progress = progress;
|
263
264
|
}.bind(this));
|
@@ -272,6 +273,11 @@ function vueCRUD_init(params = {}) {
|
|
272
273
|
}
|
273
274
|
}.bind(this));
|
274
275
|
},
|
276
|
+
computed: {
|
277
|
+
model: function() {
|
278
|
+
return this.original_model
|
279
|
+
}
|
280
|
+
},
|
275
281
|
methods: {
|
276
282
|
editModel: function(action_name) {
|
277
283
|
var url = this.info.actions.delete.url;
|
@@ -288,10 +294,11 @@ function vueCRUD_init(params = {}) {
|
|
288
294
|
},
|
289
295
|
restoreModel: function() {
|
290
296
|
var that = this;
|
297
|
+
console.log(urlParser(that.info.actions.create.url, that.model, that.info.actions.create.suffix));
|
291
298
|
$.ajax({
|
292
299
|
method: that.info.actions.create.method,
|
293
300
|
data: obj_to_json(that.model),
|
294
|
-
url: urlParser(that.info.actions.create.url, that.model),
|
301
|
+
url: urlParser(that.info.actions.create.url, that.model, that.info.actions.create.suffix),
|
295
302
|
success: function(res) {
|
296
303
|
that.model = res;
|
297
304
|
that.deleteMode = false;
|
@@ -314,7 +321,7 @@ function vueCRUD_init(params = {}) {
|
|
314
321
|
that.deleteMode = true;
|
315
322
|
$.ajax({
|
316
323
|
method: that.info.actions.delete.method,
|
317
|
-
url: urlParser(that.info.actions.delete.url, that.model),
|
324
|
+
url: urlParser(that.info.actions.delete.url, that.model, that.info.actions.delete.suffix),
|
318
325
|
success: function(res) {
|
319
326
|
that.is_deleted = true;
|
320
327
|
},
|
@@ -332,7 +339,7 @@ function vueCRUD_init(params = {}) {
|
|
332
339
|
$.ajax({
|
333
340
|
method: that.info.actions.update.method,
|
334
341
|
data: obj_to_json(that.model),
|
335
|
-
url: urlParser(that.info.actions.update.url, that.model),
|
342
|
+
url: urlParser(that.info.actions.update.url, that.model, that.info.actions.update.suffix),
|
336
343
|
beforeSend: function() {
|
337
344
|
console.log(obj_to_json(that.model));
|
338
345
|
|
@@ -390,7 +397,7 @@ function vueCRUD_init(params = {}) {
|
|
390
397
|
success: function(res) {
|
391
398
|
that.info = res;
|
392
399
|
that.model = {};
|
393
|
-
var default_url = that.info.actions.index.url + location.search;
|
400
|
+
var default_url = that.info.actions.index.url + that.info.actions.index.suffix + location.search;
|
394
401
|
default_url = removeParam("p", default_url);
|
395
402
|
default_url = removeParam("q", default_url);
|
396
403
|
default_url = removeParam("mp", default_url);
|
@@ -398,7 +405,7 @@ function vueCRUD_init(params = {}) {
|
|
398
405
|
default_url = removeParam("st", default_url);
|
399
406
|
that.default_url = default_url;
|
400
407
|
$.ajax({
|
401
|
-
url: urlParser(that.info.actions.index.url, that.model),
|
408
|
+
url: urlParser(that.info.actions.index.url, that.model, that.info.actions.index.suffix),
|
402
409
|
success: function(res) {
|
403
410
|
that.models = res;
|
404
411
|
}
|
@@ -484,6 +491,7 @@ function vueCRUD_init(params = {}) {
|
|
484
491
|
return;
|
485
492
|
}
|
486
493
|
this.currentPage = idx;
|
494
|
+
|
487
495
|
updateQueryStringParam('p', this.currentPage);
|
488
496
|
},
|
489
497
|
createModel: function () {
|
@@ -491,7 +499,7 @@ function vueCRUD_init(params = {}) {
|
|
491
499
|
$.ajax({
|
492
500
|
method: that.info.actions.create.method,
|
493
501
|
data: obj_to_json(that.model),
|
494
|
-
url: urlParser(that.info.actions.create.url, that.model),
|
502
|
+
url: urlParser(that.info.actions.create.url, that.model, that.info.actions.create.suffix),
|
495
503
|
beforeSend: function() {
|
496
504
|
console.log(obj_to_json(that.model));
|
497
505
|
event_hub.$emit('dimmerOn');
|
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
|
+
version: 0.2.0.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:
|
11
|
+
date: 2017-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|