teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

htmlをformatterにてインデックス揃えました

2021/08/15 10:43

投稿

yoshidesu
yoshidesu

スコア4

title CHANGED
File without changes
body CHANGED
@@ -287,6 +287,7 @@
287
287
  <% end %>
288
288
  </div>
289
289
  </div>
290
+
290
291
  ```
291
292
  posts/show.html.erb
292
293
 
@@ -325,6 +326,8 @@
325
326
 
326
327
  </div>
327
328
  </div>
329
+
330
+
328
331
  ```
329
332
 
330
333
 

1

htmlの追加

2021/08/15 10:43

投稿

yoshidesu
yoshidesu

スコア4

title CHANGED
File without changes
body CHANGED
@@ -255,8 +255,80 @@
255
255
 
256
256
  ```
257
257
 
258
+ users/show.html.erb
259
+ ```
260
+ <div class ="main user-show">
261
+ <div class= "container">
262
+ <div class= "user">
263
+ <%= image_tag "/#{@user.image_name}" %>
264
+ <h2><%= @user.name %></h2>
265
+ <p><%= @user.email %></p>
266
+ <% if @user.id == @current_user.id %>
267
+ <%= link_to("磨き", "/users/#{@user.id}/edit") %>
268
+ <% end %>
269
+ </div>
258
270
 
271
+ <ul class="user-tabs">
272
+ <li class= "active"><%= link_to("応援投稿","/users/#{@user.id}") %></li>
273
+ <li><%= link_to("それって、最高(いいね)", "/users/#{@user.id}/likes") %></li>
274
+ </ul>
259
275
 
276
+ <% @user.posts.each do |post| %>
277
+ <div class= "posts-index-item">
278
+ <div class= "post-left">
279
+ <%= image_tag "/#{post.user.image_name}" %>
280
+ <div class="post-right">
281
+ <div class= "post-user-name">
282
+ <%= link_to(post.user.name, "/users/#{post.user.id}")%>
283
+ </div>
284
+ <%= link_to(post.content, "/posts/#{post.id}") %>
285
+ </div>
286
+ </div>
287
+ <% end %>
288
+ </div>
289
+ </div>
290
+ ```
291
+ posts/show.html.erb
292
+
293
+ ```
294
+ <div class="main posts-show">
295
+ <div class="container">
296
+ <div class="posts-show-item">
297
+ <div class="post-user-name">
298
+ <%= image_tag "/#{@user.image_name}" %>
299
+ <%= link_to(@user.name, "/users/#{@user.id}") %>
300
+ </div>
301
+ <p>
302
+ <%= @post.content %>
303
+ </p>
304
+ <div class="post-time">
305
+ <%= @post.created_at %>
306
+ </div>
307
+ <% if Like.find_by(user_id: @current_user.id, post_id: @post.id) %>
308
+ <%= link_to("/likes/#{@post.id}/destroy",{method: "post"}) do %>
309
+ < span class= "fa fa-heart like-btn-unlike"></span>
310
+ <% end %>
311
+ <else>
312
+ <%= link_to("/likes/#{@post.id}/create",{method: "post"}) do %>
313
+ <span class= "fa fa-heart like-btn"></span>
314
+ <% end %>
315
+ <% end %>
316
+
317
+ <%= @likes_count %>
318
+ <% if @post.user_id == @current_user.id %>
319
+ <div class="post-menus">
320
+ <%= link_to("応援を強化する", "/posts/#{@post.id}/edit") %>
321
+ <%= link_to("応援をやめちゃう", "/posts/#{@post.id}/destroy", {method: "post"}) %>
322
+ </div>
323
+ <% end %>
324
+
325
+
326
+ </div>
327
+ </div>
328
+ ```
329
+
330
+
331
+
260
332
  宜しくお願い致します。
261
333
 
262
334