From 6db38d08f5881b882d18e32a9e8fb68126545e9c Mon Sep 17 00:00:00 2001 From: fsociety Date: Thu, 24 Oct 2024 17:40:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=95=20feat(project):=20add=20website?= =?UTF-8?q?=20field=20and=20validation=20for=20project=20proposals=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/Forms/ProjectProposalForm.php | 3 +++ ...bsite_field_to_project_proposals_table.php | 27 +++++++++++++++++++ .../project-support/form/create.blade.php | 10 +++++-- .../project-support/index.blade.php | 21 ++++++++++++++- 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2024_10_24_153410_add_website_field_to_project_proposals_table.php diff --git a/app/Livewire/Forms/ProjectProposalForm.php b/app/Livewire/Forms/ProjectProposalForm.php index c43341f..1e89e20 100644 --- a/app/Livewire/Forms/ProjectProposalForm.php +++ b/app/Livewire/Forms/ProjectProposalForm.php @@ -15,4 +15,7 @@ class ProjectProposalForm extends Form #[Validate('required|string|min:5')] public $description = ''; + + #[Validate('required|url')] + public $website= ''; } diff --git a/database/migrations/2024_10_24_153410_add_website_field_to_project_proposals_table.php b/database/migrations/2024_10_24_153410_add_website_field_to_project_proposals_table.php new file mode 100644 index 0000000..fdde4b8 --- /dev/null +++ b/database/migrations/2024_10_24_153410_add_website_field_to_project_proposals_table.php @@ -0,0 +1,27 @@ +string('website')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('project_proposals', function (Blueprint $table) { + // + }); + } +}; diff --git a/resources/views/pages/association/project-support/form/create.blade.php b/resources/views/pages/association/project-support/form/create.blade.php index 4d1faef..34e32e0 100644 --- a/resources/views/pages/association/project-support/form/create.blade.php +++ b/resources/views/pages/association/project-support/form/create.blade.php @@ -31,7 +31,7 @@ on([ $this->currentPubkey = $pubkey; $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); if ($this->currentPleb->association_status->value < 3) { - return $this->js('alert("Du bist hierzu berechtigt.")'); + return $this->js('alert("Du bist hierzu nicht berechtigt.")'); } $this->isAllowed = true; }, @@ -57,7 +57,8 @@ $save = function () { @volt -
+
@@ -82,6 +83,11 @@ $save = function () { :placeholder="__('Name')"/> + + + + diff --git a/resources/views/pages/association/project-support/index.blade.php b/resources/views/pages/association/project-support/index.blade.php index 421a350..8ce2c34 100644 --- a/resources/views/pages/association/project-support/index.blade.php +++ b/resources/views/pages/association/project-support/index.blade.php @@ -23,13 +23,32 @@ state([ 'votes', ]) ->get(), + 'isAllowed' => false, + 'currentPubkey' => null, + 'currentPleb' => null, +]); + +on([ + 'nostrLoggedIn' => function ($pubkey) { + $this->currentPubkey = $pubkey; + $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); + if ($this->currentPleb->association_status->value < 2) { + return $this->js('alert("Du bist hierzu nicht berechtigt.")'); + } + $this->isAllowed = true; + }, + 'nostrLoggedOut' => function () { + $this->isAllowed = false; + $this->currentPubkey = null; + $this->currentPleb = null; + }, ]); ?> @volt -
+