質問編集履歴
2
タイトルの修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
view helperで指定したクラスがうまく反映されません。
|
test
CHANGED
File without changes
|
1
ソース追加、タグの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -89,3 +89,105 @@
|
|
89
89
|
}
|
90
90
|
|
91
91
|
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
```ここに言語を入力
|
96
|
+
|
97
|
+
<h3>Comments</h3>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<p>test</p>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<p class="comment_footer">
|
106
|
+
|
107
|
+
<a href="/entries/10/comments/11/edit">Edit</a> |
|
108
|
+
|
109
|
+
<a data-confirm="Are you sure to delete this comment?" rel="nofollow" data-method="delete" href="/entries/10/comments/11">Delete</a> |
|
110
|
+
|
111
|
+
by <a href="/users/1/comments">Testuser</a> |
|
112
|
+
|
113
|
+
2017/08/18 09:14 |
|
114
|
+
|
115
|
+
<a href="/entries/10/comments/new.11?parent_id=11">Reply</a>
|
116
|
+
|
117
|
+
</p>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div class="nested_comments"></div><p>test2</p>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<p class="comment_footer">
|
126
|
+
|
127
|
+
<a href="/entries/10/comments/12/edit">Edit</a> |
|
128
|
+
|
129
|
+
<a data-confirm="Are you sure to delete this comment?" rel="nofollow" data-method="delete" href="/entries/10/comments/12">Delete</a> |
|
130
|
+
|
131
|
+
by <a href="/users/1/comments">Testuser</a> |
|
132
|
+
|
133
|
+
2017/08/18 10:25 |
|
134
|
+
|
135
|
+
<a href="/entries/10/comments/new.12?parent_id=12">Reply</a>
|
136
|
+
|
137
|
+
</p>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<div class="nested_comments"></div><p>test3</p>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<p class="comment_footer">
|
146
|
+
|
147
|
+
<a href="/entries/10/comments/13/edit">Edit</a> |
|
148
|
+
|
149
|
+
<a data-confirm="Are you sure to delete this comment?" rel="nofollow" data-method="delete" href="/entries/10/comments/13">Delete</a> |
|
150
|
+
|
151
|
+
by <a href="/users/1/comments">Testuser</a> |
|
152
|
+
|
153
|
+
2017/08/18 22:44 |
|
154
|
+
|
155
|
+
<a href="/entries/10/comments/new.13?parent_id=13">Reply</a>
|
156
|
+
|
157
|
+
</p>
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
```ここに言語を入力
|
164
|
+
|
165
|
+
module CommentsHelper
|
166
|
+
|
167
|
+
def nested_comments(comments)
|
168
|
+
|
169
|
+
comments.map do |comment, sub_comments|
|
170
|
+
|
171
|
+
render(comment) + content_tag(:div, nested_comments(sub_comments), :class => "nested_comments")
|
172
|
+
|
173
|
+
end.join.html_safe
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
```
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
```ここに言語を入力
|
184
|
+
|
185
|
+
<%= nested_comments @comments.arrange(:order => :created_at) %>
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
ソース確認したところコメントに対するリプライが<div class="nested_comments"></div>
|
192
|
+
|
193
|
+
囲まれていないのことがわかったので、view helperなどを変えてみたのですがダメでした。
|