質問編集履歴

2

修正

2022/09/08 09:12

投稿

happy
happy

スコア13

test CHANGED
@@ -1 +1 @@
1
- date_selectヘルパー bootstrapが効かな
1
+  【rails】date_selectヘルパーbootstrapで装飾した
test CHANGED
@@ -1,13 +1,14 @@
1
1
  ## 解消したいこと
2
2
 
3
- 以下(※①)のような、date_selectヘルパーで実装しているフォームに対して、bootstrapを適用させたいのですが、うまくきません
3
+ 以下(※①)のような、date_selectヘルパーで実装しているフォームに対して、bootstrapを適用させたいのですが、現状適用されな状況です
4
4
 
5
5
  collection_selectヘルパーには以下(※②)のような記述で、bootstrapを適用させることができました。
6
6
 
7
7
  ```ruby
8
- ※①
8
+ ※① 
9
9
  <%= raw sprintf(f.date_select(
10
10
  :date_during_month,
11
+            class: "form-select form-select-sm"  # bootstrapを適用させたい
11
12
  use_month_numbers: true,
12
13
  date_separator: '%s',
13
14
  discard_day: true),'年 ') + '月' %>

1

習性

2022/09/04 23:09

投稿

happy
happy

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,11 @@
1
1
  ## 解消したいこと
2
2
 
3
- 以下のような、date_selectヘルパーで実装しているフォームに対して、bootstrapを適用させたいのですが、うまくいきません。
3
+ 以下(※①)のような、date_selectヘルパーで実装しているフォームに対して、bootstrapを適用させたいのですが、うまくいきません。
4
+
5
+ collection_selectヘルパーには以下(※②)のような記述で、bootstrapを適用させることができました。
4
6
 
5
7
  ```ruby
8
+ ※①
6
9
  <%= raw sprintf(f.date_select(
7
10
  :date_during_month,
8
11
  use_month_numbers: true,
@@ -10,5 +13,15 @@
10
13
  discard_day: true),'年 ') + '月' %>
11
14
  ```
12
15
 
16
+ ```ruby
17
+ ※②
18
+ <%= f.collection_select :d_list_id, List.where(code: 100..299).or(List.where(code: 500..599)), :id, :code_name, { prompt: "選択してください" }, class: "form-select form-select-sm col" %>
19
+
20
+ ```
21
+
13
22
  ## 現状のフォーム
14
23
  [![Image from Gyazo](https://i.gyazo.com/7b7d8c214280111735b4592113415ae7.png)](https://gyazo.com/7b7d8c214280111735b4592113415ae7)
24
+
25
+ ## 試したこと
26
+
27
+ prompt:falseをつけて、classを記述したがダメでした。