|
8 | 8 | <!-- Bootstrap CSS -->
|
9 | 9 | <link href=" https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel=" stylesheet" integrity=" sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin=" anonymous" >
|
10 | 10 |
|
11 |
| - </head> |
12 |
| - <body> |
| 11 | +</head> |
| 12 | +<body> |
13 | 13 |
|
14 |
| - <nav class="navbar navbar-dark bg-primary"> |
15 |
| - <div class="container-fluid"> |
16 |
| - <a class="navbar-brand">Acebook</a> |
17 |
| - <form class="d-flex"> |
18 |
| - <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> |
19 |
| - <button class="btn btn-outline-success" type="submit">Search</button> |
20 |
| - </form> |
21 |
| - </div> |
22 |
| - </nav> |
| 14 | +<nav class="navbar navbar-dark bg-primary"> |
| 15 | + <div class="container-fluid"> |
| 16 | + <a class="navbar-brand">Acebook</a> |
| 17 | + <form class="d-flex"> |
| 18 | + <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> |
| 19 | + <button class="btn btn-outline-success" type="submit">Search</button> |
| 20 | + </form> |
| 21 | + </div> |
| 22 | +</nav> |
23 | 23 |
|
| 24 | + |
24 | 25 | <ul class="nav justify-content-end">
|
25 | 26 | <li class="nav-item">
|
26 | 27 | <a class="nav-link active" aria-current="page" href="#home">Home</a>
|
|
40 | 41 | Write a post
|
41 | 42 | <% end %> </p1>
|
42 | 43 |
|
43 |
| - <div id="home" class="center" |
44 |
| -<div class="mb-3 offset-4" style="text-align: center;"> |
45 |
| - <label for="post" class="form-label"> <h4>Whats on your mind?</h4></label> |
46 |
| - <textarea class="form-control offset-4" id="exampleFormControlTextarea1" rows="4" style="width: 40rem;"></textarea> |
47 |
| - <div class="row"> |
48 |
| - <br> |
| 44 | + |
| 45 | + |
| 46 | +<div class="container"> |
| 47 | +<div class = "row"> |
| 48 | + <div class="center" style="width: 50rem;"> |
| 49 | + <div class="form-control offset-4" style="text-align: center;"> |
| 50 | + <label for="post" class="form-label"> <h4>Whats on your mind?</h4></label> |
| 51 | + <%= form_for @post, html: {class: 'form-control offsetWidth-8'} do |form| %> |
| 52 | + <%= form.label 'message' %> |
| 53 | + <%= form.text_field :message %> |
| 54 | + <%= form.submit "Submit" %> |
| 55 | + <% end %> |
| 56 | + <div class="row"> |
| 57 | + <br> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + |
49 | 62 | </div>
|
50 | 63 | </div>
|
| 64 | + |
| 65 | +<div class="row"> |
| 66 | + <br> |
51 | 67 | </div>
|
52 | 68 |
|
53 | 69 | <% @posts.each do |post| %>
|
|
56 | 72 | <div class="card shadow p-3 mb-5 bg-white rounded" style="width: 100rem;">
|
57 | 73 | <div class="card-body">
|
58 | 74 | <h5 class="card-title">Users name</h5>
|
59 |
| - <h6 class="card-subtitle mb-2 text-muted">26/11/2021</h6> |
| 75 | + <h6 class="card-subtitle mb-2 text-muted"><%= post.created_at %></h6> |
60 | 76 | <p class="card-text"><%= post.message %></p>
|
61 |
| - |
62 |
| - |
63 |
| - |
64 |
| - |
65 | 77 | <%= button_to (post.likes.to_s + ' Likes'), post_path(post.id), :method => :patch %>
|
| 78 | + </div> |
66 | 79 |
|
67 |
| - |
| 80 | + <%= form_for @comment, html: {class: 'form-control offsetWidth-8'} do |form| %> |
| 81 | + <%= form.label 'comment' %> |
| 82 | + <%= form.text_field :comment %> |
| 83 | + <%= hidden_field_tag :post_id, post.id %> |
| 84 | + <%= form.submit "Submit comment" %> |
| 85 | + <% end %> |
68 | 86 |
|
69 |
| - <a href="#" class="card-link">Comment</a> |
| 87 | + <div class="row"> |
| 88 | + <br> |
70 | 89 | </div>
|
71 |
| - </div> |
| 90 | + |
| 91 | + <% @posts_comments.each do |comments| %> |
| 92 | + <% if comments.post_id == post.id %> |
| 93 | + <div class="container"> |
| 94 | + <div class ="row"> |
| 95 | + <div class="card" style="width: 30rem;"> |
| 96 | + <p> User Name </p> |
| 97 | + <%= comments.created_at %> <br> |
| 98 | + <%= comments.comment %> |
| 99 | + <div class="row"> |
| 100 | + <br> |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + </div> |
| 104 | + </div> |
| 105 | + <% end %> |
| 106 | + <div class="row"> |
| 107 | + <br> |
| 108 | + </div> |
| 109 | + <% end %> |
| 110 | + |
72 | 111 | <div class="row">
|
73 | 112 | <br>
|
74 | 113 | </div>
|
| 114 | + </div> |
| 115 | + |
| 116 | + <div class="row"> |
| 117 | + <br> |
| 118 | + </div> |
| 119 | + |
75 | 120 | </div>
|
76 | 121 | </div>
|
77 | 122 | <% end %>
|
78 | 123 |
|
79 |
| - |
80 | 124 | </body>
|
81 | 125 | </html>
|
82 | 126 | </div>
|
83 | 127 |
|
| 128 | + |
0 commit comments