moves createrecord component to use new modal

This commit is contained in:
kevmodrome 2020-04-06 16:02:45 +02:00
parent 85289889f4
commit cef7693026
2 changed files with 42 additions and 32 deletions

View File

@ -67,10 +67,9 @@
}
</script>
<div>
<div class="actions">
<h4 class="budibase__title--4">Create / Edit Record</h4>
<ErrorsBox {errors} />
<div class="actions">
<form class="uk-form-stacked">
{#if !record}
<div class="uk-margin">
@ -86,20 +85,19 @@
<RecordFieldControl record={editingRecord} {field} {errors} />
{/each}
</form>
</div>
<footer>
<ActionButton alert on:click={onClosed}>Cancel</ActionButton>
<ActionButton on:click={saveRecord}>Save</ActionButton>
</footer>
</div>
</div>
<style>
.actions {
padding: 30px;
}
footer {
position: absolute;
padding: 20px;
width: 100%;
bottom: 0;
left: 0;
background: #fafafa;
border-radius: 0.5rem;
}
</style>

View File

@ -1,8 +1,25 @@
<script>
import { getContext } from "svelte"
import ModelDataTable from "components/database/ModelDataTable"
import { store, backendUiStore } from "builderStore"
import ActionButton from "components/common/ActionButton.svelte"
import * as api from "components/database/ModelDataTable/api"
import { CreateEditRecordModal } from "components/database/ModelDataTable/modals"
const { open, close } = getContext("simple-modal")
const createNewRecord = () => {
console.log("TEST")
selectedRecord = null
open(
CreateEditRecordModal,
{
onClosed: close,
record: selectedRecord,
},
{ styleContent: { padding: "0" } }
)
}
export let selectedDatabase
@ -21,12 +38,7 @@
<div class="database-actions">
<div class="budibase__label--big">{breadcrumbs}</div>
{#if $backendUiStore.selectedDatabase.id}
<ActionButton
primary
on:click={() => {
selectedRecord = null
backendUiStore.actions.modals.show('RECORD')
}}>
<ActionButton primary on:click={createNewRecord}>
Create new record
</ActionButton>
{/if}