質問編集履歴

2

ビュー、コントローラーの追加

2019/04/21 11:44

投稿

morimi714
morimi714

スコア24

test CHANGED
File without changes
test CHANGED
@@ -407,3 +407,45 @@
407
407
  </div>
408
408
 
409
409
  ```
410
+
411
+ application.html.erb ここから編集に飛べるようにしています
412
+
413
+ ```ここに言語を入力
414
+
415
+ <li><a href="/teachers/new">基本情報の編集</a></a></li>
416
+
417
+
418
+
419
+ ```
420
+
421
+ application.controller.rb
422
+
423
+ ```ここに言語を入力
424
+
425
+ class ApplicationController < ActionController::Base
426
+
427
+ # Prevent CSRF attacks by raising an exception.
428
+
429
+ # For APIs, you may want to use :null_session instead.
430
+
431
+ protect_from_forgery with: :exception
432
+
433
+ before_action :configure_permitted_parameters, if: :devise_controller?
434
+
435
+
436
+
437
+ protected
438
+
439
+
440
+
441
+ def configure_permitted_parameters
442
+
443
+ devise_parameter_sanitizer.permit(:teacher, keys: [:img,:firstname,:lastname,:university,:sex,:wage,:trialwage,:prefecture,:region,:trial,:online,:profile,:message])
444
+
445
+ end
446
+
447
+ end
448
+
449
+
450
+
451
+ ```

1

ビューの追記

2019/04/21 11:43

投稿

morimi714
morimi714

スコア24

test CHANGED
File without changes
test CHANGED
@@ -153,3 +153,257 @@
153
153
  ```
154
154
 
155
155
  その他 teacher.rb
