|
18 | 18 | <br> |
19 | 19 | <div class='form__terms list'> |
20 | 20 | <ul style='list-style-type: "\2713\0020"; font-size: smaller;'> |
21 | | - <li>現在は活動停止中 (In-active) の道場も表示されています</li> |
22 | | - <li>道場名をクリックすると個別の統計データが確認できます</li> |
23 | | - <li>下記表は <code><%= link_to dojos_path(format: :json), dojos_path(format: :json) %></code> で JSON に変換できます</li> |
| 21 | + <li>道場名をクリックすると、その道場の個別の統計データを確認できます</li> |
| 22 | + <li>対象期間を選ぶと、その期間のアクティブな道場の一覧を表示できます</li> |
| 23 | + <li>全期間の場合のみ、すべての道場(非アクティブ含む)を表示できます</li> |
24 | 24 | </ul> |
25 | 25 | </div> |
| 26 | + <div style="text-align: center; margin-top: 10px; margin-bottom: 50px;"> |
| 27 | + <a href="/stats" style="color: #007bff; text-decoration: none;"> |
| 28 | + » 推移グラフで見る |
| 29 | + </a> |
| 30 | + </div> |
26 | 31 | </p> |
| 32 | + |
| 33 | + <!-- 年次データを取得する --> |
| 34 | + <div style="margin: 30px auto; padding: 20px; background: #f8f9fa; border-radius: 8px; max-width: 600px;"> |
| 35 | + <h3 id="table"> |
| 36 | + <a href="#table">📊</a> |
| 37 | + 年次データを取得する |
| 38 | + </h3> |
| 39 | + |
| 40 | + <%= render_inline_flash_messages %> |
| 41 | + |
| 42 | + <div style="display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 15px;"> |
| 43 | + <%= label_tag :year, '対象期間:', style: 'font-weight: bold;' %> |
| 44 | + <%= select_tag :year, |
| 45 | + options_for_select( |
| 46 | + (2012..Date.current.year).to_a.reverse.map { |y| [y.to_s + '年', y] }, |
| 47 | + params[:year] |
| 48 | + ), |
| 49 | + include_blank: '全期間', |
| 50 | + onchange: "window.location.href = this.value ? '#{dojos_path}?year=' + this.value + '#table' : '#{dojos_path}#table'", |
| 51 | + style: 'padding: 5px; border: 1px solid #ced4da; border-radius: 4px; cursor: pointer;' %> |
| 52 | + |
| 53 | + <%= link_to 'CSV', dojos_path(format: :csv, year: params[:year]), |
| 54 | + style: 'padding: 5px 15px; background: #28a745; color: white; text-decoration: none; border-radius: 4px;' %> |
| 55 | + |
| 56 | + <%= link_to 'JSON', dojos_path(format: :json, year: params[:year]), |
| 57 | + style: 'padding: 5px 15px; background: #6c757d; color: white; text-decoration: none; border-radius: 4px;' %> |
| 58 | + </div> |
| 59 | + |
| 60 | + <p style="font-size: smaller; color: #6c757d; margin-top: 15px;"> |
| 61 | + 対象期間を選択すると、その時点のアクティブな道場の一覧を表示・ダウンロードできます。 |
| 62 | + </p> |
| 63 | + </div> |
27 | 64 |
|
28 | 65 | <style type="text/css"> |
29 | 66 | /* URL 用のセルにクラスを付けておく想定 */ |
|
47 | 84 | </style> |
48 | 85 |
|
49 | 86 | <div style="margin-top: 20px;" align="center"> |
50 | | - <table border="1"> |
| 87 | + <table border="1" class="stats-table"> |
51 | 88 | <tr> |
52 | 89 | <th> |
53 | 90 | <small> |
|
73 | 110 | </tr> |
74 | 111 | <% @dojos.each do |dojo| %> |
75 | 112 | <tr> |
76 | | - <td> |
77 | | - <small> |
78 | | - <%= link_to dojo_path(dojo[:id]) do %> |
79 | | - <%= dojo[:name] %><br> |
80 | | - <small>(ID: <%= dojo[:id] %>)</small> |
81 | | - <% end %> |
82 | | - </small> |
83 | | - </td> |
84 | | - <td> |
85 | | - <small><%= dojo[:created_at].strftime("%F") %></small> |
86 | | - </td> |
87 | | - <td class="url-cell"> |
88 | | - <small> |
89 | | - <a href='<%= dojo[:url] %>'> |
90 | | - <span title="<%= dojo[:url] %>"> |
91 | | - <%= CGI.unescape dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/') %> |
92 | | - </span> |
93 | | - </a> |
94 | | - </small> |
95 | | - </td> |
| 113 | + <% if dojo[:is_active] %> |
| 114 | + <td> |
| 115 | + <small> |
| 116 | + <%= link_to dojo_path(dojo[:id]) do %> |
| 117 | + <%= dojo[:name] %><br> |
| 118 | + <small>(ID: <%= dojo[:id] %>)</small> |
| 119 | + <% end %> |
| 120 | + </small> |
| 121 | + </td> |
| 122 | + <td> |
| 123 | + <small><%= dojo[:created_at].strftime("%F") %></small> |
| 124 | + </td> |
| 125 | + <td class="url-cell"> |
| 126 | + <small> |
| 127 | + <a href='<%= dojo[:url] %>'> |
| 128 | + <span title="<%= dojo[:url] %>"> |
| 129 | + <%= truncate(CGI.unescape(dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/')), length: 30) %> |
| 130 | + </span> |
| 131 | + </a> |
| 132 | + </small> |
| 133 | + </td> |
| 134 | + <% else %> |
| 135 | + <td class="inactive-item"> |
| 136 | + <small> |
| 137 | + <%= link_to dojo_path(dojo[:id]) do %> |
| 138 | + <%= dojo[:name] %><br> |
| 139 | + <small>(ID: <%= dojo[:id] %>)</small> |
| 140 | + <% end %> |
| 141 | + </small> |
| 142 | + </td> |
| 143 | + <td class="inactive-item"> |
| 144 | + <small><%= dojo[:created_at].strftime("%F") %></small> |
| 145 | + </td> |
| 146 | + <td class="url-cell inactive-item"> |
| 147 | + <small> |
| 148 | + <a href='<%= dojo[:url] %>'> |
| 149 | + <span title="<%= dojo[:url] %>"> |
| 150 | + <%= truncate(CGI.unescape(dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/')), length: 30) %> |
| 151 | + </span> |
| 152 | + </a> |
| 153 | + </small> |
| 154 | + </td> |
| 155 | + <% end %> |
96 | 156 | </tr> |
97 | 157 | <% end %> |
98 | 158 | </table> |
|
0 commit comments