Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SethSharp committed Feb 3, 2024
1 parent 41a83c0 commit fc73139
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/Dashboard/Blogs/EditBlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class EditBlogController extends Controller
{
public function __invoke(Blog $blog): Response
{
$blog->load('tags');

return Inertia::render('Dashboard/Blogs/Edit', [
'blog' => $blog,
'tags' => Tag::all()
Expand Down
6 changes: 4 additions & 2 deletions resources/js/Components/Blogs/CreateEditForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const tagOptions = props.tags.map((tag) => {
const form = useForm({
title: props.blog?.title ? props.blog.title : '',
slug: props.blog?.slug ? props.blog.slug : '',
tags: [],
tags: props.blog?.tags ? props.blog.tags : [],
meta_title: props.blog?.meta_title ? props.blog.meta_title : '',
meta_description: props.blog?.meta_description ? props.blog.meta_description : '',
meta_tags: props.blog?.meta_tags ? props.blog.meta_tags : '',
Expand Down Expand Up @@ -89,6 +89,8 @@ const submit = () => {
<InputError :message="form.errors.is_draft" />
</FormElement>
<PrimaryButton as="submit" @click.prevent="submit"> Publish</PrimaryButton>
<PrimaryButton as="submit" @click.prevent="submit">
{{ blog ? 'Update' : 'Save' }}
</PrimaryButton>
</Form>
</template>
6 changes: 5 additions & 1 deletion resources/js/Components/Inputs/MultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { ChevronUpDownIcon, CheckIcon } from '@heroicons/vue/16/solid/index.js'
import InputLabel from '@/Components/Inputs/InputLabel.vue'
const props = defineProps({
modelValue: {
type: Array,
default: null,
},
options: {
type: Array,
required: true,
Expand All @@ -17,7 +21,7 @@ const props = defineProps({
const emits = defineEmits(['update:modelValue'])
const selectedOptions = ref([])
const selectedOptions = ref(props.modelValue ? props.modelValue : [])
watch(selectedOptions, (newVal) => {
if (newVal) {
Expand Down
10 changes: 5 additions & 5 deletions resources/js/Components/Tags/CreateEditTagForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ const restoreTag = () => {
</FormElement>
<div class="gap-x-2 flex">
<DangerButton v-if="tag && !tag.deleted_at" @click.prevent="removeTag">
Delete</DangerButton
>
<DangerButton v-if="tag && !tag?.deleted_at" @click.prevent="removeTag">
Delete
</DangerButton>
<PrimaryButton v-if="tag.deleted_at" @click.prevent="restoreTag">
<PrimaryButton v-if="tag?.deleted_at" @click.prevent="restoreTag">
Restore
</PrimaryButton>
<PrimaryButton v-if="!tag.deleted_at" @click.prevent="submit"> Save</PrimaryButton>
<PrimaryButton v-if="!tag?.deleted_at" @click.prevent="submit"> Save</PrimaryButton>
</div>
</Form>
</template>

0 comments on commit fc73139

Please sign in to comment.