156
+
157
+
158
+
159
+ 追記
160
+
161
+ teacher/new.html.erb
162
+
163
+ ```ここに言語を入力
164
+
165
+ <div class="teacher_information">
166
+
167
+ <%= form_for(@teacher) do |f| %>
168
+
169
+ <h4>基本情報の編集</h4>
170
+
171
+ <tr>
172
+
173
+ <td>プロフィール画像の設定</td>
174
+
175
+ <td><%= f.file_field :img %></td>
176
+
177
+ </tr>
178
+
179
+ <tr>
180
+
181
+ <td>イニシャル(名前)</td>
182
+
183
+ <td><%= f.text_field :firstname, maxlength:1 %></td>
184
+
185
+
186
+
187
+ </tr>
188
+
189
+ <tr>
190
+
191
+ <td>イニシャル(名字)</td>
192
+
193
+ <td><%= f.text_field :lastname, maxlength:1 %></td>
194
+
195
+ </tr>
196
+
197
+
198
+
199
+ <tr>
200
+
201
+ <td>性別</td>
202
+
203
+ <%= f.radio_button :sex, "男性" %> <%= f.label :sex, "男性" %>
204
+
205
+ <%= f.radio_button :sex, "女性" %> <%= f.label :sex, "女性" %>
206
+
207
+ </tr>
208
+
209
+
210
+
211
+
212
+
213
+ <tr>
214
+
215
+ <td>大学</td>
216
+
217
+ <td><%= f.text_field :university %></td>
218
+
219
+ </tr>
220
+
221
+
222
+
223
+ <tr>
224
+
225
+ <td>授業料金</td>
226
+
227
+ <td><%= f.number_field :wage %>円/時間</td>
228
+
229
+ <td><%= f.number_field :trialwage %>円/時間(体験授業)</td>
230
+
231
+ </tr>
232
+
233
+
234
+
235
+ <tr>
236
+
237
+ <td>指導可能時間</td>
238
+
239
+ <table>
240
+
241
+ <tr>
242
+
243
+ <td>曜日/時間</td>
244
+
245
+ <td>月曜</td>
246
+
247
+ <td>火曜</td>
248
+
249
+ <td>水曜</td>
250
+
251
+ <td>木曜</td>
252
+
253
+ <td>金曜</td>
254
+
255
+ <td>土曜</td>
256
+
257
+ <td>日曜</td>
258
+
259
+ </tr>
260
+
261
+ <tr>
262
+
263
+ <td>午前中</td>
264
+
265
+ <td><%= check_box 'weeks','monday', {}, true, false %></td>
266
+
267
+ <td><%= check_box 'weeks','tuesday', {}, true, false %></td>
268
+
269
+ <td><%= check_box 'weeks','wednesday', {}, true, false %></td>
270
+
271
+ <td><%= check_box 'weeks','thursday', {}, true, false %></td>
272
+
273
+ <td><%= check_box 'weeks','friday', {}, true, false %></td>
274
+
275
+ <td><%= check_box 'weeks','saturday', {}, true, false %></td>
276
+
277
+ <td><%= check_box 'weeks','sunday', {}, true, false %></td>
278
+
279
+
280
+
281
+ </tr>
282
+
283
+ <tr>
284
+
285
+ <td>13:00~16:00</td>
286
+
287
+ <td><%= check_box 'weeks','monday', {}, true, false %></td>
288
+
289
+ <td><%= check_box 'weeks','tuesday', {}, true, false %></td>
290
+
291
+ <td><%= check_box 'weeks','wednesday', {}, true, false %></td>
292
+
293
+ <td><%= check_box 'weeks','thursday', {}, true, false %></td>
294
+
295
+ <td><%= check_box 'weeks','friday', {}, true, false %></td>
296
+
297
+ <td><%= check_box 'weeks','saturday', {}, true, false %></td>
298
+
299
+ <td><%= check_box 'weeks','sunday', {}, true, false %></td>
300
+
301
+ </tr>
302
+
303
+ <tr>
304
+
305
+ <td>16:00~19:00</td>
306
+
307
+ <td><%= check_box 'weeks','monday', {}, true, false %></td>
308
+
309
+ <td><%= check_box 'weeks','tuesday', {}, true, false %></td>
310
+
311
+ <td><%= check_box 'weeks','wednesday', {}, true, false %></td>
312
+
313
+ <td><%= check_box 'weeks','thursday', {}, true, false %></td>
314
+
315
+ <td><%= check_box 'weeks','friday', {}, true, false %></td>
316
+
317
+ <td><%= check_box 'weeks','saturday', {}, true, false %></td>
318
+
319
+ <td><%= check_box 'weeks','sunday', {}, true, false %></td>
320
+
321
+ </tr>
322
+
323
+ <tr>
324
+
325
+ <td>19:00~22:00</td>
326
+
327
+ <td><%= check_box 'weeks','monday', {}, true, false %></td>
328
+
329
+ <td><%= check_box 'weeks','tuesday', {}, true, false %></td>
330
+
331
+ <td><%= check_box 'weeks','wednesday', {}, true, false %></td>
332
+
333
+ <td><%= check_box 'weeks','thursday', {}, true, false %></td>
334
+
335
+ <td><%= check_box 'weeks','friday', {}, true, false %></td>
336
+
337
+ <td><%= check_box 'weeks','saturday', {}, true, false %></td>
338
+
339
+ <td><%= check_box 'weeks','sunday', {}, true, false %></td>
340
+
341
+ </tr>
342
+
343
+ </table>
344
+
345
+ <tr>
346
+
347
+ <td>都道府県選択</td>
348
+
349
+ <td><%= f.collection_select :prefecture, Prefecture.all, :id, :name %></td>
350
+
351
+ </tr>
352
+
353
+ <tr>
354
+
355
+ <td>授業可能地域</td>
356
+
357
+ <td><%= f.text_field :region %></td>
358
+
359
+ </tr>
360
+
361
+
362
+
363
+ <tr>
364
+
365
+ <td>体験授業に関して</td>
366
+
367
+ <td><%= f.text_area :trial %></td>
368
+
369
+ </tr>
370
+
371
+
372
+
373
+ <tr>
374
+
375
+ <td>オンライン授業に関して</td>
376
+
377
+ <td><%= f.text_area :online %></td>
378
+
379
+ </tr>
380
+
381
+
382
+
383
+ <tr>
384
+
385
+ <td>プロフィール・経歴</td>
386
+
387
+ <td><%= f.text_area :profile %></td>
388
+
389
+ </tr>
390
+
391
+
392
+
393
+ <tr>
394
+
395
+ <td>メッセージ</td>
396
+
397
+ <td><%= f.text_area :message %></td>
398
+
399
+ </tr>
400
+
401
+ <%= f.submit "保存する" %>
402
+
403
+ <% end %>
404
+
405
+
406
+
407
+ </div>
408
+
409
+ ```