Skip to content

Commit 6b55517

Browse files
committed
♻️ DojoLetter登録フォームをパーシャル化
- shared/_dojo_letter_signup パーシャルを作成(Rails命名規則に従う) - ホームページの#newsセクションでパーシャルを使用 - /newsページでも同じパーシャルを使用 - コードの重複を削除してDRY原則を適用
1 parent 89c623d commit 6b55517

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

app/controllers/news_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class NewsController < ApplicationController
22
def index
3-
@title = '☯️ CoderDojo ニュース ✉️'
3+
@title = '☯️ CoderDojo ニュース 📰'
44
@desc = 'CoderDojo に関するお知らせの一覧ページです。'
55
@url = request.url
66

app/views/home/show.html.erb

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,23 +198,8 @@
198198
</li>
199199
<% end %>
200200
</ul>
201-
<p style="margin-top: 30px;">
202-
最新情報はメールで受け取れます。
203-
<br class="ignore-pc">
204-
<small>(毎月配信)</small>
205-
</p>
206-
207-
<div id="mc_embed_signup">
208-
<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">
209-
<div id="mc_embed_signup_scroll">
210-
<input id="mce-EMAIL" type="email" name="EMAIL" class="email" placeholder="your@example.com">
211-
<div style="position: absolute; left: -5000px;" aria-hidden="true">
212-
<input tabindex="-1" name="b_39a5824e42ab56ec44bb4e84e_097dfa6a14" type="text" value="">
213-
</div>
214-
<input id="mc-embedded-subscribe" class="button" name="subscribe" type="submit" value="購読する">
215-
</div>
216-
</form>
217-
</div>
201+
202+
<%= render 'shared/dojo_letter_signup' %>
218203

219204
<div class="btn-cover" style="margin-top: 40px;">
220205
<a class="btn-blue" href="<%= news_url %>">

app/views/news/index.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<% end %>
3131
</section>
3232

33+
<%= render 'shared/dojo_letter_signup' %>
34+
3335
<div style="margin-bottom: 40px;">
3436
<p style="color: #5F5F5F">
3537
<small>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<p style="margin-top: 30px;">
2+
最新情報はメールで受け取れます。
3+
<br class="ignore-pc">
4+
<small>(毎月配信)</small>
5+
</p>
6+
7+
<div id="mc_embed_signup">
8+
<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">
9+
<div id="mc_embed_signup_scroll">
10+
<input id="mce-EMAIL" type="email" name="EMAIL" class="email" placeholder="your@example.com">
11+
<div style="position: absolute; left: -5000px;" aria-hidden="true">
12+
<input tabindex="-1" name="b_39a5824e42ab56ec44bb4e84e_097dfa6a14" type="text" value="">
13+
</div>
14+
<input id="mc-embedded-subscribe" class="button" name="subscribe" type="submit" value="購読する">
15+
</div>
16+
</form>
17+
</div>

0 commit comments

Comments
 (0)