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

View File

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

View File

@ -29,10 +29,11 @@ import axios from 'axios';
// Vue.component('example', require('./components/Example.vue')); // Vue.component('example', require('./components/Example.vue'));
//Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue')); //Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue'));
import MyAutocomplete from './components/MyAutocomplete.vue'; import MyAutocomplete from './components/MyAutocomplete.vue';
import messagesEN from './strings/messages/en.js';
import VeeValidate from 'vee-validate'; import VeeValidate from 'vee-validate';
import dataset from './components/Dataset'; import dataset from './components/Dataset';
import LocationsMap from './components/LocationsMap.vue'; 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 modal from './components/ShowModal.vue';
// import datetime from 'vuejs-datetimepicker'; // import datetime from 'vuejs-datetimepicker';
// import { Validator } from 'vee-validate'; // import { Validator } from 'vee-validate';
@ -40,16 +41,28 @@ import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/index.css'; import 'vue-toast-notification/dist/index.css';
Vue.use(VueToast); Vue.use(VueToast);
const dict = {
custom: {
keyword_list: {
keywords_length: 'Minimum 3 keywords are required'
}
}
};
// Vue.use(VeeValidate); // Vue.use(VeeValidate);
Vue.use(VeeValidate, { Vue.use(VeeValidate, {
// validity: true // 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 STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
const app = new Vue({ const app = new Vue({
el: '#app', el: '#app',
components: { MyAutocomplete, LocationsMap, modal, CreatorTable }, components: { MyAutocomplete, LocationsMap, modal, PersonTable },
data() { data() {
return { return {
list: [ list: [
@ -137,6 +150,9 @@ const app = new Vue({
this.reset(); this.reset();
}, },
computed: { computed: {
keywords_length() {
return this.dataset.keywords.length;
},
isInitial() { isInitial() {
return this.currentStatus === STATUS_INITIAL; 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> </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"> <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> <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>
<fieldset id="fieldset-contributors"> <fieldset id="fieldset-contributors">
@ -505,6 +505,7 @@
<fieldset id="fieldset-keywords"> <fieldset id="fieldset-keywords">
<legend>Dataset Keywords</legend> <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> <button class="pure-button button-small" @click.prevent="addKeyword()">Add Keyword</button>
<table class="table table-hover" v-if="dataset.keywords.length"> <table class="table table-hover" v-if="dataset.keywords.length">
<thead> <thead>