mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
voting added
This commit is contained in:
@@ -38,6 +38,7 @@ class ProjectProposalVoting extends Component
|
|||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
|
$this->projectProposal->load('votes');
|
||||||
$vote = Vote::query()
|
$vote = Vote::query()
|
||||||
->where('user_id', auth()->id())
|
->where('user_id', auth()->id())
|
||||||
->where('project_proposal_id', $this->projectProposal->id)
|
->where('project_proposal_id', $this->projectProposal->id)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Spatie\Image\Manipulations;
|
use Spatie\Image\Manipulations;
|
||||||
use Spatie\MediaLibrary\HasMedia;
|
use Spatie\MediaLibrary\HasMedia;
|
||||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||||
@@ -64,4 +65,9 @@ class ProjectProposal extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function votes(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Vote::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -816,6 +816,7 @@
|
|||||||
"Other voters": "Alle anderen",
|
"Other voters": "Alle anderen",
|
||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "Übermittelt von",
|
"Submitted by": "Übermittelt von",
|
||||||
"This project requires": "Dieses Projekt benötigt/beantragt",
|
"This project requires": "Dieses Projekt benötigt\/beantragt",
|
||||||
"sats": "sats"
|
"sats": "sats",
|
||||||
|
"Your vote": "Deine Stimme"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -814,5 +814,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -814,5 +814,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -815,5 +815,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -815,5 +815,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -815,5 +815,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -815,5 +815,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -815,5 +815,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -815,5 +815,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -777,5 +777,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -789,5 +789,6 @@
|
|||||||
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
"Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.": "",
|
||||||
"Submitted by": "",
|
"Submitted by": "",
|
||||||
"This project requires": "",
|
"This project requires": "",
|
||||||
"sats": ""
|
"sats": "",
|
||||||
|
"Your vote": ""
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,21 @@
|
|||||||
<x-button lg primary wire:click="no">
|
<x-button lg primary wire:click="no">
|
||||||
No, don't support it!
|
No, don't support it!
|
||||||
</x-button>
|
</x-button>
|
||||||
|
<div>
|
||||||
|
<span class="text-amber-500">{{ __('Your vote') }}:</span>
|
||||||
|
@php
|
||||||
|
$myVote = $projectProposal->votes->where('user_id', auth()->id())->first();
|
||||||
|
@endphp
|
||||||
|
@if($myVote && $myVote->value)
|
||||||
|
<x-badge green>{{ __('Yes') }}</x-badge>
|
||||||
|
@endif
|
||||||
|
@if($myVote && !$myVote->value)
|
||||||
|
<x-badge red>{{ __('No') }}</x-badge>
|
||||||
|
@endif
|
||||||
|
@if(!$myVote)
|
||||||
|
<x-badge>{{ __('not voted yet') }}</x-badge>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user