Dynamic position rendering for homepage

This commit is contained in:
Miguel Nogueira 2020-05-08 01:45:29 +01:00
parent a4e415943a
commit 49c1ed4698
4 changed files with 56 additions and 68 deletions

View File

@ -3,9 +3,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class DashboardController extends Controller class DashboardController extends Controller
{ {

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Vacancy;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class HomeController extends Controller class HomeController extends Controller
@ -13,6 +14,7 @@ class HomeController extends Controller
*/ */
public function index() public function index()
{ {
return view('home'); return view('home')
->with('positions', Vacancy::where('vacancyStatus', 'OPEN')->get());
} }
} }

View File

@ -174,7 +174,7 @@
<td>{{$vacancy->id}}</td> <td>{{$vacancy->id}}</td>
<td>{{$vacancy->vacancyName}}</td> <td>{{$vacancy->vacancyName}}</td>
<td>{{$vacancy->vacancyDescription}}</td> <td>{{substr($vacancy->vacancyDescription, 0, 20)}}...</td>
<td><span class="badge badge-success">{{$vacancy->discordRoleID}}</span></td> <td><span class="badge badge-success">{{$vacancy->discordRoleID}}</span></td>
<td><span class="badge badge-success">{{$vacancy->permissionGroupName}}</span></td> <td><span class="badge badge-success">{{$vacancy->permissionGroupName}}</span></td>
<td>{{$vacancy->vacancyCount}}</td> <td>{{$vacancy->vacancyCount}}</td>

View File

@ -19,13 +19,17 @@
<div class="row mt-5 mb-5"> <div class="row mt-5 mb-5">
<div class="col"> @if (!$positions->isEmpty())
@foreach($positions as $position)
<div class="col-md-4">
<div class="card"> <div class="card">
<div class="card-header text-center"> <div class="card-header text-center">
<h4 class="card-title">Helper</h4> <h4 class="card-title">{{$position->vacancyName}}</h4>
@ -34,7 +38,7 @@
<div class="card-body text-center"> <div class="card-body text-center">
<p class="card-text"> <p class="card-text">
Helpers are the basic building block of every network. They help keep things clean and organised, and report to Chat Moderators. {{$position->vacancyDescription}}
</p> </p>
</div> </div>
@ -50,24 +54,30 @@
</div> </div>
<div class="col"> @endforeach
@else
<div class="col-md-4 offset-md-4">
<div class="card"> <div class="card">
<div class="card-header text-center"> <div class="card-header">
<h3 class="card-title">Moderator</h3>
</div>
<div class="card-body text-center"> <div class="card-title"><h4>Applications Closed</h4></div>
<p class="card-text">Moderators keep the network clean from cheaters, spam accounts, and abusive users. Their tasks include monitoring the anti-cheat logs, responding to reports and helping users.</p>
</div> </div>
<div class="card-footer text-center"> <div class="card-body">
<button type="button" class="btn btn-success">Apply</button> <div class="alert alert-info">
<button type="button" class="btn btn-info">Learn More</button>
<p><b>Hello there!</b></p>
<p>
We are currently not hiring any new staff members at the moment. If you'd like to apply, check out our Discord's
announcement channel for news when a new position opens.
Our application cycle usually lasts two weeks, so if you're seeing this, it's because it finished, and new one will begin soon.
</p>
</div> </div>
@ -75,30 +85,9 @@
</div> </div>
<div class="col">
<div class="card">
<div class="card-header text-center">
<h3 class="card-title">Chat Moderator</h3>
</div> </div>
<div class="card-body text-center"> @endif
<p class="card-text">Chat Moderators' primary goal is monitoring the in-game chat, Discord Channels, and engaging with the community, relieving Moderators of this duty.</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-success">Apply</button>
<button type="button" class="btn btn-info">Learn More</button>
</div>
</div>
</div>
</div> </div>