質問編集履歴
1
ビューのコードを追加した。
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,3 +9,91 @@
|
|
9
9
|
↓
|
10
10
|
|
11
11
|
[#<Comment id: 2, user_id: 1, tweet_id: 8, text: "いいね", created_at: "2020-06-13 00:32:54", updated_at: "2020-06-13 00:32:54">, #<Comment id: 4, user_id: 1, tweet_id: 8, text: "あああ", created_at: "2020-06-13 00:47:31", updated_at: "2020-06-13 00:47:31">]
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
ビューコード
|
16
|
+
|
17
|
+
<div class="contents row" >
|
18
|
+
|
19
|
+
<div class="content_post">
|
20
|
+
|
21
|
+
<div class="more">
|
22
|
+
|
23
|
+
<span><%= image_tag 'arrow_top.png' %></span>
|
24
|
+
|
25
|
+
<ul class="more_list">
|
26
|
+
|
27
|
+
<% if @tweet.user == current_user %>
|
28
|
+
|
29
|
+
<li>
|
30
|
+
|
31
|
+
<%= link_to '削除', "/tweets/#{@tweet.id}", method: :delete %>
|
32
|
+
|
33
|
+
</li>
|
34
|
+
|
35
|
+
<li>
|
36
|
+
|
37
|
+
<%= link_to '編集', "/tweets/#{@tweet.id}/edit", method: :get %>
|
38
|
+
|
39
|
+
</li>
|
40
|
+
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
</ul>
|
44
|
+
|
45
|
+
<%= simple_format(@tweet.text) %>
|
46
|
+
|
47
|
+
<span class="name">
|
48
|
+
|
49
|
+
<a href="/users/<%= @tweet.user.id %>">
|
50
|
+
|
51
|
+
<span>投稿者</span><%= @tweet.user.nickname %>
|
52
|
+
|
53
|
+
</a>
|
54
|
+
|
55
|
+
</span>
|
56
|
+
|
57
|
+
</div>
|
58
|
+
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div class="container">
|
62
|
+
|
63
|
+
<% if current_user %>
|
64
|
+
|
65
|
+
<%= form_tag("/tweets/#{@tweet.id}/comments", method: :post) do %>
|
66
|
+
|
67
|
+
<textarea name="text" placeholder="コメントする" rows="2" cols="30"></textarea>
|
68
|
+
|
69
|
+
<input type="submit" value="投稿する。">
|
70
|
+
|
71
|
+
<% end %>
|
72
|
+
|
73
|
+
<% end %>
|
74
|
+
|
75
|
+
<div class="comments">
|
76
|
+
|
77
|
+
<h4>コメント一覧</h4>
|
78
|
+
|
79
|
+
<% if @comments %>
|
80
|
+
|
81
|
+
<%= @comments.each do |comment| %>
|
82
|
+
|
83
|
+
<p>
|
84
|
+
|
85
|
+
<strong><%= link_to comment.user.nickname, "/users/#{comment.user_id}" %>:</strong>
|
86
|
+
|
87
|
+
<%= comment.text %>
|
88
|
+
|
89
|
+
</p>
|
90
|
+
|
91
|
+
<% end %>
|
92
|
+
|
93
|
+
<% end %>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|