From 916110c32c38f958e182eb92a0484fc0d670fb13 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 19 Nov 2014 12:02:51 +0000 Subject: [PATCH] Labels are now coloured by their status --- app/models/Incident.php | 12 ++++++++++++ app/views/incident.blade.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/Incident.php b/app/models/Incident.php index f631670b..88a3755f 100644 --- a/app/models/Incident.php +++ b/app/models/Incident.php @@ -9,4 +9,16 @@ case 4: return 'Fixed'; } } + + public function getLabelColorAttribute() { + switch ($this->status) { + case 1: + return 'label-warning'; + case 2: + case 3: + return 'label-info'; + case 4: + return 'label-success'; + } + } } diff --git a/app/views/incident.blade.php b/app/views/incident.blade.php index 864512b5..b1b06864 100644 --- a/app/views/incident.blade.php +++ b/app/views/incident.blade.php @@ -8,7 +8,7 @@

No incidents reported.

@else @foreach($incidents as $incident) -

{{ $incident->name }}, {{ $incident->humanStatus }}

+

{{ $incident->humanStatus }} {{ $incident->name }}

{{ $incident->message }}

@endforeach