質問編集履歴
5
scss追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -472,6 +472,118 @@
|
|
472
472
|
|
473
473
|
|
474
474
|
|
475
|
+
app/assets/stylesheets/index.scss
|
476
|
+
|
477
|
+
```scss
|
478
|
+
|
479
|
+
.index-wrapper {
|
480
|
+
|
481
|
+
margin: 20px;
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
.new-link {
|
488
|
+
|
489
|
+
font-size: 20px;
|
490
|
+
|
491
|
+
}
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
h2 {
|
496
|
+
|
497
|
+
margin-top: 20px;
|
498
|
+
|
499
|
+
}
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
.search-form {
|
504
|
+
|
505
|
+
margin: 5px 0px;
|
506
|
+
|
507
|
+
}
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
.selection-field {
|
512
|
+
|
513
|
+
margin-bottom: 5px;
|
514
|
+
|
515
|
+
}
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
.kifu-lists {
|
520
|
+
|
521
|
+
width: 550px;
|
522
|
+
|
523
|
+
margin-top: 5px;
|
524
|
+
|
525
|
+
}
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
.one-kifu {
|
530
|
+
|
531
|
+
padding: 5px;
|
532
|
+
|
533
|
+
margin-bottom: 5px;
|
534
|
+
|
535
|
+
border: 1px solid black;
|
536
|
+
|
537
|
+
font-size: 20px;
|
538
|
+
|
539
|
+
position: relative;
|
540
|
+
|
541
|
+
}
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
.opponent {
|
546
|
+
|
547
|
+
left: 150px;
|
548
|
+
|
549
|
+
position: absolute;
|
550
|
+
|
551
|
+
}
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
.result {
|
556
|
+
|
557
|
+
left: 250px;
|
558
|
+
|
559
|
+
position: absolute;
|
560
|
+
|
561
|
+
}
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
.type {
|
566
|
+
|
567
|
+
left: 300px;
|
568
|
+
|
569
|
+
position: absolute;
|
570
|
+
|
571
|
+
}
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
.kifu-page {
|
576
|
+
|
577
|
+
right: 10px;
|
578
|
+
|
579
|
+
position: absolute;
|
580
|
+
|
581
|
+
}
|
582
|
+
|
583
|
+
```
|
584
|
+
|
585
|
+
|
586
|
+
|
475
587
|
app/views/kifus/search.html.erb
|
476
588
|
|
477
589
|
```html
|
4
検索の画面を追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-

|
8
8
|
|
9
9
|
|
10
10
|
|
3
検索機能の実装
test
CHANGED
File without changes
|
test
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
if search != ""
|
68
68
|
|
69
|
-
Kifu.where('opponent LIKE(?)', "%#{search}%")
|
69
|
+
Kifu.where('opponent LIKE(?)', "%#{search[:keyword]}%").where(result_id: search[:result]).where(type_id: search[:type])
|
70
70
|
|
71
71
|
else
|
72
72
|
|
@@ -76,6 +76,8 @@
|
|
76
76
|
|
77
77
|
end
|
78
78
|
|
79
|
+
|
80
|
+
|
79
81
|
end
|
80
82
|
|
81
83
|
```
|
@@ -308,7 +310,7 @@
|
|
308
310
|
|
309
311
|
def search
|
310
312
|
|
311
|
-
@kifus = Kifu.search(params
|
313
|
+
@kifus = Kifu.search(params)
|
312
314
|
|
313
315
|
end
|
314
316
|
|
@@ -360,13 +362,39 @@
|
|
360
362
|
|
361
363
|
<%= form_with(url: search_kifus_path, local: true, method: :get, class: "search-form") do |f| %>
|
362
364
|
|
365
|
+
|
366
|
+
|
367
|
+
<div class="selection-field">
|
368
|
+
|
363
|
-
<%= f.label :
|
369
|
+
<%= f.label :opponent, '相手:' %>
|
364
|
-
|
370
|
+
|
365
|
-
<%= f.text_field :keyword, placeholder: "", class: "search-input" %>
|
371
|
+
<%= f.text_field :keyword, placeholder: "名前の一部でも", class: "search-input" %>
|
372
|
+
|
366
|
-
|
373
|
+
</div>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
<div class="selection-field">
|
378
|
+
|
379
|
+
<%= f.label :result_id, '結果:' %>
|
380
|
+
|
381
|
+
<%= f.collection_select :result_id, Result.all, :id, :name, {} %>
|
382
|
+
|
383
|
+
</div>
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<div class="selection-field">
|
388
|
+
|
389
|
+
<%= f.label :type_id, '戦型:' %>
|
390
|
+
|
391
|
+
<%= f.collection_select :type_id, Type.all, :id, :name, {} %>
|
392
|
+
|
393
|
+
</div>
|
394
|
+
|
395
|
+
|
396
|
+
|
367
|
-
<%= f.submit "
|
397
|
+
<%= f.submit "????", class: "search-btn" %>
|
368
|
-
|
369
|
-
<% end %>
|
370
398
|
|
371
399
|
|
372
400
|
|
@@ -444,6 +472,16 @@
|
|
444
472
|
|
445
473
|
|
446
474
|
|
475
|
+
app/views/kifus/search.html.erb
|
476
|
+
|
477
|
+
```html
|
478
|
+
|
479
|
+
// indexと同じコード
|
480
|
+
|
481
|
+
```
|
482
|
+
|
483
|
+
|
484
|
+
|
447
485
|
# 調べた内容
|
448
486
|
|
449
487
|
・[【Rails】複数の条件の検索機能を作る。日付範囲検索を行う](https://qiita.com/poire_prog/items/48f569cdfc8000e18896)
|
@@ -452,7 +490,7 @@
|
|
452
490
|
|
453
491
|
|
454
492
|
|
455
|
-
|
493
|
+
検索をかけても、search.html.erbに飛んで棋譜がひとつも出てきません。原因をご教授いただきたいです。
|
456
494
|
|
457
495
|
|
458
496
|
|
2
「調べた内容」の最後の2文
test
CHANGED
File without changes
|
test
CHANGED
@@ -452,7 +452,7 @@
|
|
452
452
|
|
453
453
|
|
454
454
|
|
455
|
-
いずれも、現在の
|
455
|
+
いずれも、現在のコードとどう結びつくか分からないです。上記の参考で方向性は間違いないでしょうか?現在のアプリに合うような絞り込み検索の方向性について、ご教授いただけると幸いです。
|
456
456
|
|
457
457
|
|
458
458
|
|
1
バージョン情報追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -453,3 +453,11 @@
|
|
453
453
|
|
454
454
|
|
455
455
|
いずれも、現在のアプリの構造に合わないです。現在のアプリに合うような絞り込み検索の方向性について、ご教授いただけると幸いです。
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
# バージョン情報
|
460
|
+
|
461
|
+
ruby 2.6.5p114
|
462
|
+
|
463
|
+
Rails 6.0.3.4
|