Skip to content

Commit

Permalink
Merge branch 'main' into #333-cookies-component
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandraKozubal authored Sep 16, 2024
2 parents 5a36ee7 + e38ccdc commit bddd23c
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 27 deletions.
4 changes: 3 additions & 1 deletion app/Filament/Resources/ProjectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public static function table(Table $table): Table
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
])
->reorderable("sort_order")
->defaultSort("sort_order");
}

public static function getPages(): array
Expand Down
11 changes: 9 additions & 2 deletions app/Filament/Resources/ReferenceResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public static function form(Form $form): Form
"male" => "Mężczyzna",
"female" => "Kobieta",
]),
Forms\Components\TextInput::make("position")
->label("Stanowisko")
->maxLength(255),
Forms\Components\TextInput::make("company")
->label("Firma")
->required()
->maxLength(255),
Forms\Components\Checkbox::make("published")
->label("Opublikowane"),
Expand Down Expand Up @@ -71,6 +73,9 @@ public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make("creator_name")
->label("Autor")
->searchable(),
Tables\Columns\TextColumn::make("company")
->label("Firma")
->searchable(),
Expand All @@ -93,7 +98,9 @@ public static function table(Table $table): Table
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
])
->reorderable("sort_order")
->defaultSort("sort_order");
}

public static function getPages(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HomeController extends Controller
public function __invoke(Request $request, Factory $factory): View
{
$clients = config("clients");
$references = Reference::query()->where("published", true)->get();
$references = Reference::query()->where("published", true)->orderBy("sort_order")->get();

return $factory->make("home")
->with("references", $references)
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ProjectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ProjectsController extends Controller
{
public function index(Factory $factory): View
{
$projects = Project::query()->where("published", true)->paginate(4);
$projects = Project::query()->where("published", true)->orderBy("sort_order")->paginate(4);

return $factory->make("projects")
->with("projects", $projects);
Expand Down
1 change: 1 addition & 0 deletions app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @property string $template
* @property bool $published
* @property string $color
* @property ?int $sort_order
*/
class Project extends Model
{
Expand Down
5 changes: 4 additions & 1 deletion app/Models/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
* @property string $creator_name
* @property array $description
* @property string $photo
* @property string $company
* @property ?string $company
* @property bool $published
* @property string $sex
* @property ?int $sort_order
* @property ?string $position
*/
class Reference extends Model
{
Expand All @@ -33,6 +35,7 @@ class Reference extends Model
"description",
"published",
"sex",
"position",
];
protected $casts = [
"description" => "array",
Expand Down
3 changes: 2 additions & 1 deletion database/factories/ReferenceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ public function definition(): array
"description" => $this->translations($locales, $this->faker->paragraph),
"photo" => sprintf("%s/%s", "factory", "reference.jpg"),
"published" => $this->faker->boolean,
"company" => $this->faker->company,
"company" => $this->faker->boolean ? $this->faker->company : null,
"sex" => $this->faker->randomElement(["male", "female"]),
"position" => $this->faker->boolean ? $this->faker->jobTitle : null,
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

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

return new class() extends Migration {
public function up(): void
{
Schema::table("projects", function (Blueprint $table): void {
$table->integer("sort_order")->nullable();
});
}

public function down(): void
{
Schema::table("projects", function (Blueprint $table): void {
$table->dropColumn("sort_order");
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

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

return new class() extends Migration {
public function up(): void
{
Schema::table("references", function (Blueprint $table): void {
$table->integer("sort_order")->nullable();
});
}

public function down(): void
{
Schema::table("references", function (Blueprint $table): void {
$table->dropColumn("sort_order");
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

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

return new class() extends Migration {
public function up(): void
{
Schema::table("references", function (Blueprint $table): void {
$table->string("position")->nullable();
});
}

public function down(): void
{
Schema::table("references", function (Blueprint $table): void {
$table->dropColumn("position");
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

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

return new class() extends Migration {
public function up(): void
{
Schema::table("references", function (Blueprint $table): void {
$table->string("company")->nullable()->change();
});
}

public function down(): void
{
Schema::table("references", function (Blueprint $table): void {
$table->string("company")->nullable(false)->change();
});
}
};
1 change: 1 addition & 0 deletions lang/en/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,5 @@
"text_1" => "We use cookies on our website to ensure the best possible quality of services and to adapt the website to your needs. By clicking „Accept all”, you agree to our use of cookies. To learn more, check out our",
"text_2" => "privacy policy.",
],
"at" => "at",
];
1 change: 1 addition & 0 deletions lang/pl/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,5 @@
"text_1" => "Na naszej stronie używamy plików cookies („ciasteczek”), aby zapewnić jak najlepszą jakość usług i dostosować stronę do Twoich potrzeb. Klikając „Akceptuj wszystkie”, wyrażasz zgodę na używanie przez nas plików cookie. Aby dowiedzieć się więcej, sprawdź naszą",
"text_2" => "politykę prywatności.",
],
"at" => "w",
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@if(isset($reference->position))
{{ $reference->position }}
@endif

@if(isset($reference->position) && isset($reference->company))
{{ __('at') }}
@endif

@if(isset($reference->company))
{{ $reference->company }}
@endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
<figcaption class="mt-6 flex items-center gap-x-4">
<img class="h-10 w-10 rounded-full bg-gray-50"
src="{{ $reference->getPhotoPath() }}"
alt="{{ __('alt.reference') . ' ' . $reference->creator_name }}">
alt="{{ __('alt.reference') . ' reference.blade.php' . $reference->creator_name }}">
<div>
<div class="font-semibold text-left">{{ $reference->creator_name }}</div>
<div class="text-gray-600 text-left">{{ $reference->company }}</div>
<div class="text-gray-600 text-left">
<x-references.position-company-display :reference="$reference" />
</div>

</div>
</figcaption>
</figure>
Original file line number Diff line number Diff line change
Expand Up @@ -104,38 +104,47 @@
break;
}
@endphp
<div class="mx-auto mt-16 grid max-w-2xl grid-cols-1 grid-rows-1 gap-8 text-sm leading-6 text-gray-900 sm:mt-20 sm:grid-cols-2 xl:mx-0 xl:max-w-none xl:grid-flow-col xl:grid-cols-4 place-items-center md:place-items-start">
<div
class="mx-auto mt-16 grid max-w-2xl grid-cols-1 grid-rows-1 gap-8 text-sm leading-6 text-gray-900 sm:mt-20 sm:grid-cols-2 xl:mx-0 xl:max-w-none xl:grid-flow-col xl:grid-cols-4 place-items-center md:place-items-start">
<div @class([
"sm:col-span-2 xl:col-start-2 xl:row-end-1 space-y-8",
"hidden" => !(@isset($main) || @isset($main2))])>
@isset($main)
<figure class="rounded-2xl bg-white shadow-lg ring-1 ring-gray-900/5">
<blockquote class="p-6 md:text-lg md:font-semibold leading-7 md:tracking-tight text-gray-900 sm:p-12 sm:text-xl md:leading-8">
<blockquote
class="p-6 md:text-lg md:font-semibold leading-7 md:tracking-tight text-gray-900 sm:p-12 sm:text-xl md:leading-8">
<p>{!! "".$references[$main]->description."" !!}</p>
</blockquote>
<figcaption class="flex items-center gap-x-4 gap-y-4 md:border-t md:border-gray-900/10 px-6 py-4 sm:flex-nowrap">
<figcaption
class="flex items-center gap-x-4 gap-y-4 md:border-t md:border-gray-900/10 px-6 py-4 sm:flex-nowrap">
<img class="h-10 w-10 flex-none rounded-full bg-gray-50"
src="{{ $references[$main]->getPhotoPath() }}"
alt="{{ __('alt.reference') . " " . $references[$main]->creator_name }}">
<div class="flex-auto">
<div class="font-semibold text-left">{{ $references[$main]->creator_name }}</div>
<div class="text-gray-600 text-left">{{ $references[$main]->company }}</div>
<div class="text-gray-600 text-left break-words">
<x-references.position-company-display :reference="$references[$main]" />
</div>
</div>
</figcaption>
</figure>
@endisset
@isset($main2)
<figure class="rounded-2xl bg-white shadow-lg ring-1 ring-gray-900/5">
<blockquote class="p-6 md:text-lg md:font-semibold leading-7 md:tracking-tight text-gray-900 sm:p-12 sm:text-xl md:leading-8">
<blockquote
class="p-6 md:text-lg md:font-semibold leading-7 md:tracking-tight text-gray-900 sm:p-12 sm:text-xl md:leading-8">
<p>{!! "".$references[$main2]->description."" !!}</p>
</blockquote>
<figcaption class="flex flex-wrap items-center gap-x-4 gap-y-4 md:border-t md:border-gray-900/10 px-6 py-4 sm:flex-nowrap">
<figcaption
class="flex flex-wrap items-center gap-x-4 gap-y-4 md:border-t md:border-gray-900/10 px-6 py-4 sm:flex-nowrap">
<img class="h-10 w-10 flex-none rounded-full bg-gray-50"
src="{{ $references[$main2]->getPhotoPath() }}"
alt="{{ __('alt.reference') . " " . $references[$main2]->creator_name }}">
<div class="flex-auto">
<div class="font-semibold text-left">{{ $references[$main2]->creator_name }}</div>
<div class="text-gray-600 text-left">{{ $references[$main2]->company }}</div>
<div class="text-gray-600 text-left">
<x-references.position-company-display :reference="$references[$main2]" />
</div>
</div>
</figcaption>
</figure>
Expand All @@ -144,42 +153,42 @@
<div class="xl:contents xl:space-y-0">
<div class="space-y-8 xl:row-span-2 m-2">
@isset($references[$c1r1])
<x-reference :reference="$references[$c1r1]"/>
<x-references.reference :reference="$references[$c1r1]"/>
@endisset
@isset($references[$c1r2])
<x-reference :reference="$references[$c1r2]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c1r2]" class="hidden lg:block"/>
@endisset
@isset($references[$c1r3])
<x-reference :reference="$references[$c1r3]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c1r3]" class="hidden lg:block"/>
@endisset
</div>
<div class="space-y-8 xl:row-start-1 m-2">
@isset($references[$c2r1])
<x-reference :reference="$references[$c2r1]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c2r1]" class="hidden lg:block"/>
@endisset
@isset($references[$c2r2])
<x-reference :reference="$references[$c2r2]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c2r2]" class="hidden lg:block"/>
@endisset
</div>
</div>
<div class="xl:contents xl:space-y-0">
<div class="space-y-8 xl:row-start-1 m-2">
@isset($references[$c3r1])
<x-reference :reference="$references[$c3r1]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c3r1]" class="hidden lg:block"/>
@endisset
@isset($references[$c3r2])
<x-reference :reference="$references[$c3r2]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c3r2]" class="hidden lg:block"/>
@endisset
</div>
<div class="space-y-8 xl:row-span-2 m-2">
@isset($references[$c4r1])
<x-reference :reference="$references[$c4r1]"/>
<x-references.reference :reference="$references[$c4r1]"/>
@endisset
@isset($references[$c4r2])
<x-reference :reference="$references[$c4r2]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c4r2]" class="hidden lg:block"/>
@endisset
@isset($references[$c4r3])
<x-reference :reference="$references[$c4r3]" class="hidden lg:block"/>
<x-references.reference :reference="$references[$c4r3]" class="hidden lg:block"/>
@endisset
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class="client-icon h-auto w-44 m-auto grayscale hover:grayscale-0 transform tran
<span class="font-normal text-sm sm:text-md lg:text-lg">{{ __("content.home.section_5.subtitle_1") }}</span>
<div class="relative">
<div class="mx-auto max-w-7xl px-6 lg:px-8">
@includeWhen( count($references), 'components.references', ['references' => $references] )
@includeWhen( count($references), 'components.references.references', ['references' => $references] )
</div>
</div>
</section>
Expand Down

0 comments on commit bddd23c

Please sign in to comment.