Skip to content

Fix product category description not showing #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function rules(): array
{
return [
'name' => ['string', 'required', 'max:50'],
'description' => ['string', 'max:255', 'nullable'],
'description' => ['string', 'max:5000', 'nullable'],
'is_hidden' => ['boolean', 'required'],
'no_products_message' => ['string', 'max:255', 'nullable'],
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('product_categories', function (Blueprint $table) {
$table->text('description')
->nullable()
->change();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('product_categories', function (Blueprint $table) {
$table->string('description')
->nullable()
->change();
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const ProductCategoryForm = ({form}: ProductCategoryFormProps) => {
description={"An optional description of this category to display on the event page."}
onChange={(value) => form.setFieldValue("description", value)}
value={form.values.description || ""}
maxLength={5000}
/>

<Switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,19 @@ const SelectProducts = (props: SelectProductsProps) => {
{productCategories && productCategories.map((category) => {
return (
<div className={'hi-product-category-row'} key={category.id}>
<h2 className={'hi-product-category-title'}>
<h2 className={'hi-product-category-title'} style={category.description ? {
marginBottom: '0px'
} : {}}>
{category.name}
</h2>
{category.description && (
<div className={'hi-product-category-description'}>
<Spoiler maxHeight={500} showLabel={t`Show more`} hideLabel={t`Hide`}>
<div dangerouslySetInnerHTML={{__html: category.description}}/>
</Spoiler>
</div>
)}
<div className={'hi-product-rows'}>

{category.products?.length === 0 && (
<div className={'hi-no-products'}>
<p className={'hi-no-products-message'}>
Expand Down