Add pagination to notifications

This commit is contained in:
Daniel Supernault 2018-06-09 17:36:27 -06:00
parent a39f9600b9
commit b63b8353ad
3 changed files with 19 additions and 4 deletions

View file

@ -14,7 +14,7 @@ class Mention extends Model
public function status()
{
return $this->belongsTo(Status::class);
return $this->belongsTo(Status::class, 'status_id', 'id');
}
public function toText()

View file

@ -19,7 +19,7 @@
<span class="text-muted notification-timestamp pl-1">{{$notification->created_at->diffForHumans(null, true, true, true)}}</span>
</span>
<span class="float-right notification-action">
@if($notification->item_id)
@if($notification->item_id && $notification->item_type == 'App\Status')
<a href="{{$notification->status->url()}}"><img src="{{$notification->status->thumb()}}" width="32px" height="32px"></a>
@endif
</span>
@ -70,10 +70,16 @@
<span class="text-muted notification-timestamp pl-1">{{$notification->created_at->diffForHumans(null, true, true, true)}}</span>
</span>
<span class="float-right notification-action">
@if($notification->item_id)
@if($notification->item_id && $notification->item_type === 'App\Status')
@if(is_null($notification->status->in_reply_to_id))
<a href="{{$notification->status->url()}}">
<div class="notification-image" style="background-image: url('{{$notification->status->thumb()}}')"></div>
</a>
@else
<a href="{{$notification->status->parent()->url()}}">
<div class="notification-image" style="background-image: url('{{$notification->status->parent()->thumb()}}')"></div>
</a>
@endif
@endif
</span>
@break
@ -81,12 +87,20 @@
@endswitch
</li>
@endforeach
</ul>
<div class="d-flex justify-content-center my-4">
{{$notifications->links()}}
</div>
@else
<div class="mt-4">
<div class="alert alert-info font-weight-bold">No unread notifications found.</div>
</div>
@endif
</ul>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript" src="{{mix('js/activity.js')}}"></script>
@endpush

1
webpack.mix.js vendored
View file

@ -12,6 +12,7 @@ let mix = require('laravel-mix');
*/
mix.js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/activity.js', 'public/js')
.js('resources/assets/js/timeline.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.version();