+ PersonTable.vue component

+ 3 keywords are required + custom error message
+ composer updates
This commit is contained in:
Arno Kaimbacher 2019-07-23 12:58:09 +02:00
parent 77b59fc33b
commit 9c210a0d96
9 changed files with 44 additions and 22 deletions

13
composer.lock generated
View File

@ -342,16 +342,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.9",
"version": "2.1.10",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "128cc721d771ec2c46ce59698f4ca42b73f71b25"
"reference": "a6c8d7101b19a451c1707b1b79bbbc56e4bdb7ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/128cc721d771ec2c46ce59698f4ca42b73f71b25",
"reference": "128cc721d771ec2c46ce59698f4ca42b73f71b25",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/a6c8d7101b19a451c1707b1b79bbbc56e4bdb7ec",
"reference": "a6c8d7101b19a451c1707b1b79bbbc56e4bdb7ec",
"shasum": ""
},
"require": {
@ -361,7 +361,8 @@
"require-dev": {
"dominicsayers/isemail": "dev-master",
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
"satooshi/php-coveralls": "^1.0.1"
"satooshi/php-coveralls": "^1.0.1",
"symfony/phpunit-bridge": "^4.4@dev"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
@ -395,7 +396,7 @@
"validation",
"validator"
],
"time": "2019-06-23T10:14:27+00:00"
"time": "2019-07-19T20:52:08+00:00"
},
{
"name": "erusev/parsedown",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -54,7 +54,7 @@ function initialState() {
// checkedSubmitters: [],
persons: [],
contributors: [],
contributors: []
// submitters: []
};
}
@ -75,7 +75,7 @@ const dataset = new Vue({
this.title_main.language = val;
this.abstract_main.language = val;
}
},
},
methods: {
reset() {
Object.assign(this.$data, initialState());

View File

@ -1,8 +1,8 @@
<template>
<table class="pure-table pure-table-horizontal" v-if="list.length">
<table class="pure-table pure-table-horizontal" v-if="personlist.length">
<thead class="thead-dark">
<tr>
<th scope="col">Sort Order</th>
<th scope="col">#</th>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Email</th>
@ -10,9 +10,9 @@
<th></th>
</tr>
</thead>
<draggable v-bind:list="list" tag="tbody" v-on:start="isDragging=true" v-on:end="isDragging=false">
<draggable v-bind:list="personlist" tag="tbody" v-on:start="isDragging=true" v-on:end="isDragging=false">
<tr
v-for="(item, index) in list"
v-for="(item, index) in personlist"
v-bind:key="item.id"
v-bind:class="[item.status==1 ? 'activeClass' : 'inactiveClass']"
>
@ -74,7 +74,7 @@ export default {
inject: {
$validator: "$validator"
},
name: "creator-table",
name: "person-table",
components: {
draggable
},
@ -92,7 +92,7 @@ export default {
};
},
props: {
list: {
personlist: {
type: Array,
required: true
},
@ -105,7 +105,7 @@ export default {
console.log("custom-actions: " + action, data.full_name, index);
},
removeAuthor(key) {
this.list.splice(key, 1);
this.personlist.splice(key, 1);
},
onMove({ relatedContext, draggedContext }) {
const relatedElement = relatedContext.element;

View File

@ -29,10 +29,11 @@ import axios from 'axios';
// Vue.component('example', require('./components/Example.vue'));
//Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue'));
import MyAutocomplete from './components/MyAutocomplete.vue';
import messagesEN from './strings/messages/en.js';
import VeeValidate from 'vee-validate';
import dataset from './components/Dataset';
import LocationsMap from './components/LocationsMap.vue';
import CreatorTable from './components/CreatorTable.vue';
import PersonTable from './components/PersonTable.vue';
import modal from './components/ShowModal.vue';
// import datetime from 'vuejs-datetimepicker';
// import { Validator } from 'vee-validate';
@ -40,16 +41,28 @@ import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/index.css';
Vue.use(VueToast);
const dict = {
custom: {
keyword_list: {
keywords_length: 'Minimum 3 keywords are required'
}
}
};
// Vue.use(VeeValidate);
Vue.use(VeeValidate, {
// validity: true
useConstraintAttrs: true
locale: 'en',
useConstraintAttrs: true,
dictionary: {
en: { messages: messagesEN }
}
});
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
const app = new Vue({
el: '#app',
components: { MyAutocomplete, LocationsMap, modal, CreatorTable },
components: { MyAutocomplete, LocationsMap, modal, PersonTable },
data() {
return {
list: [
@ -137,6 +150,9 @@ const app = new Vue({
this.reset();
},
computed: {
keywords_length() {
return this.dataset.keywords.length;
},
isInitial() {
return this.currentStatus === STATUS_INITIAL;
},

View File

@ -0,0 +1,4 @@
const messages={
min_value: (field, num) => field +' cannot be empty! ' + num + ' items are required.',
};
export default messages;

View File

@ -208,7 +208,7 @@
</div>
<input name="persons" v-model="dataset.persons" type="hidden" class="form-check-input" v-validate="'required'" data-vv-as="Creator" data-vv-scope="step-1">
<h3>Draggable table</h3>
<creator-table name="persons" v-bind:list="dataset.persons"></creator-table>
<person-table name="persons" v-bind:personlist="dataset.persons"></person-table>
</fieldset>
<fieldset id="fieldset-contributors">
@ -505,6 +505,7 @@
<fieldset id="fieldset-keywords">
<legend>Dataset Keywords</legend>
<input type="hidden" v-validate:keywords_length="'min_value:3'" data-vv-scope="step-2" data-vv-as="keyword list" name="keywords_list">
<button class="pure-button button-small" @click.prevent="addKeyword()">Add Keyword</button>
<table class="table table-hover" v-if="dataset.keywords.length">
<thead>