質問編集履歴
1
エラー文下部のパラメーターとnew.html.erbを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,6 +30,44 @@
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
+
|
34
|
+
|
35
|
+
Request
|
36
|
+
|
37
|
+
Parameters:
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
{"authenticity_token"=>"RWNML9Q12eoFIxKEna58FQnzDVFZDM402ph1KneafH7FHpX8thCt7AucnnmrFxoYmqN7HWwzivAHlcErBDQ9WA==",
|
42
|
+
|
43
|
+
"image"=>
|
44
|
+
|
45
|
+
#<ActionDispatch::Http::UploadedFile:0x00007fe042bce740
|
46
|
+
|
47
|
+
@content_type="image/jpeg",
|
48
|
+
|
49
|
+
@headers="Content-Disposition: form-data; name=\"image\"; filename=\"no_image.jpeg\"\r\n" + "Content-Type: image/jpeg\r\n",
|
50
|
+
|
51
|
+
@original_filename="no_image.jpeg",
|
52
|
+
|
53
|
+
@tempfile=#<File:/var/folders/ff/b5bwglv53152xq7gvm40wtvr0000gp/T/RackMultipart20210912-14159-1iximnq.jpeg>>,
|
54
|
+
|
55
|
+
"title"=>"a",
|
56
|
+
|
57
|
+
"detail"=>"a",
|
58
|
+
|
59
|
+
"category_id"=>"2",
|
60
|
+
|
61
|
+
"director"=>"a",
|
62
|
+
|
63
|
+
"starring"=>"a",
|
64
|
+
|
65
|
+
"rate"=>"",
|
66
|
+
|
67
|
+
"post"=>{"rate"=>"3"},
|
68
|
+
|
69
|
+
"commit"=>"レビューを投稿する"}
|
70
|
+
|
33
71
|
```
|
34
72
|
|
35
73
|
|
@@ -106,6 +144,190 @@
|
|
106
144
|
|
107
145
|
```
|
108
146
|
|
147
|
+
```new
|
148
|
+
|
149
|
+
<div class="review-contents">
|
150
|
+
|
151
|
+
<header class="review-header">
|
152
|
+
|
153
|
+
<%= link_to image_tag('movie-logo.png' , size: '185x50'), "/" %>
|
154
|
+
|
155
|
+
</header>
|
156
|
+
|
157
|
+
<div class="review-main">
|
158
|
+
|
159
|
+
<h2 class="review-title">映画の情報を入力</h2>
|
160
|
+
|
161
|
+
<%= form_with(model: @review, local: true ) do |f| %>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<%# 映画画像 %>
|
166
|
+
|
167
|
+
<div class="img-upload">
|
168
|
+
|
169
|
+
<div class="weight-bold-text">
|
170
|
+
|
171
|
+
映画画像
|
172
|
+
|
173
|
+
<span class="indispensable">必須</span>
|
174
|
+
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="click-upload">
|
178
|
+
|
179
|
+
<p>
|
180
|
+
|
181
|
+
クリックしてファイルをアップロード
|
182
|
+
|
183
|
+
</p>
|
184
|
+
|
185
|
+
<%= f.file_field :image, id:"review-image" %>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<%# /映画画像 %>
|
194
|
+
|
195
|
+
<%# 映画名と説明 %>
|
196
|
+
|
197
|
+
<div class="new-review">
|
198
|
+
|
199
|
+
<div class="weight-bold-text">
|
200
|
+
|
201
|
+
映画タイトル
|
202
|
+
|
203
|
+
<span class="indispensable">必須</span>
|
204
|
+
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<%= f.text_area :title, class:"review-text", id:"review-name", placeholder:"映画タイトル(必須 40文字まで)", maxlength:"40" %>
|
208
|
+
|
209
|
+
<div class="review-explain">
|
210
|
+
|
211
|
+
<div class="weight-bold-text">
|
212
|
+
|
213
|
+
映画の評価
|
214
|
+
|
215
|
+
<span class="indispensable">必須</span>
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<%= f.text_area :detail, class:"review-text", id:"item-info", placeholder:"映画の評価(必須 1,000文字まで)(映画内容、演出、良かった点、悪かった点など)" ,rows:"7" ,maxlength:"1000" %>
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<%# /映画名と映画説明 %>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<%# 映画の詳細 %>
|
230
|
+
|
231
|
+
<div class="review-detail">
|
232
|
+
|
233
|
+
<div class="weight-bold-text">映画の詳細</div>
|
234
|
+
|
235
|
+
<div class="form">
|
236
|
+
|
237
|
+
<div class="weight-bold-text">
|
238
|
+
|
239
|
+
映画のジャンル
|
240
|
+
|
241
|
+
<span class="indispensable">必須</span>
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<%= f.collection_select(:category_id, Category.all, :id, :name, {}, {class:"select-box", id:"item_category"}) %>
|
246
|
+
|
247
|
+
<div class="weight-bold-text">
|
248
|
+
|
249
|
+
監督名
|
250
|
+
|
251
|
+
<span class="indispensable">必須</span>
|
252
|
+
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<%= f.text_area :director, class:"review-text", id:"review-name", placeholder:"監督名", maxlength:"40" %>
|
256
|
+
|
257
|
+
<div class="weight-bold-text">
|
258
|
+
|
259
|
+
主演俳優、主演女優
|
260
|
+
|
261
|
+
<span class="indispensable">必須</span>
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<%= f.text_area :starring, class:"review-text", id:"review-name", placeholder:"主演俳優、主演女優", maxlength:"40" %>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<div class="field" id="star">
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<%= f.label :rate, "星評価:" %>
|
274
|
+
|
275
|
+
<%= f.hidden_field :rate, id: :review_star %>
|
276
|
+
|
277
|
+
<script>
|
278
|
+
|
279
|
+
$('#star').raty({
|
280
|
+
|
281
|
+
size : 36,
|
282
|
+
|
283
|
+
starOff: '<%= asset_path('star-off.png') %>',
|
284
|
+
|
285
|
+
starOn : '<%= asset_path('star-on.png') %>',
|
286
|
+
|
287
|
+
starHalf: '<%= asset_path('star-half.png') %>',
|
288
|
+
|
289
|
+
scoreName: 'post[rate]', <%# rateカラムへの保存 %>
|
290
|
+
|
291
|
+
half: true, <%# 星半分の入力 %>
|
292
|
+
|
293
|
+
});
|
294
|
+
|
295
|
+
</script>
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<%# /商品の詳細 %>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
<%# 下部ボタン %>
|
310
|
+
|
311
|
+
<div class="review-contents">
|
312
|
+
|
313
|
+
<%= f.submit "レビューを投稿する", class:"review-btn" %>
|
314
|
+
|
315
|
+
<%=link_to 'もどる', root_path, class:"back-btn" %>
|
316
|
+
|
317
|
+
</div>
|
318
|
+
|
319
|
+
<%# /下部ボタン %>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<% end %>
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
```
|
330
|
+
|
109
331
|
|
110
332
|
|
111
333
|
### 試したこと
|