Skip to content

Commit

Permalink
Merge pull request #38 from SethSharp/latest-lumuix-changes
Browse files Browse the repository at this point in the history
Latest lumuix changes
  • Loading branch information
SethSharp authored Oct 12, 2024
2 parents 62ae474 + 46fc966 commit f62ab9a
Show file tree
Hide file tree
Showing 19 changed files with 354 additions and 170 deletions.
32 changes: 15 additions & 17 deletions app/Http/Controllers/Dashboard/Blogs/IndexBlogsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,24 @@ public function __invoke(): Response
{
$this->authorize('view', Blog::class);

$currentStatus = BlogStatus::from(request()->input('filter.status', BlogStatus::PUBLISHED->value) ?? BlogStatus::PUBLISHED->value);

$blogs = QueryBuilder::for(Blog::class)
->with(['tags', 'author', 'likes'])
->allowedFilters([
AllowedFilter::custom('status', new BlogStatusFilter())->default(BlogStatus::PUBLISHED->value),
AllowedFilter::custom('q', new BlogSearchFilter()),
])
->when($currentStatus->value === BlogStatus::PUBLISHED->value, fn ($query) => $query->orderByDesc('published_at'))
->paginate(10);
$currentStatus = BlogStatus::from(request()->input(
'filter.status',
BlogStatus::PUBLISHED->value
) ?? BlogStatus::PUBLISHED->value);

return Inertia::render('Dashboard/Blogs/Index', [
'blogs' => $blogs,
'status' => $currentStatus->label(),
'tabs' => collect(BlogStatus::cases())
->map(fn (BlogStatus $status) => [
'name' => $status->label(),
'active' => $status->value === $currentStatus->value,
'href' => route('dashboard.blogs.index', ['filter' => ['status' => $status->value]])
'blogs' => QueryBuilder::for(Blog::class)
->with(['tags', 'author', 'likes'])
->allowedFilters([
AllowedFilter::custom('status', new BlogStatusFilter())->default(BlogStatus::PUBLISHED->value),
AllowedFilter::custom('q', new BlogSearchFilter()),
])
->when(
$currentStatus->value === BlogStatus::PUBLISHED->value,
fn ($query) => $query->orderByDesc('published_at')
)
->paginate(10),
'status' => $currentStatus->label(),
]);
}
}
24 changes: 7 additions & 17 deletions app/Http/Controllers/Dashboard/Tags/IndexTagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,15 @@ public function __invoke(): Response
{
$this->authorize('view', Tag::class);

$tags = QueryBuilder::for(Tag::class)
->allowedFilters([
AllowedFilter::custom('status', new TagStatusFilter())->default(TagStatus::ACTIVE->value)
])
->defaultSort('-created_at')
->paginate(10)
->withQueryString();

$currentStatus = TagStatus::from(request()->input('filter.status', TagStatus::ACTIVE->value));

return Inertia::render('Dashboard/Tags/Index', [
'tags' => $tags,
'currentStatus' => $currentStatus->label(),
'tabs' => collect(TagStatus::cases())
->map(fn (TagStatus $status) => [
'name' => $status->label(),
'active' => $status->value === $currentStatus->value,
'href' => route('dashboard.tags.index', ['filter' => ['status' => $status->value]])
'tags' => QueryBuilder::for(Tag::class)
->allowedFilters([
AllowedFilter::custom('status', new TagStatusFilter())->default(TagStatus::ACTIVE->value)
])
->defaultSort('-created_at')
->paginate(10)
->withQueryString(),
'currentStatus' => TagStatus::from(request()->input('filter.status', TagStatus::ACTIVE->value))->label(),
]);
}
}
40 changes: 34 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@alpinejs/intersect": "^3.13.7",
"@headlessui/vue": "^1.7.16",
"@heroicons/vue": "^2.0.18",
"@sethsharp/lumuix": "^1.0.0-alpha.2.2",
"@sethsharp/lumuix": "^1.0.0-alpha.10.1",
"@tiptap/extension-bubble-menu": "^2.2.1",
"@tiptap/extension-code-block-lowlight": "^2.2.4",
"@tiptap/extension-document": "^2.2.1",
Expand Down
63 changes: 33 additions & 30 deletions resources/js/Components/Blogs/CreateEditForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,40 @@ window.addEventListener('beforeunload', confirmLeave)
</FormElement>
<FormElement>
<Checkbox id="is_draft" v-model="form.is_draft" label="Is Draft" />
<Error :error="form.errors.is_draft" />
<Checkbox
id="is_draft"
v-model="form.is_draft"
text="Is Draft"
:error="form.errors.is_draft"
/>
</FormElement>
<FormGrid>
<FormElement>
<Label id="title"> Title </Label>
<Input id="title" v-model="form.title" :error="form.errors.title" label="Title" />
</FormElement>
<FormElement class="flex flex-col space-y-2">
<Label id="collection"> Collection </Label>
<Combobox
id="collection"
label="Collection"
v-model="form.collection_id"
:options="collectionOptions"
allow-search
width-class="w-full md:w-96"
:error="form.errors.collection_id"
/>
<Error :error="form.errors.collection_id" />
</FormElement>
</FormGrid>
<FormGrid>
<FormElement>
<Label id="slug"> (must be lowercase separated by '-') </Label>
<Input id="slug" v-model="form.slug" placeholder="a-new-blog-of-mine" />
<Input
id="slug"
label="Slug (must be lowercase separated by '-')"
v-model="form.slug"
placeholder="a-new-blog-of-mine"
/>
<Description>
{{
'Can be left empty, title will be slugified and entered here. When viewing the blog in the web it will appear as blogs/' +
Expand All @@ -152,55 +160,50 @@ window.addEventListener('beforeunload', confirmLeave)
</FormElement>
<FormElement class="flex flex-col space-y-2">
<Label> Tags </Label>
<Combobox
v-model="form.tags"
label="Tags"
:options="tagOptions"
width-class="w-full md:w-96"
multiple
allow-search
:error="form.errors.tags"
/>
<Error :error="form.errors.tags" />
</FormElement>
</FormGrid>
<FormElement>
<Label> Meta Title </Label>
<Input
id="meta-title"
v-model="form.meta_title"
label="Meta Title"
description="Serves as a SEO title for Google to read (can be the same as your regular title)"
:error="form.errors.meta_title"
/>
<Description>
Serves as a SEO title for Google to read (can be the same as your regular title)
</Description>
<Error :error="form.errors.meta_title" />
</FormElement>
<FormElement>
<Label> Meta Description </Label>
<TextArea id="meta-description" v-model="form.meta_description" />
<Description>
Serves as a small blurb on the blog, used both in Google previews and within the
portfolio site itself.</Description
>
<Error :error="form.errors.meta_description" />
<TextArea
id="meta-description"
label="Meta Description"
description="Serves as a small blurb on the blog, used both in Google previews and within the portfolio site itself."
v-model="form.meta_description"
:error="form.errors.meta_description"
/>
</FormElement>
<FormElement>
<Label> Meta Tags</Label>
<Input id="meta-tags" v-model="form.meta_tags" />
<Description>
description="Helps Google understand the content of the page - similar to how
hashtags work on Instagram"
</Description>
<Error :error="form.errors.meta_tags" />
<Input
id="meta-tags"
label="Meta Tags"
description="Helps Google understand the content of the page - similar to how hashtags work on Instagram"
v-model="form.meta_tags"
:error="form.errors.meta_tags"
/>
</FormElement>
<FormElement>
<Editor v-model="form.content" :blog="blog" />
<Error :error="form.errors.content" />
<Editor v-model="form.content" :blog="blog" :error="form.errors.content" />
</FormElement>
<Button variant="primary" @click.prevent="submit">
Expand Down
14 changes: 11 additions & 3 deletions resources/js/Components/Editor/Components/Modals/EditImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import axios from 'axios'
import { ref, watch } from 'vue'
import { useVModels } from '@vueuse/core'
import { PencilSquareIcon } from '@heroicons/vue/16/solid/index.js'
import { Modal, Input, FormElement, ImageUpload, Button, Label, Error } from '@sethsharp/lumuix'
import {
LumuixModal,
Input,
FormElement,
ImageUpload,
Button,
Label,
Error,
} from '@sethsharp/lumuix'
const props = defineProps({
open: Boolean,
Expand Down Expand Up @@ -63,7 +71,7 @@ watch(file, (_) => {
</script>

<template>
<Modal :header-data="{ title: 'Manage Image' }" size="2xl">
<LumuixModal :header-data="{ title: 'Manage Image' }" size="2xl">
<template #trigger>
<PencilSquareIcon class="size-4" />
</template>
Expand All @@ -88,5 +96,5 @@ watch(file, (_) => {

<Button variant="primary" @click.prevent="emits('close')"> Save</Button>
</template>
</Modal>
</LumuixModal>
</template>
Loading

0 comments on commit f62ab9a

Please sign in to comment.