Skip to content

Commit 9cfa869

Browse files
committed
refactor: テーブルCSSを共通化してDRYに
- /dojos と /dojos/activity で重複していたテーブルスタイルを統一 - custom.scss の .stats-table クラスに共通スタイルを集約 - 両ビューから重複CSSを削除し、stats-tableクラスを適用
1 parent 0b0e6c0 commit 9cfa869

File tree

3 files changed

+30
-51
lines changed

3 files changed

+30
-51
lines changed

app/assets/stylesheets/custom.scss

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,34 @@ section {
10751075

10761076
/* Stats and Dojos table styling */
10771077
.stats-table {
1078-
td.inactive-item {
1079-
background-color: gainsboro;
1078+
table-layout: auto;
1079+
1080+
th {
1081+
padding: 10px;
1082+
text-align: center;
1083+
}
1084+
1085+
td {
1086+
padding: 1px 10px 1px 10px;
1087+
text-align: right;
1088+
font-size: smaller;
1089+
1090+
&.url-cell {
1091+
white-space: normal; /* 改行を許可 */
1092+
word-wrap: break-word; /* 古めのブラウザ向け */
1093+
overflow-wrap: break-word; /* 新しめのブラウザ向け */
1094+
word-break: break-all; /* 英数字が続く場合の保険 (必要に応じて) */
1095+
text-align: left;
1096+
}
1097+
1098+
&.inactive-item {
1099+
background-color: gainsboro;
1100+
}
1101+
}
1102+
1103+
// Activity page specific style for expired events
1104+
span.expired a {
1105+
color: red;
1106+
background-color: #ffe5e5; /* 薄い赤背景 */
10801107
}
10811108
}

app/views/dojos/activity.html.erb

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,8 @@
2525
</div>
2626
</p>
2727

28-
<style type="text/css">
29-
/* URL 用のセルにクラスを付けておく想定 */
30-
table { table-layout: auto; }
31-
td {
32-
padding: 1px 10px 1px 10px;
33-
text-align: right;
34-
font-size: smaller;
35-
}
36-
span.expired {
37-
a {
38-
color: red;
39-
background-color: #ffe5e5; /* 薄い赤背景 */
40-
}
41-
}
42-
td.url-cell {
43-
white-space: normal; /* 改行を許可 */
44-
word-wrap: break-word; /* 古めのブラウザ向け */
45-
overflow-wrap: break-word; /* 新しめのブラウザ向け */
46-
word-break: break-all; /* 英数字が続く場合の保険 (必要に応じて) */
47-
text-align: left;
48-
}
49-
th {
50-
padding: 10px;
51-
text-align: center;
52-
}
53-
</style>
54-
5528
<div style="margin-top: 20px;" align="center">
56-
<table border="1">
29+
<table border="1" class="stats-table">
5730
<tr>
5831
<th>
5932
<small>☯️ 道場名</small>

app/views/dojos/index.html.erb

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,6 @@
6262
</p>
6363
</div>
6464

65-
<style type="text/css">
66-
/* URL 用のセルにクラスを付けておく想定 */
67-
table { table-layout: auto; }
68-
td {
69-
padding: 1px 10px 1px 10px;
70-
text-align: right;
71-
font-size: smaller;
72-
}
73-
td.url-cell {
74-
white-space: normal; /* 改行を許可 */
75-
word-wrap: break-word; /* 古めのブラウザ向け */
76-
overflow-wrap: break-word; /* 新しめのブラウザ向け */
77-
word-break: break-all; /* 英数字が続く場合の保険 (必要に応じて) */
78-
text-align: left;
79-
}
80-
th {
81-
padding: 10px;
82-
text-align: center;
83-
}
84-
</style>
85-
8665
<div style="margin-top: 20px;" align="center">
8766
<table border="1" class="stats-table">
8867
<tr>

0 commit comments

Comments
 (0)