Skip to content

Instantly share code, notes, and snippets.

@bullfight
Created February 6, 2012 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bullfight/1752505 to your computer and use it in GitHub Desktop.
Save bullfight/1752505 to your computer and use it in GitHub Desktop.
- return unless article.promotions.present?
%section#associated_freemusic.module.inner
%header.sty-plain
%hgroup
%h3= t('modules.shared.heading.mp3_downloads')
- unless current_user
%section.signup
= link_to "<span class='fg ico-user-silhouette'>&nbsp;</span>#{t("site_header.account_links.sign_up")}".html_safe, janrain_signup_url, :class => "btn sty-blue siz-large with-icon", 'data-lightbox-type' => 'iframe', 'data-lightbox' => janrain_signup_url, 'data-lightbox-width' => '700', 'data-lightbox-height' => '800'
= link_to "<span class='fg ico-lock'>&nbsp;</span>#{t('site_header.account_links.sign_in')}".html_safe, janrain_signin_url, :class => "btn sty-gray size-large with-icon", 'data-lightbox-type' => 'iframe', 'data-lightbox' => janrain_signin_url, 'data-lightbox-width' => '700', 'data-lightbox-height' => '800'
- else
%section#article_participate{ :data => { "json-path" => api_article_freemusic_index_path(article) } }
.loading
.error
%ul.lst-boxed
= content_for :js_templates do
%script#article_participate_template{type: 'text/x-handlebars-template'}
:plain
{{#if url.download}}
<li>
<button class="btn sty-gray siz-large with-icon">
<a href="{{url.download}}" class="btn sty-gray siz-large with-icon">
<span class='fg ico-download'></span>
{{name}}
</a>
</button>
</li>
{{/if}}
{{#if url.participate}}
<form accept-charset="UTF-8" action="{{url.participate}}" class="promotion_participants" method="post">
<div class='errors'></div>
<input class="hidden" id="promotion_participants_user_id" name="promotion_participants[user_id]" type="hidden" value="{{user_id}}" />
<div class='actions legroom'>
<button class="btn sty-gray siz-large with-icon" type="submit">
<span class='fg ico-disk'>&nbsp;</span>Freemusic - Get it!
</button>
</div>
</form>
{{/if}}
# Handlebars template populated with Latest AJAX call
if $('#article_participate').length
new Latest('#article_participate', 'ul.lst-boxed', {})
# Now I just want to intercept a submit event on the {{#if url.participate}} part of the form
$("#article_participate").find('form').submit (e) ->
e.preventDefault()
alert "giggity"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment