Skip to content

Commit b2bf60f

Browse files
authored
Merge pull request #1681 from coderdojo-japan/convert-shared-haml-to-erb
Convert shared HAML partials to the default ERB in Rails
2 parents 9a4f1b8 + 292d9c9 commit b2bf60f

31 files changed

+470
-396
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"customizations": {
3333
"codespaces": {
3434
"openFiles": [
35-
"app/views/home/show.html.haml"
35+
"app/views/home/show.html.erb"
3636
]
3737
},
3838
"vscode": {

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ gem 'jquery-rails'
1313

1414
gem 'bootstrap-sass'
1515
gem 'font-awesome-rails'
16-
gem 'haml-rails'
1716
gem 'rails-html-sanitizer', '~> 1.4.4'
1817
gem 'sass-rails', '>= 5'
1918
gem 'simple_grid_rails'

Gemfile.lock

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,6 @@ GEM
205205
multi_json (~> 1.11)
206206
os (>= 0.9, < 2.0)
207207
signet (~> 0.15)
208-
haml (6.3.0)
209-
temple (>= 0.8.2)
210-
thor
211-
tilt
212-
haml-rails (2.1.0)
213-
actionpack (>= 5.1)
214-
activesupport (>= 5.1)
215-
haml (>= 4.0.6)
216-
railties (>= 5.1)
217208
hash-deep-merge (0.1.1)
218209
httpclient (2.9.0)
219210
mutex_m
@@ -482,7 +473,6 @@ GEM
482473
activesupport (>= 6.1)
483474
sprockets (>= 3.0.0)
484475
stackprof (0.2.27)
485-
temple (0.10.3)
486476
thor (1.3.2)
487477
tilt (2.6.0)
488478
timeout (0.4.3)
@@ -531,7 +521,6 @@ DEPENDENCIES
531521
flamegraph
532522
font-awesome-rails
533523
google_drive
534-
haml-rails
535524
jbuilder
536525
jquery-rails
537526
koala

app/helpers/application_helper.rb

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,21 @@ def lazy_image_tag(source, options={})
7777
end
7878
end
7979

80-
def welcome_path(options={anchor: 'welcome'})
81-
root_path(options)
82-
end
83-
84-
def news_path(options={anchor: 'news'})
85-
root_path(options)
86-
end
87-
88-
def news_url(path='/')
89-
'https://news.coderdojo.jp' + path
90-
end
80+
def welcome_path(options={anchor: 'welcome'}); root_path(options); end
81+
def news_path (options={anchor: 'news'}); root_path(options); end
9182

92-
def decadojo_url; 'https://decadojo.coderdojo.jp'; end
93-
def dojocon_url; 'https://dojocon.coderdojo.jp'; end
83+
def news_url (path='/'); 'https://news.coderdojo.jp' + path; end
84+
def dojomap_url(path='/'); 'https://map.coderdojo.jp' + path; end
85+
def zen_url(path='/find'); 'https://zen.coderdojo.com' + path; end
9486

95-
def dojoletter_url()
96-
'https://news.coderdojo.jp/category/DojoLetterバックナンバー'
97-
end
87+
def decadojo_url; 'https://decadojo.coderdojo.jp'; end
88+
def dojocon_url; 'https://dojocon.coderdojo.jp'; end
89+
def dojoletter_url; 'https://news.coderdojo.jp/category/DojoLetterバックナンバー'; end
90+
def foundation_url; 'https://speakerdeck.com/helloworldfoundation'; end
9891

99-
def dojomap_url(path='/')
100-
'https://map.coderdojo.jp' + path
101-
end
92+
def facebook_group_url; 'https://www.facebook.com/groups/coderdojo.jp'; end
93+
def facebook_page_url; 'https://www.facebook.com/coderdojo.jp'; end
94+
def twitter_url; 'https://twitter.com/CoderDojoJapan'; end
95+
def youtube_url; 'https://youtube.com/CoderDojoJapan'; end
10296

103-
def foundation_url
104-
'https://speakerdeck.com/helloworldfoundation'
105-
end
106-
107-
def zen_url(path='/find')
108-
'https://zen.coderdojo.com' + path
109-
end
11097
end

app/views/home/show.html.erb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
</div>
106106
</section>
107107

108-
<!-- 以下のイベントお知らせ部分は HAML でコメントアウトされているため、HTMLコメントで残しています
108+
<!-- イベントのお知らせ (任意) -->
109+
<!--
109110
<hr>
110111
<section id="events" class="detail-introduction text-center">
111112
<h2>
@@ -161,7 +162,7 @@
161162
</section>
162163

163164
<!--
164-
以下の .text-center.grayscale-bg は HAML 上でコメントアウトされているため、HTMLコメントで残しています
165+
以下の .text-center.grayscale-bg は section 数を増やしたときの調整用。
165166
<div class="text-center grayscale-bg" style="padding-top: 40px; padding-bottom: 50px;">
166167
<section class="detail-introduction" id="news">
167168
...
@@ -203,7 +204,19 @@
203204
<br class="ignore-pc">
204205
<small>(毎月配信)</small>
205206
</p>
206-
<%= render partial: 'shared/newsletter' %>
207+
208+
<div id="mc_embed_signup">
209+
<form id="mc-embedded-subscribe-form" class="validate" action="https://coderdojo.us17.list-manage.com/subscribe/post?u=39a5824e42ab56ec44bb4e84e&amp;id=097dfa6a14" method="post" name="mc-embedded-subscribe-form" novalidate="" target="_blank">
210+
<div id="mc_embed_signup_scroll">
211+
<input id="mce-EMAIL" type="email" name="EMAIL" class="email" placeholder="your@example.com">
212+
<div style="position: absolute; left: -5000px;" aria-hidden="true">
213+
<input tabindex="-1" name="b_39a5824e42ab56ec44bb4e84e_097dfa6a14" type="text" value="">
214+
</div>
215+
<input id="mc-embedded-subscribe" class="button" name="subscribe" type="submit" value="購読する">
216+
</div>
217+
</form>
218+
</div>
219+
207220
<div class="btn-cover" style="margin-top: 40px;">
208221
<a class="btn-blue" href="<%= news_url %>">
209222
<i class="far fa-newspaper"></i>
@@ -213,7 +226,7 @@
213226
</section>
214227

215228
<!--
216-
以下も HAML 上でコメントアウトされている「最近の CoderDojo (Twitter タイムライン)」部分です
229+
「最近の CoderDojo (Twitter タイムライン)」部分。公式の埋め込み機能が復旧されるまではコメントアウト。
217230
<section id="timeline" class="text-center" style="margin-bottom: 50px;">
218231
<h3 class="text-center" style="margin-bottom: 30px;">
219232
<a href="https://x.com/search?vertical=default&q=dojocon%20OR%20coderdojo%20OR%20コーダー道場%20lang%3Aja">

app/views/layouts/application.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696

9797
<%= render 'shared/footer' %>
9898

99+
<%= yield :javascript %>
100+
99101
<!-- at the end of the BODY -->
100102
<script>
101103
// Twemoji parse
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<li class="dojo dojo-sp">
2+
<header>
3+
<%= link_to lazy_image_tag(dojo.logo, alt: "CoderDojo #{dojo.name}", class: 'dojo-picture-sp'), dojo.url,
4+
target: "_blank", rel: "external noopener" %>
5+
<p class="dojo-sp-info">
6+
<span class="dojo-name dojo-name-sp">
7+
<%= link_to "#{dojo.name} (#{dojo.prefecture.name})", dojo.url, target: "_blank", rel: "external noopener" %>
8+
<% if not dojo.counter == 1 %>
9+
<span class="dojo-counter" data-original-title="道場数"
10+
data-placement="bottom"
11+
data-toggle="tooltip"><%= dojo.counter %></span>
12+
<% end %>
13+
</span>
14+
<span class="dojo-description">
15+
<%= dojo.description %>
16+
<% if dojo.is_private %>
17+
<%= link_to 'Private', doc_path('private-dojo'), class: 'dojo-private' %>
18+
<% end %>
19+
</span>
20+
</p>
21+
</header>
22+
<ul class="tags">
23+
<% dojo.tags.each do |tag| %>
24+
<li><%= tag %></li>
25+
<% end %>
26+
</ul>
27+
</li>

app/views/shared/_dojo.html+smartphone.haml

Lines changed: 0 additions & 18 deletions
This file was deleted.

app/views/shared/_dojo.html.erb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<li class="dojo" id="<%= dojo.name %>">
2+
<header>
3+
<%= link_to lazy_image_tag(dojo.logo, alt: "CoderDojo #{dojo.name}", class: 'dojo-picture'), dojo.url,
4+
target: "_blank", rel: "external noopener" %>
5+
<span class="dojo-name">
6+
<%= link_to "#{dojo.name} (#{dojo.prefecture.name})", dojo.url, target: "_blank", rel: "external noopener" %>
7+
<% if not dojo.counter == 1 %>
8+
<span class="dojo-counter" data-original-title="道場数"
9+
data-placement="bottom"
10+
data-toggle="tooltip"><%= dojo.counter %></span>
11+
<% end %>
12+
</span>
13+
</header>
14+
<ul class="tags">
15+
<% dojo.tags.each do |tag| %>
16+
<li><%= tag %></li>
17+
<% end %>
18+
</ul>
19+
<p class="dojo-description">
20+
<%= dojo.description %>
21+
<% if dojo.is_private %>
22+
<%= link_to 'Private', doc_path('private-dojo'), class: 'dojo-private' %>
23+
<% end %>
24+
</p>
25+
</li>

app/views/shared/_dojo.html.haml

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<div id="accordion" class="panel-group" aria-multiselectable="true" role="tablist">
2+
<% regions_and_dojos.each_with_index do |(region, dojos), index| %>
3+
<div class="panel panel-default">
4+
<div class="panel-heading" id="heading<%= index %>" role="tab">
5+
<h4 class="panel-title">
6+
<a data-toggle="collapse"
7+
href="#collapse<%= index %>" role="button">
8+
<i class="fa fa-chevron-right" aria-hidden="true"></i>
9+
<%= region %>
10+
- <%= dojos.pluck(:counter).sum %> Dojos
11+
</a>
12+
</h4>
13+
</div>
14+
<div class="panel-collapse collapse" id="collapse<%= index %>" role="tabpanel">
15+
<div class="panel-body grayscale-bg dojo-flex">
16+
<%= render partial: 'shared/dojo', collection: dojos %>
17+
</div>
18+
</div>
19+
</div>
20+
<% end %>
21+
</div>
22+
23+
<script>
24+
$(document).ready(function() {
25+
$('.collapse').on('shown.bs.collapse', function() {
26+
$(this).parent().find(".fa-chevron-right").removeClass("fa-chevron-right").addClass("fa-chevron-down");
27+
});
28+
29+
$('.collapse').on('hidden.bs.collapse', function() {
30+
$(this).parent().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-right");
31+
});
32+
});
33+
</script>

app/views/shared/_dojos.html+smartphone.haml

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/views/shared/_dojos.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<ul class="loaded dojo-flex">
2+
<%= render partial: 'shared/dojo', collection: regions_and_dojos.values.flatten %>
3+
</ul>

app/views/shared/_dojos.html.haml

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_dojos.html+smartphone.erb

app/views/shared/_dojos_stats.html.haml

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/views/shared/_footer.html.erb

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<footer id="footer" class="footer-bottom text-center">
2+
<h2 style="line-height: 30px;">
3+
<a class="footer-link" href="/" title="トップページに戻ります">Top</a>
4+
| <a class="footer-link" href="/kata" title="道場情報まとめ「Kata」を見る">Kata</a>
5+
| <a class="footer-link" href="/#news" title="最近のニュース「DojoLetter」を見る">News</a>
6+
| <a class="footer-link" href="/docs" title="公式資料まとめ「Docs」を見る">資料</a>
7+
| <a class="footer-link" href="/charter" title="CoderDojo 憲章を見る">憲章</a>
8+
| <a class="footer-link" href="/stats" title="CoderDojo の統計データを見る">統計</a>
9+
| <a class="footer-link" href="/sotechsha2" title="CoderDojo Japan 公式ブックを見る">書籍</a>
10+
| <a class="footer-link" href="<%= dojomap_url %>" title="地図から探せる「DojoMap」を見る">地図</a>
11+
| <a class="footer-link" href="/privacy" title="プライバシーポリシーを見る">Privacy</a>
12+
| <a class="footer-link" href="/podcasts" title="ポッドキャスト番組「DojoCast」を見る">Podcast</a>
13+
| <a class="footer-link" href="<%= decadojo_url %>" title="CoderDojo の地域カンファレンス「DecaDojo」を見る">DecaDojo</a>
14+
| <a class="footer-link" href="<%= dojocon_url %>" title="CoderDojo の全国カンファレンス「DojoCon Japan」を見る">DojoCon</a>
15+
| <a class="footer-link" href="/english" hreflang="en" title="Read CoderDojo Japan's website in English">English</a>
16+
</h2>
17+
18+
<h2>
19+
<%= link_to news_url do %>
20+
<i class="fa fa-newspaper-o fa-3x fa-fw" aria-hidden="true" title="News"></i>
21+
<% end %>
22+
<%= link_to facebook_page_url do %>
23+
<i class="fa fa-facebook fa-3x fa-fw" aria-hidden="true" title="Facebook"></i>
24+
<% end %>
25+
<%= link_to twitter_url do %>
26+
<i class="fa fa-twitter fa-3x fa-fw" aria-hidden="true" title="Twitter"></i>
27+
<% end %>
28+
<%= link_to youtube_url do %>
29+
<i class="fa fa-youtube fa-3x fa-fw" aria-hidden="true" title="YouTube"></i>
30+
<% end %>
31+
<%= link_to podcasts_path do %>
32+
<i class="fa fa-podcast fa-3x fa-fw" aria-hidden="true" title="Podcast"></i>
33+
<% end %>
34+
<%= link_to english_path do %>
35+
<i class="fa fa-globe fa-3x fa-fw" aria-hidden="true" title="English"></i>
36+
<% end %>
37+
</h2>
38+
39+
<p style="margin-bottom: 30px;">
40+
本サイトのソースコードは<br class="ignore-pc">
41+
<a class="footer-link" href="https://github.com/coderdojo-japan/coderdojo.jp">GitHub</a>
42+
上で公開されています。
43+
</p>
44+
<p style="font-size: 90%; color: #DDDDDD;">
45+
Copyright &copy;
46+
<a href="/about-coderdojo-japan" style="color: #DDDDDD; text-decoration: none;">
47+
一般社団法人 CoderDojo Japan
48+
</a>
49+
<br>
50+
新宿区高田馬場1-28-10 三慶ビル4F
51+
<a href="https://case-shinjuku.com/" style="color: #DDDDDD; text-decoration: none;">
52+
ケイス新宿
53+
</a>
54+
</p>
55+
</footer>

0 commit comments

Comments
 (0)