summaryrefslogtreecommitdiff
path: root/resources/views/list.blade.php
blob: 82d53e576131f854617fac12f8f944837510c155 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@extends('layouts.app')

@section('styles')
@if ( 0 != $count )
html {
	height: inherit;
}
.hn {
  display: inline-block;
  font-size: inherit;
  height: 1em;
  overflow: visible;
  vertical-align: -.125em;
  fill: #ff6600;
}
@endif
@endsection

@section('content')
	<div class="container">

	<div style="margin-top: 20px"></div>
	<div class="card">
	@if ( "search" == Request::route()->getName() )
		<h1 class="card-header">
			Search for <strong>"{{ Request::input("q") }}"</strong>
			@if ( "1" != $articles->currentPage() )
				(Page {{ $articles->currentPage() }})
			@endif
		</h1>
		<div class="card-body">
			<p class="card-text">
				You searched for <strong>"{{ Request::input("q") }}"</strong>. We found {{ $count }} matches.
			</p>
			@include("search")
		</div>
	@elseif ( "topic" == Request::route()->getName() )
		<h1 class="card-header">
			Topic: <strong>{{ Request::route()->parameters()["topic"] }}</strong>
			@if ( "1" != $articles->currentPage() )
				(Page {{ $articles->currentPage() }})
			@endif
		</h1>
		<div class="card-body">
			<p class="card-text">
				You are looking at all articles with the topic <strong>"{{ Request::route()->parameters()["topic"] }}"</strong>. We found {{ $count }} matches.
			</p>
		</div>
	@elseif ( "random" ==  Request::route()->getName() )
		<h1 class="card-header">
			{{ ucwords(Request::route()->getName()) }} Articles
			@if ( "1" != $articles->currentPage() )
				(Page {{ $articles->currentPage() }})
			@endif
		</h1>
		<div class="card-body">
			<p class="card-text">
				Have a deep view into what people are curious about.
			</p>
		</div>
	@else
		<h1 class="card-header">
			Most {{ ucwords(Request::route()->getName()) }} Articles
			@if ( "1" != $articles->currentPage() )
				(Page {{ $articles->currentPage() }})
			@endif
		</h1>
		
	@endif
	</div>
	<div style="margin-bottom: 20px"></div>

	@foreach( $articles->all() as $article)
		<div class="card">
				<h1 class="card-header">
					<a style="color:inherit;" href="{{ $article->url }}" title="{{ $article->title }}">
						{{ $article->title }}
					</a>
				</h1>
			<div class="card-body">
				@if ( ! is_null($article->getCategories()) )
					@foreach ( $article->getCategories()->get() as $cat )
						<a class="badge badge-pill badge-primary" href="/topic/{{ $cat->name }}">
						{{ $cat->name }}
						</a>
					@endforeach
				@endif
				<p class="card-text">
				{!! $article->excerpt_html !!}
				</p>
				

				@if ( 0 != $article->comments )
				<div class="row">
					<div class="col">
						<h3 class="card-subtitle">Discussed on</h3>
						<ul class="list-unstyled">
						@foreach ( $article->where('id', $article->article_id)->first()->getDiscussions()->orderBy('comments', 'desc')->get() as $discussion )
						@if ( 0 != $discussion->comments )
							<li>
							<a class="card-links" href="{{ $discussion->source_url }}">
								@if ( "HN" == $discussion->source )
								{!! file_get_contents(public_path() . "/img/y-combinator.svg") !!}
								@endif
								 "{{ $discussion->title }}"
							</a>
							| {{ \App\Libraries\Helper::formatTimestamp($discussion->posted_on) }} | 
							<span class="badge badge-pill badge-secondary">{{ $discussion->upvotes }} Upvotes</span>
							<span class="badge badge-pill badge-secondary">{{ $discussion->comments }} Comments </span>
							</li>
						@endif
						@endforeach
						</ul>
					</div>
				</div>
				@endif
			</div>
		</div>

		<div style="margin-bottom: 20px"></div>
	@endforeach

	{{ $articles->links() }}

	</div>
@endsection