docbrown/app/views/users/_membership.html.erb
2018-02-28 16:11:08 -05:00

68 lines
3.1 KiB
Text

<h3>Your Membership Features</h3>
<ul>
<% if current_user.monthly_dues >= 2500 %>
<li>Workshop Pass -- <a href="/events">see our events for the month!</a></li>
<% end %>
<li>Post Analytics (beta) now live on <a href="/dashboard">your dashboard</a></li>
<li> Wall of Patrons and Scholars </li>
<li>More on the way!</li>
</ul>
<% if current_user.monthly_dues >= 1000 %>
<% cache "store_coupons_user_#{current_user.id}_dues_#{current_user.monthly_dues}" do %>
<h3>Shop Coupons</h3>
<div style="background: white;border: 1px dashed black;padding: 18px;border-radius:3px">
<span style="font-weight:bold;font-size:1.3em">🎟 25% Off Everything:
<em style="color:darkcyan;font-weight:700">
<%= CouponGenerator.new(current_user.id,"member_discount").generate %>
</em></span>
<br/><br/>
<% if current_user.monthly_dues >= 2500 %>
<span style="font-weight:bold;font-size:1.3em">🎟 Level 3 Merch Gift (one time use):
<em style="color:darkcyan;font-weight:700">
<%= CouponGenerator.new(current_user.id,"tee_pack").generate %>
</em></span>
<br/><br/>
👆 This coupon will give you 100% off:<br/>
<a href="https://shop.dev.to/collections/membership-rewards/products/rewards-only-unisex" target="_blank">
DEV Tee Package (Unisex Cut)
</a>
or
<a href="https://shop.dev.to/collections/membership-rewards/products/rewards-only-heather-womens" target="_blank">
DEV Tee Package (Women's Cut)
</a>.
<br/>
Visit one of these links to claim your gift. The listed price is a placeholder that will be negated by the coupon.
<% else %>
<span style="font-weight:bold;font-size:1.3em">🎟 Level 2 Sticker Gift (one time use):
<em style="color:darkcyan;font-weight:700">
<%= CouponGenerator.new(current_user.id,"sticker_pack").generate %>
</em></span>
<br/><br/>
👆 This coupon will give you 100% off
<a href="https://shop.dev.to/collections/membership-rewards/products/rewards-only-heather-womens" target="_blank">
THE MEMBERS-ONLY STICKER PACK
</a>.
<br/>
Visit link to claim your gift. The listed price is a placeholder that will be negated by the coupon.
<% end %>
</div>
<br/><br/>
<% end %>
<% end %>
<h3>Want to change your membership level?</h3>
<%= form_tag "/stripe_subscriptions/current_user", method: :patch do %>
<div class="field">
<%= label_tag :amount, "Monthly Contribution ($):", style: 'width: 100%;' %>
<%= number_field_tag :amount, current_user.monthly_dues/100.0, class: "amount-input", step: "any", min: "1" %>
</div>
<div class="field">
<%= submit_tag "SUBMIT", class: "cta" %>
</div>
<% end %>
<br/>
<br/>
<br/>
<%= form_tag "/stripe_subscriptions/current_user", method: :delete, onsubmit: "return confirm('Are you absolutely sure you want to perform this action?');" do %>
<div>Don't want to keep your membership?</div>
<button class="billing-item-detail billing-item-red">Cancel Membership</button>
<% end %>