|
5 | 5 | </div> |
6 | 6 | <div class="row"> |
7 | 7 | <div class="col-8"> |
8 | | - <div class="card p-3 mb-3"> |
9 | | - <div class="row"> |
10 | | - <div class="col-1 text-center"> |
11 | | - <div id="vote-actions-1" class="vote" data-id="1"> |
12 | | - <div class="fa fa-arrow-up upvote"></div> |
13 | | - <span class="font-weight-bold score">2</span> |
14 | | - <div class="fa fa-arrow-down downvote"></div> |
| 8 | + <%= for post <- @posts do %> |
| 9 | + <div class="card p-3 mb-3"> |
| 10 | + <div class="row"> |
| 11 | + <div class="col-1 text-center"> |
| 12 | + <div class="vote"> |
| 13 | + <%= if Pow.Plug.current_user(@conn) do %> |
| 14 | + <%= live_render(@conn, RedditWeb.VotesLive, session: %{"post_id" => post.id, "user_id" => @logged_in_user_id}) %> |
| 15 | + <% else %> |
| 16 | + <%= render RedditWeb.PostView, "votes_live.html", post_count: post.votes_count %> |
| 17 | + <% end %> |
| 18 | + </div> |
15 | 19 | </div> |
16 | | - </div> |
17 | | - <div class="col-11"> |
18 | | - <h4 class="mb-1"> |
19 | | - <a href="/communities/1/posts/1">Webpackets vs Sprockets</a> |
20 | | - </h4> |
21 | | - <p> |
22 | | - <small |
23 | | - ><a href="/communities/1">Ruby on Rails Community</a> Posted by |
24 | | - <a href="/u/davidb">David Battersby</a> about 2 months ago.</small |
25 | | - > |
26 | | - </p> |
27 | | - <p> |
28 | | - Watch my video on adding Sprockets to a Rails 6 app. This can be |
29 | | - helpful if you are upgrading an older app and want to work with the |
30 | | - existing asset pipeline. https://www.youtube.com/watch?v=S-1x... |
31 | | - </p> |
32 | | - </div> |
33 | | - </div> |
34 | | - </div> |
35 | | - <div class="card p-3 mb-3"> |
36 | | - <div class="row"> |
37 | | - <div class="col-1 text-center"> |
38 | | - <div id="vote-actions-2" class="vote" data-id="2"> |
39 | | - <div class="fa fa-arrow-up upvote"></div> |
40 | | - <span class="font-weight-bold score">0</span> |
41 | | - <div class="fa fa-arrow-down downvote"></div> |
| 20 | + <div class="col-11"> |
| 21 | + <h4 class="mb-1"> |
| 22 | + <%= link post.title, to: Routes.post_path(@conn, :show, post.community.name, post.id) %> |
| 23 | + </h4> |
| 24 | + <p> |
| 25 | + <small> |
| 26 | + <%= link post.community.name, to: Routes.community_path(@conn, :show, post.community.name) %> Posted by |
| 27 | + <%= link post.user.full_name, to: Routes.user_path(@conn, :profile, post.user.username) %> <%= Timex.from_now(post.inserted_at) %> |
| 28 | + </small> |
| 29 | + </p> |
| 30 | + <p> |
| 31 | + <%= post.body %> |
| 32 | + </p> |
42 | 33 | </div> |
43 | 34 | </div> |
44 | | - <div class="col-11"> |
45 | | - <h4 class="mb-1"> |
46 | | - <a href="/communities/3/posts/2">Hi, I'm John</a> |
47 | | - </h4> |
48 | | - <p> |
49 | | - <small |
50 | | - ><a href="/communities/3">Introduce Yourself</a> Posted by |
51 | | - <a href="/u/johnsmith">John Smith</a> about 2 months ago.</small |
52 | | - > |
53 | | - </p> |
54 | | - <p> |
55 | | - Nice to meet you all. Thanks for letting me join this community! |
56 | | - </p> |
57 | | - </div> |
58 | 35 | </div> |
59 | | - </div> |
| 36 | + <% end %> |
60 | 37 | </div> |
61 | 38 | <div class="col-4"> |
62 | 39 | <p class="h5 mb-4">Up and coming Communities</p> |
|
0 commit comments