Skip to content

Instantly share code, notes, and snippets.

@sartak
Created August 4, 2011 17:34
Show Gist options
  • Save sartak/1125716 to your computer and use it in GitHub Desktop.
Save sartak/1125716 to your computer and use it in GitHub Desktop.
commit 469d765235c1e3f3360ec37eef1df74a391d1b5f
Author: Shawn M Moore <[email protected]>
Date: Thu Aug 4 12:24:44 2011 -0400
First pass at wishlist support under donations
diff --git a/root/account/profile.html b/root/account/profile.html
index 536c1c1..93f9f37 100644
--- a/root/account/profile.html
+++ b/root/account/profile.html
@@ -42,12 +42,16 @@
<label><span>Feed</span><input type="text" name="blog.feed" value="<% author.blog.0.feed %>" /></label>
<label><span>Avatar</span><input type="text" name="gravatar_url" value="<% author.gravatar_url %>" /></label>
<%- donation = author.donation.0.id %>
- <label><input name="donations" type="checkbox"<% IF donation %> checked="checked"<% END %> onchange="$('.paypal').slideToggle()" /> Accept donations</label>
- <label class="paypal"<% UNLESS donation %> style="display: none"<% END %>>
- <span>PayPal</span>
- <input type="hidden" name="donation.name" value="paypal" />
- <input type="text" name="donation.id" value="<% donation %>" />
- </label>
+ <label><input name="donations" type="checkbox"<% IF donation %> checked="checked"<% END %> onchange="$('#donations').slideToggle()" /> Accept donations</label>
+ <div id="donations"<% UNLESS donation %> style="display: none"<% END %>>
+ <% FOREACH system IN ['PayPal', 'Wishlist']; found = author.donation.grep(->(a){ a.id == system.lower }) %>
+ <label class="<% system.lower %>">
+ <span><% lower %></span>
+ <input type="hidden" name="donation.name" value="<% system.lower %>" />
+ <input type="text" name="donation.id"<% IF found.size %> value="<% found.0.name %>"<% END %> />
+ </label>
+ <% END %>
+ </div>
<label><span>Last update</span><strong class="relatize"><% author.updated.dt_http %></strong></label>
</fieldset>
diff --git a/root/author.html b/root/author.html
index ec679fc..e63d951 100644
--- a/root/author.html
+++ b/root/author.html
@@ -32,7 +32,8 @@ IF profiles.${profile.name} %>
<% IF blog.feed %><a href="<% blog.feed %>" target="_blank"><img src="/static/images/profile/feed.png" width=16 height=16 style="float: right"></a><% END %>
<a href="<% blog.url %>" title="<% blog.url %>" target="_blank" class="ellipsis" style="width: 140px"><% blog.url.replace('^https?://', '') %></a>
<% END; END %>
-<% IF author.donation.size; FOREACH donate IN author.donation; IF donate.name == 'paypal' %>
+<% IF author.donation.size; FOREACH donate IN author.donation %>
+<% IF donate.name == 'paypal' %>
<br>
<center><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_donations">
@@ -45,6 +46,8 @@ IF profiles.${profile.name} %>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form></center>
+<% ELSIF donate.name == 'wishlist' %>
+<a rel="me" href="<% donate.id %>" target="_blank">Wishlist</a><br>
<% END; END; END %>
<%
i = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment