質問編集履歴

1

追記

2020/04/16 05:20

投稿

yastinbieber
yastinbieber

スコア49

test CHANGED
File without changes
test CHANGED
@@ -75,3 +75,167 @@
75
75
 
76
76
 
77
77
  どなたかuserテーブルにおける@productを挿入する方法をお教えいただけますと幸いです。
78
+
79
+
80
+
81
+ ■追記
82
+
83
+ ```
84
+
85
+ ##users_show.html.erb
86
+
87
+
88
+
89
+ <div class="contents-box">
90
+
91
+ <div class="container-left">
92
+
93
+ <div class="container-left-register">
94
+
95
+ <h3>プロフィール</h3>
96
+
97
+ </div>
98
+
99
+ <div class="container-search-result">
100
+
101
+ <div class="container-search-result-box-pf">
102
+
103
+ <div class="container-search-result-box-left">
104
+
105
+ <% if @user.image.attached? %>
106
+
107
+ <%= image_tag @user.image %>
108
+
109
+ <% end %>
110
+
111
+ </div>
112
+
113
+ <div class="container-search-result-box-right">
114
+
115
+ <h2>@<%= @nickname %>
116
+
117
+ <% if current_user.id == @user.id %>
118
+
119
+ <%= link_to "プロフィール編集", edit_user_path(current_user), {:class => "btn3" } %>
120
+
121
+ <% end %>
122
+
123
+ </h2>
124
+
125
+ <p><%= simple_format(@user.selfintroduction) %></p>
126
+
127
+ </div>
128
+
129
+ </div>
130
+
131
+ </div>
132
+
133
+ <div class="container-left-register">
134
+
135
+ <h3>レビュー</h3>
136
+
137
+ </div>
138
+
139
+ <% @users.each do |review| %>
140
+
141
+ <div class="review-detail">
142
+
143
+ <div class="review-detail-item">
144
+
145
+ <div class="username">
146
+
147
+ <p class="text-small">
148
+
149
+ <% if review.comments.present? %>
150
+
151
+ <span>レビューに対しての平均評価:</span>
152
+
153
+ <span class="rating-star">
154
+
155
+ <i class="star-actived rate-<%= review.comments.average(:rate).round %>0"></i>
156
+
157
+ </span>
158
+
159
+ <% else %>
160
+
161
+ <span>レビューに対しての平均評価:</span>
162
+
163
+ <span class="rating-star">
164
+
165
+ <i class="star-actived rate-0"></i>
166
+
167
+ </span>
168
+
169
+ <% end %>
170
+
171
+ </p>
172
+
173
+ </div>
174
+
175
+ <div class="write-review">
176
+
177
+ <h3><span class="product-btn">title:booknameを入れたい</span></h3><!--titleを入れたい-->
178
+
179
+ </div>
180
+
181
+ <div class="review-1">
182
+
183
+ <br><p><%= truncate(review.review, length: 10) do %></p>
184
+
185
+ <% end %>
186
+
187
+ </div>
188
+
189
+ </div>
190
+
191
+ <%= link_to 'レビュー詳細', "", method: :get, class: "right-btn-review-detail" %> <!--routingがわからない-->
192
+
193
+ </div>
194
+
195
+ <% end %>
196
+
197
+ <div class="JIP">
198
+
199
+ <%= paginate(@users) %>
200
+
201
+ </div>
202
+
203
+ </div>
204
+
205
+ <div class="container-right">
206
+
207
+ <%= form_tag('/products/search', method: :get) do %>
208
+
209
+ <input id="sbox" name="keyword" type="text" placeholder="キーワードを入力" />
210
+
211
+ <input id="sbtn" type="submit" value="検索" >
212
+
213
+ <% end %>
214
+
215
+ <form accept-charset="utf-8" action="/" class="js-search-submit" method="get">
216
+
217
+ </form>
218
+
219
+ <br>
220
+
221
+ <%= link_to "書籍を検索する", "/products/search", class: "right-btn" %>
222
+
223
+ <%= link_to "書籍を登録する", "/products/new", class: "right-btn" %>
224
+
225
+ <% if user_signed_in? %>
226
+
227
+ <%= link_to "マイページ", user_path(current_user), class: "right-btn" %>
228
+
229
+ <% end %>
230
+
231
+ <% if current_user.id == @user.id %>
232
+
233
+ <%= link_to "プロフィール編集", edit_user_path(current_user), class: "right-btn" %>
234
+
235
+ <% end %>
236
+
237
+ </div>
238
+
239
+ </div>
240
+
241
+ ```