allow gift upgrades for accounts

This commit is contained in:
r888888888
2014-12-10 10:21:10 -08:00
parent a6c389a281
commit cb1be62577
4 changed files with 111 additions and 88 deletions

View File

@@ -1,8 +1,14 @@
<p>You can pay with Bitcoin. You will pay either $20 USD or $40 USD equivalent in Bitcoin. Danbooru uses <a href="https://www.coinbase.com">Coinbase</a> as a payment intermediary so none of your personal information will be stored on the site.</p>
<% if CurrentUser.user.level < User::Levels::GOLD %>
<% if params[:user_id] %>
<p>You are gifting this account upgrade to <%= link_to user.pretty_name, user_path(params[:user_id]) %>.</p>
<% else %>
<p>You can also upgrade someone else's account for the same price. The easiest way is to go to their profile page and look for a "Gift Upgrade" link.</p>
<% end %>
<% if user.level < User::Levels::GOLD %>
<%= raw coinbase.create_button("Upgrade to Gold", 20.to_money("USD"), "Upgrade your Basic Account to a Gold Account", encrypt_custom(User::Levels::GOLD), :button => {:style => "custom_small", :text => "Upgrade to Gold", :callback_url => user_upgrade_path(:only_path => false, :host => Danbooru.config.hostname, :protocol => "https")}).embed_html %>
<%= raw coinbase.create_button("Upgrade to Platinum", 40.to_money("USD"), "Upgrade your Basic Account to a Platinum Account", encrypt_custom(User::Levels::PLATINUM), :button => {:style => "custom_small", :text => "Upgrade to Platinum", :callback_url => user_upgrade_path(:only_path => false, :host => Danbooru.config.hostname, :protocol => "https")}).embed_html %>
<% elsif CurrentUser.level < User::Levels::PLATINUM %>
<% elsif user.level < User::Levels::PLATINUM %>
<%= raw coinbase.create_button("Upgrade to Platinum", 20.to_money("USD"), "Upgrade your Gold Account to a Platinum Account", encrypt_custom(User::Levels::PLATINUM), :button => {:style => "custom_small", :text => "Upgrade to Platinum", :callback_url => user_upgrade_path(:only_path => false, :host => Danbooru.config.hostname, :protocol => "https")}).embed_html %>
<% end %>

View File

@@ -1,87 +1,89 @@
<div id="c-users">
<div id="a-upgrade-information">
<h1>Upgrade Your Account</h1>
<h1>Upgrade Account</h1>
<p class="copy">Annoyed by ads? Want more searching power? Upgrade your account and become a power user of the best database of anime artwork on the internet.</p>
<% unless params[:user_id] %>
<p class="copy">Annoyed by ads? Want more searching power? Upgrade your account and become a power user of the best database of anime artwork on the internet.</p>
<div id="feature-comparison">
<table>
<thead>
<tr>
<th></th>
<th>Basic</th>
<th>Gold</th>
<th>Platinum</th>
</tr>
</thead>
<tbody>
<colgroup id="labels"></colgroup>
<colgroup id="basic"></colgroup>
<colgroup id="gold"></colgroup>
<colgroup id="platinum"></colgroup>
<tr>
<td>Cost</td>
<td>Free</td>
<td>$20<p class="cost-footnote">One time fee</p></td>
<td>$40<p class="cost-footnote">One time fee</p></td>
</tr>
<tr>
<td>Tag Limit</td>
<td>2</td>
<td>6</td>
<td>12</td>
</tr>
<tr>
<td>Favorite Limit</td>
<td>10,000</td>
<td>20,000</td>
<td>Unlimited</td>
</tr>
<tr>
<td>Page Limit</td>
<td>1,000</td>
<td>2,000</td>
<td>5,000</td>
</tr>
<tr>
<td>Tag Subscriptions</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>See Censored Tags</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>API Hourly Limit</td>
<td>3,000</td>
<td>10,000</td>
<td>20,000</td>
</tr>
<tr>
<td>Database Timeout</td>
<td>3 sec</td>
<td>6 sec</td>
<td>9 sec</td>
</tr>
<tr>
<td>Variable Posts Per Page</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Name Changes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
</tbody>
</table>
</div>
<div id="feature-comparison">
<table>
<thead>
<tr>
<th></th>
<th>Basic</th>
<th>Gold</th>
<th>Platinum</th>
</tr>
</thead>
<tbody>
<colgroup id="labels"></colgroup>
<colgroup id="basic"></colgroup>
<colgroup id="gold"></colgroup>
<colgroup id="platinum"></colgroup>
<tr>
<td>Cost</td>
<td>Free</td>
<td>$20<p class="cost-footnote">One time fee</p></td>
<td>$40<p class="cost-footnote">One time fee</p></td>
</tr>
<tr>
<td>Tag Limit</td>
<td>2</td>
<td>6</td>
<td>12</td>
</tr>
<tr>
<td>Favorite Limit</td>
<td>10,000</td>
<td>20,000</td>
<td>Unlimited</td>
</tr>
<tr>
<td>Page Limit</td>
<td>1,000</td>
<td>2,000</td>
<td>5,000</td>
</tr>
<tr>
<td>Tag Subscriptions</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>See Censored Tags</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>API Hourly Limit</td>
<td>3,000</td>
<td>10,000</td>
<td>20,000</td>
</tr>
<tr>
<td>Database Timeout</td>
<td>3 sec</td>
<td>6 sec</td>
<td>9 sec</td>
</tr>
<tr>
<td>Variable Posts Per Page</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Name Changes</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
</tbody>
</table>
</div>
<% end %>
<% if Danbooru.config.coinbase_api_key %>
<%= render "coinbase_payment" %>

View File

@@ -22,7 +22,11 @@
<% end %>
<% if CurrentUser.is_member? || CurrentUser.is_gold? %>
<li><%= link_to "Upgrade", new_user_upgrade_path %></li>
<% if @user.id == CurrentUser.user.id %>
<li><%= link_to "Upgrade", new_user_upgrade_path %></li>
<% else %>
<li><%= link_to "Gift Upgrade", new_user_upgrade_path(:user_id => @user.id) %></li>
<% end %>
<% end %>
<% if CurrentUser.is_moderator? %>