vue_crud 0.2.0.5 → 0.2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/vue_crud/templates/vue_crud.html +35 -27
- data/lib/vue_crud/version.rb +1 -1
- data/vendor/assets/javascripts/vue_crud.js +3 -1
- 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: ac9cf45c4cff01f7e7f0fc6b5dd93cd4a0c9bd62
|
4
|
+
data.tar.gz: dc3be839adc92a391946644bed4618b3617df7f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43ec4022c830adffefa688f1b89dbb5c1f746e20320dc0928bb1579e06c6373c60d2c7e88bf1dde225b5ca790a443b7ee6a667810e445d5d855982228b1f635a
|
7
|
+
data.tar.gz: 7507e02e039f5bfb694b7da6a1b3c8265f2c99c28f4d278ef33f8cafd6c88b7af617bd375b7492cbfb809adba99d00c805c5d8baa78f45999a091305f6e4059c
|
@@ -38,10 +38,13 @@ $(document).ready(function() {
|
|
38
38
|
info_url: info_url
|
39
39
|
});
|
40
40
|
$('.filter .ui.dropdown').dropdown();
|
41
|
-
$('.ui.checkbox').checkbox();
|
41
|
+
// $('.ui.checkbox').checkbox();
|
42
42
|
});
|
43
43
|
</script>
|
44
44
|
<div id="vue_crud">
|
45
|
+
<div class="ui inverted dimmer" :class="{'active': !is_loaded}">
|
46
|
+
<div class="ui indeterminate text loader">處理中...</div>
|
47
|
+
</div>
|
45
48
|
<input type="text" name="progress" id="form-progress">
|
46
49
|
<h1 class="ui center aligned icon header">
|
47
50
|
<i class="icon" :class="info.titles.icon"></i> {{ info.titles.title }}
|
@@ -157,8 +160,11 @@ $(document).ready(function() {
|
|
157
160
|
</div>
|
158
161
|
</div>
|
159
162
|
<div class="actions">
|
160
|
-
<
|
161
|
-
|
163
|
+
<div class="ui buttons">
|
164
|
+
<button class="ui cancel button">取消</button>
|
165
|
+
<div class="or"></div>
|
166
|
+
<button @click="modalSubmit" class="ui button blue">{{ action_name }}</button>
|
167
|
+
</div>
|
162
168
|
<!-- NOTE: Custom modal action -->
|
163
169
|
<div class="inline-block custom_modal_action"></div>
|
164
170
|
</div>
|
@@ -187,20 +193,13 @@ $(document).ready(function() {
|
|
187
193
|
<span v-html="model[attribute.name]"></span>
|
188
194
|
</div>
|
189
195
|
|
196
|
+
<div v-else-if="attribute.display_type == 'datetime'">
|
197
|
+
{{ model[attribute.name] | datetime }}
|
198
|
+
</div>
|
199
|
+
|
190
200
|
<div v-else>
|
191
201
|
{{ model[attribute.name] }}
|
192
202
|
</div>
|
193
|
-
<!--
|
194
|
-
<span v-if="attribute.display_type != 'img'">
|
195
|
-
<span v-if="attribute.input_type == 'textarea'" v-html="model[attribute.name]">
|
196
|
-
</span>
|
197
|
-
<span v-else>
|
198
|
-
{{ model[attribute.name] }}
|
199
|
-
</span>
|
200
|
-
</span>
|
201
|
-
<span v-else>
|
202
|
-
<img :src="model[attribute.name]" />
|
203
|
-
</span> -->
|
204
203
|
</td>
|
205
204
|
<td style="position: relative;">
|
206
205
|
<a @click="restoreModel" onclick="return false" class="ui red right corner label" v-show="is_deleted" title="您已刪除,點擊復原">
|
@@ -230,6 +229,11 @@ $(document).ready(function() {
|
|
230
229
|
<i class="right trash icon"></i>
|
231
230
|
</div>
|
232
231
|
</div>
|
232
|
+
<div class="ui buttons" v-for="quick_toggle_attribute in info.quick_toggle_attributes">
|
233
|
+
<button class="ui button" @click="toggleTrue(quick_toggle_attribute.name)" :class="{'green': model[quick_toggle_attribute.name]}">{{ quick_toggle_attribute.labels[0] }}</button>
|
234
|
+
<div class="or"></div>
|
235
|
+
<button class="ui button" @click="toggleFalse(quick_toggle_attribute.name)" :class="{'green': !model[quick_toggle_attribute.name]}">{{ quick_toggle_attribute.labels[1] }}</button>
|
236
|
+
</div>
|
233
237
|
</td>
|
234
238
|
<td :colspan="info.model_attributes.length + 1">
|
235
239
|
<!-- NOTE: Custom model -->
|
@@ -267,6 +271,10 @@ $(document).ready(function() {
|
|
267
271
|
<span class="display_name">{{ attribute.display_name }}:</span>
|
268
272
|
<span v-html="model[attribute.name]"></span>
|
269
273
|
</div>
|
274
|
+
<div v-else-if="attribute.display_type == 'datetime'">
|
275
|
+
<span class="display_name">{{ attribute.display_name }}:</span>
|
276
|
+
{{ model[attribute.name] | datetime }}
|
277
|
+
</div>
|
270
278
|
<div v-else>
|
271
279
|
<span class="display_name">{{ attribute.display_name }}:</span>
|
272
280
|
{{ model[attribute.name] }}
|
@@ -310,8 +318,8 @@ $(document).ready(function() {
|
|
310
318
|
<div v-for="attribute in model_attributes" v-if="attribute.editable">
|
311
319
|
<!-- select -->
|
312
320
|
<div class="field" v-if="attribute.input_type == 'select'">
|
313
|
-
<label :for="'model_' + attribute.
|
314
|
-
<select :id="'model_' + attribute.
|
321
|
+
<label :for="'model_' + attribute.name">{{ attribute.display_name }}</label>
|
322
|
+
<select :id="'model_' + attribute.name" v-model="model[attribute.name]" class="ui fluid dropdown" :class="attribute.input_class">
|
315
323
|
<option v-for="option in attribute.options" :value="option.value" v-text="option.text"></option>
|
316
324
|
</select>
|
317
325
|
<div class="ui pointing red basic label" v-show="errors[attribute.name]">
|
@@ -322,8 +330,8 @@ $(document).ready(function() {
|
|
322
330
|
</div>
|
323
331
|
<!-- multiSelect -->
|
324
332
|
<div class="field" v-else-if="attribute.input_type == 'multiSelect'">
|
325
|
-
<label :for="'model_' + attribute.
|
326
|
-
<select :id="'model_' + attribute.
|
333
|
+
<label :for="'model_' + attribute.name">{{ attribute.display_name }}</label>
|
334
|
+
<select :id="'model_' + attribute.name" multiple v-model="model[attribute.name]" class="ui fluid dropdown" :class="attribute.input_class">
|
327
335
|
<option v-for="option in attribute.options" :value="option.value" v-text="option.text"></option>
|
328
336
|
</select>
|
329
337
|
<div class="ui pointing red basic label" v-show="errors[attribute.name]">
|
@@ -334,10 +342,10 @@ $(document).ready(function() {
|
|
334
342
|
</div>
|
335
343
|
<!-- selectInput -->
|
336
344
|
<div class="field" v-else-if="attribute.input_type == 'selectInput'">
|
337
|
-
<label :for="'model_' + attribute.
|
345
|
+
<label :for="'model_' + attribute.name">{{ attribute.display_name }}</label>
|
338
346
|
<div class="ui grid">
|
339
347
|
<div class="ten wide column">
|
340
|
-
<input type="text" :id="'model_' + attribute.
|
348
|
+
<input @keyup.enter="modalSubmit" type="text" :id="'model_' + attribute.name" v-model="model[attribute.name]" :class="attribute.input_class">
|
341
349
|
</div>
|
342
350
|
<div class="six wide column">
|
343
351
|
<select v-model="model[attribute.name]" class="ui dropdown" :class="attribute.input_class" onchange="$(this).parent().prev().find('input').val(this.value)">
|
@@ -353,8 +361,8 @@ $(document).ready(function() {
|
|
353
361
|
</div>
|
354
362
|
<!-- textarea -->
|
355
363
|
<div class="field" v-else-if="attribute.input_type == 'textarea'">
|
356
|
-
<label :for="'model_' + attribute.
|
357
|
-
<textarea v-froala :attribute="attribute.name" :id="'model_' + attribute.
|
364
|
+
<label :for="'model_' + attribute.name">{{ attribute.display_name }}</label>
|
365
|
+
<textarea v-froala :attribute="attribute.name" :id="'model_' + attribute.name" v-model="model[attribute.name]" :class="attribute.input_class"></textarea>
|
358
366
|
<div class="ui pointing red basic label" v-show="errors[attribute.name]">
|
359
367
|
<span style="color: red" v-for="(error, index) in errors[attribute.name]">
|
360
368
|
<span v-if="index > 0">,</span> {{ error }}
|
@@ -364,7 +372,7 @@ $(document).ready(function() {
|
|
364
372
|
<!-- checkbox -->
|
365
373
|
<div class="field" v-else-if="attribute.input_type == 'checkbox'">
|
366
374
|
<div class="ui checkbox">
|
367
|
-
<input type="checkbox" tabindex="0" :id="'model_' + attribute.
|
375
|
+
<input type="checkbox" tabindex="0" :id="'model_' + attribute.name" v-model="model[attribute.name]" :class="attribute.input_class">
|
368
376
|
<label>{{ attribute.display_name }}</label>
|
369
377
|
</div>
|
370
378
|
<div class="ui pointing red basic label" v-show="errors[attribute.name]">
|
@@ -375,8 +383,8 @@ $(document).ready(function() {
|
|
375
383
|
</div>
|
376
384
|
<!-- number -->
|
377
385
|
<div class="field" v-else-if="attribute.input_type == 'number'">
|
378
|
-
<label :for="'model_' + attribute.
|
379
|
-
<input type="number" :id="'model_' + attribute.
|
386
|
+
<label :for="'model_' + attribute.name">{{ attribute.display_name }}</label>
|
387
|
+
<input @keyup.enter="modalSubmit" type="number" :id="'model_' + attribute.name" v-model="model[attribute.name]" :class="attribute.input_class" number>
|
380
388
|
<div class="ui pointing red basic label" v-show="errors[attribute.name]">
|
381
389
|
<span style="color: red" v-for="(error, index) in errors[attribute.name]">
|
382
390
|
<span v-if="index > 0">,</span> {{ error }}
|
@@ -385,8 +393,8 @@ $(document).ready(function() {
|
|
385
393
|
</div>
|
386
394
|
<!-- else -->
|
387
395
|
<div class="field" v-else>
|
388
|
-
<label :for="'model_' + attribute.
|
389
|
-
<input type="text" :id="'model_' + attribute.
|
396
|
+
<label :for="'model_' + attribute.name">{{ attribute.display_name }}</label>
|
397
|
+
<input @keyup.enter="modalSubmit" type="text" :id="'model_' + attribute.name" v-model="model[attribute.name]" :class="attribute.input_class">
|
390
398
|
<div class="ui pointing red basic label" v-show="errors[attribute.name]">
|
391
399
|
<span style="color: red" v-for="(error, index) in errors[attribute.name]">
|
392
400
|
<span v-if="index > 0">,</span> {{ error }}
|
data/lib/vue_crud/version.rb
CHANGED
@@ -423,7 +423,8 @@ function vueCRUD_init(params = {}) {
|
|
423
423
|
filteredModelCount: null,
|
424
424
|
is_calculating: false,
|
425
425
|
selected_attribute: getParameterByName("sa"),
|
426
|
-
selected_text: getParameterByName("st")
|
426
|
+
selected_text: getParameterByName("st"),
|
427
|
+
is_loaded: false
|
427
428
|
}
|
428
429
|
},
|
429
430
|
mounted: function() {
|
@@ -476,6 +477,7 @@ function vueCRUD_init(params = {}) {
|
|
476
477
|
url: urlParser(that.info.actions.index.url, that.model, that.info.actions.index.suffix),
|
477
478
|
success: function(res) {
|
478
479
|
that.models = res;
|
480
|
+
that.is_loaded = true;
|
479
481
|
}
|
480
482
|
});
|
481
483
|
}
|