Incentive (E1): Teaser und Rangliste zu einer Incentive-Seite zusammengefasst
Eine Seite unter /incentive/{slug}: oben Teilnahme-Block mit Bedingungen
(oder fuer bestaetigte Teilnehmer der Kopf mit Rang, Punkten, Praemie und
Bedingungen zum Aufklappen), darunter Titelbild, Text, Kacheln, "So
funktioniert es", Galerie und das Live-Ranking mit Sprungmarke #ranking.
Die alte URL /incentive/{slug}/ranking leitet dorthin um, Dashboard und
Detailseite verlinken auf die Sprungmarke, show.blade.php entfaellt.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
99370b39aa
commit
a1d890215a
10 changed files with 1010 additions and 1401 deletions
|
|
@ -27,6 +27,10 @@ class IncentiveController extends Controller
|
|||
$this->middleware('active.account');
|
||||
}
|
||||
|
||||
/**
|
||||
* Die eine Incentive-Seite: Teilnahme oder Kopf mit Stand, Titelbild, Text,
|
||||
* Kacheln, "So funktioniert es", Galerie und Live-Rangliste.
|
||||
*/
|
||||
public function teaser($slug)
|
||||
{
|
||||
$incentive = Incentive::where('slug', $slug)
|
||||
|
|
@ -36,28 +40,6 @@ class IncentiveController extends Controller
|
|||
$user = Auth::user();
|
||||
abort_unless($incentive->isVisibleFor($user), 404);
|
||||
|
||||
$participant = IncentiveParticipant::where('incentive_id', $incentive->id)
|
||||
->where('user_id', $user->id)
|
||||
->first();
|
||||
|
||||
$galleryImages = $this->collectGalleryImages($incentive);
|
||||
|
||||
return view('user.incentive.teaser', [
|
||||
'incentive' => $incentive,
|
||||
'participant' => $participant,
|
||||
'galleryImages' => $galleryImages,
|
||||
]);
|
||||
}
|
||||
|
||||
public function show($slug)
|
||||
{
|
||||
$incentive = Incentive::where('slug', $slug)
|
||||
->where('status', '!=', 0) // not draft
|
||||
->firstOrFail();
|
||||
|
||||
$user = Auth::user();
|
||||
abort_unless($incentive->isVisibleFor($user), 404);
|
||||
|
||||
$participant = IncentiveParticipant::where('incentive_id', $incentive->id)
|
||||
->where('user_id', $user->id)
|
||||
->first();
|
||||
|
|
@ -83,10 +65,11 @@ class IncentiveController extends Controller
|
|||
])
|
||||
: collect();
|
||||
|
||||
return view('user.incentive.show', [
|
||||
return view('user.incentive.teaser', [
|
||||
'incentive' => $incentive,
|
||||
'participant' => $participant,
|
||||
'hasConfirmedParticipation' => $participant && $participant->accepted_terms_at !== null,
|
||||
'galleryImages' => $this->collectGalleryImages($incentive),
|
||||
'ranking' => $ranking,
|
||||
'participateHasTrackableAbos' => $participateHasTrackableAbos,
|
||||
'isVipView' => $user->isVIP(),
|
||||
|
|
@ -95,6 +78,14 @@ class IncentiveController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alte Ranglisten-URL: leitet auf die zusammengefasste Seite mit Sprungmarke zur Rangliste.
|
||||
*/
|
||||
public function show($slug)
|
||||
{
|
||||
return redirect(route('user_incentive_teaser', [$slug]).'#ranking');
|
||||
}
|
||||
|
||||
public function participate($slug)
|
||||
{
|
||||
$incentive = Incentive::where('slug', $slug)
|
||||
|
|
@ -107,7 +98,7 @@ class IncentiveController extends Controller
|
|||
if (! Request::has('accept_terms')) {
|
||||
\Session()->flash('alert-error', __('incentive.terms_required'));
|
||||
|
||||
return redirect(route('user_incentive_show', [$slug]));
|
||||
return redirect(route('user_incentive_teaser', [$slug]));
|
||||
}
|
||||
|
||||
$participant = IncentiveParticipant::firstOrCreate(
|
||||
|
|
@ -123,7 +114,7 @@ class IncentiveController extends Controller
|
|||
if ($participant->accepted_terms_at !== null) {
|
||||
\Session()->flash('alert-info', __('incentive.already_participating'));
|
||||
|
||||
return redirect(route('user_incentive_show', [$slug]));
|
||||
return redirect(route('user_incentive_teaser', [$slug]));
|
||||
}
|
||||
|
||||
$participant->accepted_terms_at = Carbon::now();
|
||||
|
|
@ -137,7 +128,7 @@ class IncentiveController extends Controller
|
|||
|
||||
\Session()->flash('alert-success', __('incentive.participation_confirmed'));
|
||||
|
||||
return redirect(route('user_incentive_show', [$slug]));
|
||||
return redirect(route('user_incentive_teaser', [$slug]));
|
||||
}
|
||||
|
||||
public function details($slug)
|
||||
|
|
@ -157,7 +148,7 @@ class IncentiveController extends Controller
|
|||
if ($participant->accepted_terms_at === null) {
|
||||
\Session()->flash('alert-info', __('incentive.details_requires_confirmation'));
|
||||
|
||||
return redirect(route('user_incentive_show', [$slug]));
|
||||
return redirect(route('user_incentive_teaser', [$slug]));
|
||||
}
|
||||
|
||||
$data = AdminIncentiveController::buildParticipantDetailData($participant);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue