Skip to content

Commit

Permalink
Change in home page view
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael McMullen committed Apr 27, 2016
1 parent c20891e commit 231325a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct()
public function index()
{
// grab the latest posts
$posts = Post::where('published', true)->orderBy('published_at', 'desc')->take(5)->get();
$posts = Post::where('published', true)->orderBy('published_at', 'desc')->take(2)->get();

return view('home.index', [
'posts' => $posts
Expand Down
5 changes: 5 additions & 0 deletions public/assets/css/freelancer.css
Original file line number Diff line number Diff line change
Expand Up @@ -499,4 +499,9 @@ section.no-padding{
display: block;
padding-top: 16px;
font-size: 20px;
}

.alert-custom {
background: #2c3e50;
color: #fff;
}
70 changes: 52 additions & 18 deletions resources/views/home/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,65 @@
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Recent Blog Posts</h2>
<h2>Most Recent Post</h2>
<hr class="star-primary">
</div>
</div>

@foreach($posts as $post)
<div style="border-bottom: 1px solid #f1f1f1;">
<header class="blog-post">
<div class="row">
<div class="col-sm-12 padding-bottom-20">
<h4>
<a href="{{ URL::route('blog.view', $post->slug) }}">
{{ $post->title }}
</a>
<small>{{ date('F d, Y g:i A', strtotime($post->published_at)) }} ({{ $post->published_at->diffForHumans() }})</small>
</h4>
{!! str_limit(strip_tags($post->content, '<br>'), 300) !!}
<div>
<a href="{{ URL::route('blog.view', $post->slug) }}" class="read-more">
read more <i class="fa fa-arrow-circle-o-right"></i>
</a>
<div class="col-lg-12">
<h3>
{{ $post->title }}
</h3>

<h6>
Posted {{ date('F d, Y g:i A', strtotime($post->published_at)) }} ({{ $post->published_at->diffForHumans() }})
</h6>

<div class="blog-content">
{!! $post->content !!}
</div>

<div class="blog-share">
<h5>
Share:
</h5>
<span class="share-list">
<a href="http://www.facebook.com/sharer.php?u={{ Request::url() }}"><img src="{{ asset('assets/images/facebook-share.png') }}"></a>
</span>
<span class="share-list">
<a href="http://twitter.com/share?url={{ Request::url() }}"><img src="{{ asset('assets/images/twitter-share.png') }}"></a>
</span>
</div>
</div>

<div class="blog-tags">
<h5>
Tags:
</h5>
@if($post->categories->count() > 0)
@foreach($post->categories as $idx => $category)
{{ $category->name }} @if($idx != (count($post->categories) - 1 )) | @endif
@endforeach
@else
<div class="alert alert-custom">
<h4>Sorry</h4>
There are no tags for this post
</div>
@endif
</div>

@if(env('DISQUS_ENABLED', false))
<div>
<a href="{{ route('blog.view', $post->slug) }}" class="btn btn-primary"><i class="fa fa-comments"></i> Add Comment</a>
</div>
@endif

</div>
</div>
@endforeach
</header>
@endforeach

</div>
</section>
Expand All @@ -41,14 +75,14 @@
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Want to see more entries?</h2>
<h2>There is tons more to read</h2>
<hr class="star-primary">
</div>
</div>
<div class="row">
<div class="col-lg-12 text-center">
<p>
<a href="{{ URL::route('blog.listing') }}">View All Blog Posts</a>
<a href="{{ URL::route('blog.listing') }}">Check out more entries</a>
</p>
</div>
</div>
Expand Down

0 comments on commit 231325a

Please sign in to comment.