Skip to content

Commit

Permalink
footer and sibebar banner
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Aug 9, 2016
1 parent 5da2bf6 commit d84fc62
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 17 deletions.
36 changes: 25 additions & 11 deletions app/Http/Controllers/RepliesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use App\Models\Reply;
use Flash;
use Auth;
use Redirect;
use Request;

class RepliesController extends Controller implements CreatorListener
{
Expand All @@ -22,7 +24,7 @@ public function store(StoreReplyRequest $request)
'message' => lang('You need to verify the email for commenting.'),
]);
}

return app('Phphub\Creators\ReplyCreator')->create($this, $request->except('_token'));
}

Expand Down Expand Up @@ -59,21 +61,33 @@ public function destroy($id)

public function creatorFailed($errors)
{
return response([
'status' => 500,
'message' => lang('Operation failed.'),
]);
if (Request::ajax()){
return response([
'status' => 500,
'message' => lang('Operation failed.'),
]);
} else {
Flash::error(lang('Operation failed.'));
return Redirect::back();
}

}

public function creatorSucceed($reply)
{
$reply->user->image_url = $reply->user->present()->gravatar;

return response([
'status' => 200,
'message' => lang('Operation succeeded.'),
'reply' => $reply,
'manage_topics' => $reply->user->may('manage_topics') ? 'yes' : 'no',
]);
if (Request::ajax()){
return response([
'status' => 200,
'message' => lang('Operation succeeded.'),
'reply' => $reply,
'manage_topics' => $reply->user->may('manage_topics') ? 'yes' : 'no',
]);
} else {
Flash::success(lang('Operation succeeded.'));
return Redirect::route('topics.show', array(Request::get('topic_id'), '#last-reply'));
}

}
}
6 changes: 6 additions & 0 deletions config/administrator/banners.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
'edit_fields' => [
'position' => [
'title' => '位置',
'type' => 'enum',
'options' => [
'website_top' => '友站',
'footer-sponsor' => '页脚赞助商',
'sidebar-sponsor' => '右边栏赞助商',
],
],
'title' => [
'title' => '标题',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/build/assets/css/styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/rev-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"assets/css/styles.css": "assets/css/styles-2fa8d87574.css",
"assets/css/styles.css": "assets/css/styles-f32e41b3f7.css",
"assets/js/scripts.js": "assets/js/scripts-acec2654e9.js"
}
11 changes: 11 additions & 0 deletions resources/assets/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1770,4 +1770,15 @@ a.users-label-item {
.reply-post-submit .help-inline {
margin-left: 10px;
font-size: 0.9em;
}

.footer-sponsor-link {
margin-bottom: 5px;
display: inline-block;
}

.sidebar-sponsor-link {
line-height: 66px;
margin-bottom: 7px;
display: inline-block;
}
6 changes: 5 additions & 1 deletion resources/views/layouts/partials/footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
<div class="col-sm-3">
<h4>赞助商</h4>
<ul class="list-unstyled">
<a href="http://www.ucloud.cn/?utm_source=zanzhu&utm_campaign=phphub&utm_medium=display&utm_content=yejiao&ytag=phphubyejiao" target="_blank"><img src="https://dn-phphub.qbox.me/uploads/images/201605/03/1/dYfOYswiQY.png" class="popover-with-html" width="98" data-placement="top" data-content="本站服务器由 UCloud 赞助"></a>
@if(isset($banners['footer-sponsor']))
@foreach($banners['footer-sponsor'] as $banner)
<a href="{{ $banner->link }}" target="_blank"><img src="{{ $banner->image_url }}" class="popover-with-html footer-sponsor-link" width="98" data-placement="top" data-content="{{ $banner->title }}"></a>
@endforeach
@endif
</ul>
</div>

Expand Down
10 changes: 7 additions & 3 deletions resources/views/layouts/partials/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@

<div class="panel panel-default corner-radius">
<div class="panel-body text-center" style="padding: 7px; padding-top: 8px;">
<a href="http://www.ucloud.cn/site/seo.html?utm_source=zanzhu&utm_campaign=phphub&utm_medium=display&utm_content=shengji&ytag=phphubshenji" target="_blank" rel="nofollow" title="" style="line-height: 66px;">
<img src="http://ww1.sinaimg.cn/large/6d86d850jw1f2xfmssojsj20dw03cjs5.jpg" width="100%">
</a>
@if(isset($banners['sidebar-sponsor']))
@foreach($banners['sidebar-sponsor'] as $banner)
<a class="sidebar-sponsor-link" href="{{ $banner->link }}" target="_blank">
<img src="{{ $banner->image_url }}" class="popover-with-html footer-sponsor-link" data-content="{{ $banner->title }}" width="100%">
</a>
@endforeach
@endif
</div>
</div>

Expand Down
6 changes: 6 additions & 0 deletions resources/views/topics/partials/replies.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<ul class="list-group row">

@foreach ($replies as $index => $reply)

@if($index+1 == count($replies))
<a name="last-reply" class="anchor" href="#last-reply" aria-hidden="true"></a>
@endif

<li class="list-group-item media"
@if($reply->vote_count >= 2)
style="margin-top: 0px; background-color: #fffce9"
Expand Down Expand Up @@ -49,6 +54,7 @@
<div class="meta">
<a name="reply{{ $topic->present()->replyFloorFromIndex($index) }}" class="anchor" href="#reply{{ $topic->present()->replyFloorFromIndex($index) }}" aria-hidden="true">#{{ $topic->present()->replyFloorFromIndex($index) }}</a>


<span> ⋅ </span>
<abbr class="timeago" title="{{ $reply->created_at }}">{{ $reply->created_at }}</abbr>
</div>
Expand Down

0 comments on commit d84fc62

Please sign in to comment.