Adds IDs to Collection and Item creation. Adds props ID to Tainacan Field Types in order to allow tests automation.

This commit is contained in:
mateuswetah 2018-02-26 09:35:20 -03:00
parent 318380ea9d
commit 5af7fbfbf9
13 changed files with 90 additions and 26 deletions

View File

@ -15,6 +15,7 @@
<li><router-link tag="a" to="/items" :class="activeRoute == 'ItemsPage' ? 'is-active':''">
<b-icon size="is-small" icon="note-multiple"></b-icon> <span class="menu-text">{{ $i18n.get('items')}}</span>
</router-link></li>
<div class="separator"></div>
<li><router-link tag="a" to="/fields" :class="activeRoute == 'FieldsPage' ? 'is-active':''">
<b-icon size="is-small" icon="format-list-checks"></b-icon> <span class="menu-text">{{ $i18n.get('fields')}}</span>
</router-link></li>
@ -54,7 +55,7 @@ export default {
},
created () {
this.isCompressed = (this.$route.params.id != undefined);
this.activeRoute = this.$route.to;
this.activeRoute = this.$route.name;
}
}
</script>
@ -89,7 +90,11 @@ export default {
-webkit-transition: opacity 0.15s linear, visibility 0.15s linear;
}
}
.separator {
height: 2px;
background-color: $primary-darker;
width: 100%;
}
li{
a {
color: white;

View File

@ -1,6 +1,13 @@
<template>
<nav id="secondary-menu" role="navigation" aria-label="secondary navigation" class="column is-2 is-sidebar-menu">
<nav id="secondary-menu" role="navigation" aria-label="secondary navigation" class="column is-sidebar-menu">
<aside class="menu">
<div class="menu-header">
<ul class="menu-list"><li><router-link tag="a" to="/">
<b-icon size="is-medium" icon="chevron-left"></b-icon>
<img class="tainacan-logo" :src="logoHeader"/>
</router-link></li></ul>
</div>
<ul class="menu-list">
<li><router-link tag="a" :to="{ path: `/collections/${id}/items`}" :class="activeRoute == 'ItemsList' ? 'is-active':''">{{ $i18n.get('items')}}</router-link></li>
<li><router-link tag="a" :to="{ path: `/collections/${id}/edit`}" :class="activeRoute == 'CollectionEditionPage' ? 'is-active':''">{{ $i18n.get('edit')}}</router-link></li>
@ -16,6 +23,7 @@ export default {
name: 'SecondaryMenu',
data(){
return {
logoHeader: '../wp-content/plugins/tainacan/admin/images/tainacan_logo_header.png',
activeRoute: 'ItemsList'
}
},
@ -45,6 +53,26 @@ export default {
transition: max-width 0.3s linear;
max-width: 180px;
.menu-header {
background-color: $primary-dark;
height: 62px;
a { padding: 1em 1.2em; }
.icon {
position: absolute;
opacity: 0;
visibility: hidden;
transition: opacity 0.2s linear, visibility 0.2s linear;
-webkit-transition: opacity 0.2s linear, visibility 0.2s linear;
}
.tainacan-logo {
max-height: 28px;
opacity: 1;
visibility: visible;
transition: opacity 0.15s linear, visibility 0.15s linear;
-webkit-transition: opacity 0.15s linear, visibility 0.15s linear;
}
}
li{
a {
color: white;

View File

@ -4,11 +4,13 @@
<form label-width="120px">
<b-field label="Título">
<b-input
id="tainacan-text-name"
v-model="form.name">
</b-input>
</b-field>
<b-field label="Descrição">
<b-input
id="tainacan-text-description"
type="textarea"
v-model="form.description"
>
@ -16,6 +18,7 @@
</b-field>
<b-field label="Status">
<b-select
id="tainacan-select-status"
v-model="form.status"
placeholder="Selecione um status">
<option

View File

@ -3,10 +3,11 @@
<h1 class="is-size-3">Item creation <b-tag v-if="item != null && item != undefined" :type="'is-' + getStatusColor(item.status)" v-text="item.status"></b-tag></h1>
<form label-width="120px">
<b-field label="Status">
<b-select
<b-select id="status-select"
v-model="form.status"
placeholder="Selecione um status">
<option
id="{{'status-option-' + statusOption.value}}"
v-for="statusOption in statusOptions"
:key="statusOption.value"
:value="statusOption.value"
@ -37,10 +38,12 @@
v-bind:key="index"
:field="field"></tainacan-form-item>
<button
id="button-cancel-item-creation"
class="button"
type="button"
@click="cancelBack">Cancelar</button>
<a
id="button-submit-item-creation"
@click="onSubmit"
class="button is-success is-hovered">Salvar</a>
</form>

View File

@ -4,11 +4,11 @@
v-for="option,index in getOptions"
class="field">
<b-checkbox
:id="id"
v-model="checked"
:native-value="option"
>{{ option }}</b-checkbox>
</div>
</div>
</template>
@ -30,7 +30,8 @@
options: {
type: String
},
value: [String, Number, Array]
value: [String, Number, Array],
id: ''
},
watch: {
checked: function(val){

View File

@ -1,5 +1,6 @@
<template>
<b-datepicker
:id="id"
v-model="dateValue"
@blur="onBlur"
@input="onInput($event)"></b-datepicker>
@ -12,6 +13,9 @@
dateValue: new Date()
}
},
props: {
id: ''
},
methods: {
onBlur() {
this.$emit('blur');

View File

@ -1,5 +1,6 @@
<template>
<b-input
:id="id"
type="number"
:value="inputValue"
@blur="onBlur"
@ -14,6 +15,9 @@
inputValue: ''
}
},
props: {
id: ''
},
methods: {
onBlur() {
this.$emit('blur');

View File

@ -1,6 +1,7 @@
<template>
<div>
<b-radio
:id="id"
v-for="option,index in getOptions"
:key="index"
v-model="checked"
@ -24,7 +25,8 @@
},
options: {
type: String
}
},
id: ''
},
computed: {
getOptions(){

View File

@ -1,6 +1,7 @@
<template>
<div>
<b-autocomplete
:id="id"
v-model="selected"
:data="options"
@input="search"
@ -32,7 +33,8 @@
},
collection_id: {
type: Number
}
},
id: ''
},
methods: {
setResults(option){

View File

@ -1,6 +1,9 @@
<template>
<div>
<b-select v-model="selected" @input="onChecked()">
<b-select
:id = "id"
v-model="selected"
@input="onChecked()">
<option
v-for="option,index in getOptions"
:key="index"
@ -27,6 +30,7 @@
type: String
},
value: [String, Number, Array],
id: ''
},
computed: {
getOptions(){

View File

@ -3,10 +3,10 @@
:message="getErrorMessage"
:type="fieldTypeMessage">
<div>
<component :is="field.field.field_type_object.component" v-model="inputs[0]" :field="field" @blur="changeValue()"></component>
<component :id="field.field.field_type_object.component + '-' + field.field.slug" :is="field.field.field_type_object.component" v-model="inputs[0]" :field="field" @blur="changeValue()"></component>
<div v-if="field.field.multiple == 'yes'">
<div v-if="index > 0" v-for="(input, index) in inputsList " v-bind:key="index" class="multiple-inputs">
<component :is="field.field.field_type_object.component" v-model="inputs[index]" :field="field" @blur="changeValue()"></component><a class="button" v-if="index > 0" @click="removeInput(index)">-</a>
<component :id="field.field.field_type_object.component + '-' + field.field.slug" :is="field.field.field_type_object.component" v-model="inputs[index]" :field="field" @blur="changeValue()"></component><a class="button" v-if="index > 0" @click="removeInput(index)">-</a>
</div>
<a class="button" @click="addInput">+</a>
</div>

View File

@ -1,5 +1,7 @@
<template>
<b-input :value="inputValue"
<b-input
:id="id"
:value="inputValue"
@blur="onBlur"
@input="onInput($event)"></b-input>
</template>
@ -8,11 +10,12 @@
export default {
data() {
return {
inputValue: ''
inputValue: '',
}
},
props: {
value: [String, Number, Object],
id: ''
},
methods: {
onBlur() {

View File

@ -1,5 +1,7 @@
<template>
<b-input type="textarea"
<b-input
:id="id"
type="textarea"
:value="inputValue"
@blur="onBlur"
@input="onInput($event)"></b-input>
@ -12,6 +14,9 @@
inputValue: ''
}
},
props: {
id: ''
},
methods: {
onBlur() {
this.$emit('blur');