Skip to content

Commit

Permalink
回复列表
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Sep 20, 2019
1 parent 90e5cc7 commit 10b4594
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 165 deletions.
11 changes: 11 additions & 0 deletions public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -17104,3 +17104,14 @@ body {
line-height: 38px;
}

/* 回复列表 */

.topic-reply a {
color: inherit;
}

.topic-reply .meta {
font-size: 0.9em;
color: #b3b3b3;
}

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=01f14ce060780bc99e14",
"/css/app.css": "/css/app.css?id=a7473993888feff0b8e5"
"/css/app.css": "/css/app.css?id=4e0ad8f00195f8911365"
}
13 changes: 13 additions & 0 deletions resources/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,16 @@ body {
}
}
}

/* 回复列表 */

.topic-reply {
a {
color: inherit;
}

.meta {
font-size: .9em;
color: #b3b3b3;
}
}
56 changes: 0 additions & 56 deletions resources/views/replies/create_and_edit.blade.php

This file was deleted.

61 changes: 0 additions & 61 deletions resources/views/replies/index.blade.php

This file was deleted.

42 changes: 0 additions & 42 deletions resources/views/replies/show.blade.php

This file was deleted.

Empty file.
36 changes: 36 additions & 0 deletions resources/views/topics/_reply_list.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<ul class="list-unstyled">
@foreach ($replies as $index => $reply)
<li class=" media" name="reply{{ $reply->id }}" id="reply{{ $reply->id }}">
<div class="media-left">
<a href="{{ route('users.show', [$reply->user_id]) }}">
<img class="media-object img-thumbnail mr-3" alt="{{ $reply->user->name }}" src="{{ $reply->user->avatar }}" style="width:48px;height:48px;" />
</a>
</div>

<div class="media-body">
<div class="media-heading mt-0 mb-1 text-secondary">
<a href="{{ route('users.show', [$reply->user_id]) }}" title="{{ $reply->user->name }}">
{{ $reply->user->name }}
</a>
<span class="text-secondary"> • </span>
<span class="meta text-secondary" title="{{ $reply->created_at }}">{{ $reply->created_at->diffForHumans() }}</span>

{{-- 回复删除按钮 --}}
<span class="meta float-right ">
<a title="删除回复">
<i class="far fa-trash-alt"></i>
</a>
</span>
</div>
<div class="reply-content text-secondary">
{!! $reply->content !!}
</div>
</div>
</li>

@if ( ! $loop->last)
<hr>
@endif

@endforeach
</ul>
11 changes: 10 additions & 1 deletion resources/views/topics/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>

<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 topic-content">
<div class="card ">
<div class="card">
<div class="card-body">
<h1 class="text-center mt-3 mb-3">
{{ $topic->title }}
Expand Down Expand Up @@ -63,6 +63,15 @@

</div>
</div>

{{-- 用户回复列表 --}}
<div class="card topic-reply mt-4">
<div class="card-body">
@include('topics._reply_box', ['topic' => $topic])
@include('topics._reply_list', ['replies' => $topic->replies()->with('user')->get()])
</div>
</div>

</div>
</div>
@stop
28 changes: 28 additions & 0 deletions resources/views/users/_replies.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@if (count($replies))

<ul class="list-group mt-4 border-0">
@foreach ($replies as $reply)
<li class="list-group-item pl-2 pr-2 border-right-0 border-left-0 @if($loop->first) border-top-0 @endif">
<a href="{{ $reply->topic->link(['#reply' . $reply->id]) }}">
{{ $reply->topic->title }}
</a>

<div class="reply-content text-secondary mt-2 mb-2">
{!! $reply->content !!}
</div>

<div class="text-secondary" style="font-size:0.9em;">
<i class="far fa-clock"></i> 回复于 {{ $reply->created_at->diffForHumans() }}
</div>
</li>
@endforeach
</ul>

@else
<div class="empty-block">暂无数据 ~_~ </div>
@endif

{{-- 分页 --}}
<div class="mt-4 pt-1">
{!! $replies->appends(Request::except('page'))->render() !!}
</div>
21 changes: 17 additions & 4 deletions resources/views/users/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,29 @@
<hr>

{{-- 用户发布的内容 --}}
<div class="card">
<div class="card ">
<div class="card-body">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active bg-transparent" href="#">Ta 的话题</a></li>
<li class="nav-item"><a class="nav-link" href="#">Ta 的回复</a></li>
<li class="nav-item">
<a class="nav-link bg-transparent {{ active_class(if_query('tab', null)) }}" href="{{ route('users.show', $user->id) }}">
Ta 的话题
</a>
</li>
<li class="nav-item">
<a class="nav-link bg-transparent {{ active_class(if_query('tab', 'replies')) }}" href="{{ route('users.show', [$user->id, 'tab' => 'replies']) }}">
Ta 的回复
</a>
</li>
</ul>
@include('users._topics', ['topics' => $user->topics()->recent()->paginate(5)])
@if (if_query('tab', 'replies'))
@include('users._replies', ['replies' => $user->replies()->with('topic')->recent()->paginate(5)])
@else
@include('users._topics', ['topics' => $user->topics()->recent()->paginate(5)])
@endif
</div>
</div>


</div>
</div>
@stop

0 comments on commit 10b4594

Please sign in to comment.