diff --git a/app/controllers/dojos_controller.rb b/app/controllers/dojos_controller.rb
index 91730216e..8bba99c75 100644
--- a/app/controllers/dojos_controller.rb
+++ b/app/controllers/dojos_controller.rb
@@ -2,13 +2,13 @@ class DojosController < ApplicationController
# GET /dojos[.json]
def index
- @dojo_data = []
+ @dojos = []
Dojo.order(order: :asc).all.each do |dojo|
- @dojo_data << {
+ @dojos << {
id: dojo.id,
url: dojo.url,
name: dojo.name,
- logo: "https://coderdojo.jp#{dojo.logo}",
+ logo: root_url + dojo.logo[1..],
order: dojo.order,
counter: dojo.counter,
is_active: dojo.is_active,
@@ -21,8 +21,8 @@ def index
respond_to do |format|
# No corresponding View for now.
# Only for API: GET /dojos.json
- format.html { redirect_to root_url(anchor: 'dojos') }
- format.json { render json: @dojo_data }
+ format.html # => app/views/dojos/index.html.erb
+ format.json { render json: @dojos }
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ab89f20c1..d3b540fde 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -78,11 +78,6 @@ def lazy_image_tag(source, options={})
end
end
- # NOTE: Delete this helper to avoid overriding when /dojos routing is added.
- def dojos_path(options={anchor: 'dojos'})
- root_path(options)
- end
-
def welcome_path(options={anchor: 'welcome'})
root_path(options)
end
diff --git a/app/views/dojos/index.html.erb b/app/views/dojos/index.html.erb
new file mode 100644
index 000000000..3638ed17e
--- /dev/null
+++ b/app/views/dojos/index.html.erb
@@ -0,0 +1,106 @@
+<% provide :title, "CoderDojo 一覧 - 統計情報" %>
+<% provide :desc, "CoderDojo の公開されている統計情報をまとめたページです。" %>
+<% provide :url, dojos_url %>
+<% provide :meta_image, asset_path('stats_cover.png') %>
+
+
+ CoderDojo の公開されている統計情報をまとめたページです。
+
+ ☯️
+ CoderDojo 一覧 - 統計情報
+
(公開情報のみ掲載)
+
+
+
+
+ <%= link_to dojos_path(format: :json), dojos_path(format: :json) %> で JSON に変換できます
|
+
+ ☯️
+ + Dojo 名 / ID + + |
+
+
+ 🗓
+ + 掲載日 + + |
+
+
+ 📝
+ + URL + + |
+
|---|---|---|
|
+
+ <%= link_to dojo_path(dojo[:id]) do %>
+ <%= dojo[:name] %> + (ID: <%= dojo[:id] %>) + <% end %> + + |
+ + <%= dojo[:created_at].strftime("%F") %> + | ++ + + + <%= CGI.unescape dojo[:url].gsub('https://', '').gsub('http://', '').gsub('www.', '').chomp('/') %> + + + + | +
+
+ 本ページにある統計情報は、現在 Doorkeeper と connpass にのみ対応しています。+ +