moves createrecord component to use new modal

This commit is contained in:
kevmodrome 2020-04-06 16:02:45 +02:00
parent 83c109612c
commit 7e6b6051f9
2 changed files with 42 additions and 32 deletions

View File

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

View File

@ -1,8 +1,25 @@
<script> <script>
import { getContext } from "svelte"
import ModelDataTable from "components/database/ModelDataTable" import ModelDataTable from "components/database/ModelDataTable"
import { store, backendUiStore } from "builderStore" import { store, backendUiStore } from "builderStore"
import ActionButton from "components/common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import * as api from "components/database/ModelDataTable/api" 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 export let selectedDatabase
@ -21,12 +38,7 @@
<div class="database-actions"> <div class="database-actions">
<div class="budibase__label--big">{breadcrumbs}</div> <div class="budibase__label--big">{breadcrumbs}</div>
{#if $backendUiStore.selectedDatabase.id} {#if $backendUiStore.selectedDatabase.id}
<ActionButton <ActionButton primary on:click={createNewRecord}>
primary
on:click={() => {
selectedRecord = null
backendUiStore.actions.modals.show('RECORD')
}}>
Create new record Create new record
</ActionButton> </ActionButton>
{/if} {/if}