fix the relations bug

master
Ondřej Hruška 4 years ago
parent 61d5791479
commit b24a8b2805
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 3
      yopa-web/resources/src/components/NewObjectForm.vue
  2. 36
      yopa-web/resources/src/components/NewRelationForm.vue
  3. 2
      yopa-web/resources/static/bundle.js
  4. 2
      yopa-web/resources/static/bundle.js.map

@ -36,6 +36,7 @@ export default {
model, model,
properties, properties,
relations, relations,
haveRelations: !isEmpty(relations),
model_names, model_names,
values, values,
name: '', name: '',
@ -132,7 +133,7 @@ export default {
<property v-for="(property, pi) in properties" :model="property" :values="values[property.id]" :key="pi"></property> <property v-for="(property, pi) in properties" :model="property" :values="values[property.id]" :key="pi"></property>
</table> </table>
<div v-if="relations.length > 0"> <div v-if="haveRelations">
<h3>Relations</h3> <h3>Relations</h3>
<new-relation <new-relation

@ -118,24 +118,22 @@ export default {
</style> </style>
<template> <template>
<div> <div class="new-relation" v-for="(instance, ri) in instances" :key="ri">
<div class="new-relation" v-for="(instance, ri) in instances" :key="ri"> <b>{{ model.name }} -&gt; {{ related_model.name }}
<b>{{ model.name }} -&gt; {{ related_model.name }} <select v-model="instance.related">
<select v-model="instance.related"> <option v-for="(name, id) in object_names" :value="id">{{name}}</option>
<option v-for="(name, id) in object_names" :value="id">{{name}}</option> </select>
</select> </b>
</b>
<a href="#" v-if="model.multiple || model.optional && instances.length > 0"
<a href="#" v-if="model.multiple || model.optional && instances.length > 0" style="margin-left: 5px"
style="margin-left: 5px" @click="removeInstance(ri)">X</a>
@click="removeInstance(ri)">X</a>
<table v-if="properties">
<table v-if="properties"> <property v-for="(property, id) in properties" :model="property" :values="instance.values[id]" :key="id"></property>
<property v-for="(property, id) in properties" :model="property" :values="instance.values[id]" :key="id"></property> </table>
</table>
</div>
<a href="#" v-if="model.multiple || model.optional && instances.length==0"
@click="addInstance">Add {{ model.name }} -&gt; {{ related_model.name }}</a>
</div> </div>
<a href="#" v-if="model.multiple || model.optional && instances.length==0"
@click="addInstance">Add {{ model.name }} -&gt; {{ related_model.name }}</a><br>
</template> </template>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save