Skip to content

Commit

Permalink
Mailchimp Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 5, 2016
1 parent 2c9a51b commit 9461e24
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 38 deletions.
28 changes: 14 additions & 14 deletions assets/js/src/i18n/en_ES.coffee
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
window.i18n =
'.modal-title': 'Una vez a la semana, recibe lo último.'
'.modal-body p': '<strong>Política de Privacidad:</strong> No spam ni publicidad. Desunscríbete en cualquier momento.'
'fieldEmail': 'Tu correo electrónico'
'.poweredby': ' © 2016. Todos los derechos reservados. Construido con <a href="https://github.com/Kikobeats/bloggy" target="_blank">Bloggy</a> bajo <a href="https://ghost.org/" target="_blank">Ghost</a>.'
'.modal-body .button-add.wide': 'Subscribirse'
'.subscribe-banner': '¿Te gustaría recibir el contenido en tu correo mensualmente? &nbsp;<a class="button" data-toggle="modal" data-target="#blogsubscribe">Subscríbete</a>',
'.read-more': 'Leer Más'
'.newer-posts': '← Publicaciones recientes'
'.older-posts': 'Publicaciones antiguas →'
'.page-number': 'Página % de $'
'a.post-meta': '← Volver a la Portada'
'.prefix-date': 'el'
'footer .button-add.large.wide': 'Subscríbete y recíbelo semalmente en tu correo'
'.read-next-story .post:before': 'Leer siguiente publicación'
'.modal-title' : 'Una vez a la semana, recibe lo último.'
'.modal-body p' : '<strong>Política de Privacidad:</strong> No spam ni publicidad. Desunscríbete en cualquier momento.'
'fieldEmail' : 'Tu correo electrónico'
'.poweredby' : ' © 2016. Todos los derechos reservados. Construido con <a href="https://github.com/Kikobeats/bloggy" target="_blank">Bloggy</a> bajo <a href="https://ghost.org/" target="_blank">Ghost</a>.'
'newsletter_subscribe' : 'Subscribirse'
'.subscribe-banner' : '¿Te gustaría recibir el contenido en tu correo mensualmente? &nbsp;<a class="button" data-toggle="modal" data-target="#blogsubscribe">Subscríbete</a>',
'.read-more' : 'Leer Más'
'.newer-posts' : '← Publicaciones recientes'
'.older-posts' : 'Publicaciones antiguas →'
'.page-number' : 'Página % de $'
'a.post-meta' : '← Volver a la Portada'
'.prefix-date' : 'el'
'footer .button-add.large.wide' : 'Subscríbete y recíbelo semalmente en tu correo'
'.read-next-story .post:before' : 'Leer siguiente publicación'
14 changes: 5 additions & 9 deletions assets/js/src/i18n/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,20 @@ $ ->
'.prefix-date'
]

for selector in selectors when i18n[selector]
$(selector).html(i18n[selector])
$(selector).html(i18n[selector]) for selector in selectors when i18n[selector]

# inline css

css_selector = '.read-next-story .post:before'
property = "<style>.read-next-story .post:before{ content: '#{i18n[css_selector]}' }</style>"
selector = '.read-next-story .post:before'
property = "<style>.read-next-story .post:before{ content: '#{i18n[selector]}' }</style>"
$('head').append(property)

# pagination

selector = '.page-number'
pageNumber = $(selector).html().split(' ')
pageNumberi18n = i18n[selector].split(' ')
pageNumber[n] = pageNumberi18n[n] for n in [0, 2]
$(selector).html(pageNumber.join(' '))

# forms

selector = 'fieldEmail'
window[selector].placeholder = i18n[selector]
window.fieldEmail.placeholder = i18n.fieldEmail
window.newsletter_subscribe.value = i18n.newsletter_subscribe
3 changes: 2 additions & 1 deletion assets/js/src/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ $(window).load ->
method = if imageWidth >= contentWidth then 'addClass' else 'removeClass'
$(this)[method] 'full-img'

$(window).smartresize casperFullImg
$(this).smartresize casperFullImg
$('#newsletter_form').attr('action', window.newsletter_form) if (window.newsletter_form)

$ ->
el = Bloggy.app
Expand Down
26 changes: 15 additions & 11 deletions assets/scss/widgets/blog-subscribe.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Widget */

.blog-subscribe {
padding: 0;

Expand All @@ -17,9 +19,10 @@

color: $brown;
}
}//.blog-subscribe
}

/* Main Modal */

//the modal
#blogsubscribe {
.modal-header {
padding: 50px 50px 0 50px;
Expand Down Expand Up @@ -58,20 +61,21 @@
height: 50px;
padding: 0 15px;
margin-bottom: 1rem;
}
button {
min-height: 50px;

font-size: 1.8rem;
line-height: 1;
&:last-of-type {
min-height: 50px;
font-size: 1.8rem;
line-height: 1;

@include breakpoint(450px) {
font-size: 1.3rem;
}
}

@include breakpoint(450px) {
font-size: 1.3rem;
}
}
p {
margin: 1rem 0;

color: $brown;
}
}//#blogsubscribe
}
8 changes: 5 additions & 3 deletions default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
<a class="modal-close" data-dismiss="modal" aria-hidden="true" href="#"><span class="hidden">Close</span></a>
</header>
<div class="modal-body">
<form action="{{! populated via code injection}}" method="post">
<input id="fieldEmail" name="{{! populated via code injection}}" type="email" placeholder="Your email address" required />
<button class="button-add wide" type="submit">Send me good stuff</button>
<form id="newsletter_form" action="" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<input id="fieldEmail" type="email" value="" placeholder="Your email address" name="EMAIL" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_c6323ba5f5f4afeec2c624d39_0ee0695955" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Send me good stuff" name="subscribe" id="newsletter_subscribe" class="button-add wide"></div>
<p><strong>Privacy policy:</strong> No spam. No jibber jabber. Unsubscribe any time.</p>
</form>
</div>
Expand Down

3 comments on commit 9461e24

@juvern
Copy link

@juvern juvern commented on 9461e24 May 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for sharing your theme with the world! Just a quick question - I can't seem to get the modal to pop up after updating the attribute <form action="MailingList" .... > with my Mailchimp url. I have tried a few other alternatives, but can't seem to work out why. If you could help, that would be great!

@Kikobeats
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need docs, but I remember that I use jQuery for do it.

In Ghost Head Snippet Injection:

<script>
  var newsletter_form = '//yourNamespace.us5.list-manage.com/subscribe/post?u=c6323ba5f5f4afeec2c624d39&amp;id=0ee0695955'
</script>

@juvern
Copy link

@juvern juvern commented on 9461e24 May 31, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.