Move HumanStatus to Presenter

This commit is contained in:
phecho
2015-12-23 19:44:06 +08:00
parent d5a71976d2
commit 8a47dd873f
6 changed files with 15 additions and 15 deletions

View File

@@ -157,16 +157,6 @@ class Component extends Model implements HasPresenter
return $query->where('enabled', false); return $query->where('enabled', false);
} }
/**
* Looks up the human readable version of the status.
*
* @return string
*/
public function getHumanStatusAttribute()
{
return trans('cachet.components.status.'.$this->status);
}
/** /**
* Returns all of the tags on this component. * Returns all of the tags on this component.
* *

View File

@@ -32,6 +32,16 @@ class ComponentPresenter extends AbstractPresenter
} }
} }
/**
* Looks up the human readable version of the status.
*
* @return string
*/
public function human_status()
{
return trans('cachet.components.status.'.$this->wrappedObject->status);
}
/** /**
* Convert the presenter instance to an array. * Convert the presenter instance to an array.
* *
@@ -42,7 +52,7 @@ class ComponentPresenter extends AbstractPresenter
return array_merge($this->wrappedObject->toArray(), [ return array_merge($this->wrappedObject->toArray(), [
'created_at' => $this->created_at(), 'created_at' => $this->created_at(),
'updated_at' => $this->updated_at(), 'updated_at' => $this->updated_at(),
'status_name' => $this->wrappedObject->humanStatus, 'status_name' => $this->human_status(),
]); ]);
} }
} }

View File

@@ -25,7 +25,7 @@
@if($components->count() > 1) @if($components->count() > 1)
<span class="drag-handle"><i class="ion-drag"></i></span> <span class="drag-handle"><i class="ion-drag"></i></span>
@endif @endif
{{ $component->name }} <small>{{ $component->humanStatus }}</small> {{ $component->name }} <small>{{ $component->human_status }}</small>
</h4> </h4>
@if($component->group) @if($component->group)
<p><small>{{ trans('dashboard.components.listed_group', ['name' => $component->group->name]) }}</small></p> <p><small>{{ trans('dashboard.components.listed_group', ['name' => $component->group->name]) }}</small></p>

View File

@@ -14,7 +14,7 @@
<div class="moment first"> <div class="moment first">
<div class="row event clearfix"> <div class="row event clearfix">
<div class="col-sm-1"> <div class="col-sm-1">
<div class="status-icon status-{{ $incident->status }}" data-toggle="tooltip" title="{{ $incident->humanStatus }}" data-placement="left"> <div class="status-icon status-{{ $incident->status }}" data-toggle="tooltip" title="{{ $incident->human_status }}" data-placement="left">
<i class="{{ $incident->icon }}"></i> <i class="{{ $incident->icon }}"></i>
</div> </div>
</div> </div>

View File

@@ -10,6 +10,6 @@
@endif @endif
<div class="pull-right"> <div class="pull-right">
<small class="text-component-{{ $component->status }} {{ $component->status_color }}">{{ $component->humanStatus }}</small> <small class="text-component-{{ $component->status }} {{ $component->status_color }}">{{ $component->human_status }}</small>
</div> </div>
</li> </li>

View File

@@ -5,7 +5,7 @@
<div class="moment {{ $incidentID === 0 ? 'first' : null }}"> <div class="moment {{ $incidentID === 0 ? 'first' : null }}">
<div class="row event clearfix"> <div class="row event clearfix">
<div class="col-sm-1"> <div class="col-sm-1">
<div class="status-icon status-{{ $incident->status }}" data-toggle="tooltip" title="{{ $incident->humanStatus }}" data-placement="left"> <div class="status-icon status-{{ $incident->status }}" data-toggle="tooltip" title="{{ $incident->human_status }}" data-placement="left">
<i class="{{ $incident->icon }}"></i> <i class="{{ $incident->icon }}"></i>
</div> </div>
</div> </div>