Merge pull request #2303 from r888888888/stripe

Stripe integration
This commit is contained in:
Albert Yi
2014-11-07 14:17:50 -08:00
25 changed files with 960 additions and 31 deletions

View File

@@ -0,0 +1,8 @@
<p><strong>Upgrading from Gold to Platinum will only cost $20.</strong> If you have any further questions or concerns, feel free to contact me at <%= mail_to Danbooru.config.contact_email, nil, :encode => :javascript %>.</p>
<% if CurrentUser.user.level < User::Levels::GOLD %>
<%= stripe_button("Upgrade to Gold", 2000) %>
<%= stripe_button("Upgrade to Platinum", 4000) %>
<% elsif CurrentUser.user.level < User::Levels::PLATINUM %>
<%= stripe_button("Upgrade Gold to Platinum", 2000) %>
<% end %>

View File

@@ -0,0 +1 @@
<p>You can upgrade your account at <%= link_to "Safebooru", new_user_upgrade_path(:protocol => "https", :host => "safebooru.donmai.us", :only_path => false), :target => "_blank" %>.</p>

View File

@@ -0,0 +1,98 @@
<div id="c-users">
<div id="a-upgrade-information">
<h1>Upgrade Your 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>
<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>
<% if CurrentUser.safe_mode? %>
<%= render "stripe_payment" %>
<% else %>
<%= render "unavailable_payment" %>
<% end %>
</div>
</div>
<%= render "users/secondary_links" %>
<% content_for(:page_title) do %>
Upgrade - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -0,0 +1,22 @@
<div id="c-users">
<div id="a-upgrade-result">
<% if flash[:disable] %>
<p>You can upgrade your account at <%= link_to "Safebooru", new_user_upgrade_path(:protocol => "https", :host => "safebooru.donmai.us", :only_path => false) %>.</p>
<% elsif flash[:success] %>
<h1>Congradulations!</h1>
<p>You are now a <%= CurrentUser.user.level_string %> level account. Thanks for supporting the site!</p>
<p><%= link_to "Return to posts", posts_path %> </p>
<% elsif flash[:error] %>
<h1>An error occurred!</h1>
<p><%= flash[:error] %></p>
<p><%= link_to "Try again", new_user_upgrade_path %></p>
<% end %>
</div>
</div>
<%= render "users/secondary_links" %>
<% content_for(:page_title) do %>
Upgrade - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -21,8 +21,8 @@
<li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
<% end %>
<% if !CurrentUser.is_gold? %>
<li><%= link_to "Upgrade", upgrade_information_users_path %></li>
<% if CurrentUser.is_member? || CurrentUser.is_gold? %>
<li><%= link_to "Upgrade", new_user_upgrade_path %></li>
<% end %>
<% if CurrentUser.is_moderator? %>

View File

@@ -1,4 +1,4 @@
<div class="ui-corner-all ui-state-highlight" id="upgrade-account-notice">
<h1><%= link_to "Upgrade your account for only $20!", upgrade_information_users_path %></h1>
<h1><%= link_to "Upgrade your account for only $20!", new_user_upgrade_path %></h1>
<p><%= link_to "No thanks", "#", :id => "hide-upgrade-account-notice" %></p>
</div>

View File

@@ -2,7 +2,94 @@
<div id="a-upgrade-information">
<h1>Upgrade Your Account</h1>
<p>Upgrades are currently not available.</p>
<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>
<p><strong>Upgrading from Gold to Platinum will only cost $20.</strong> If you have any further questions or concerns, feel free to contact me at <%= mail_to Danbooru.config.contact_email, nil, :encode => :javascript %>.</p>
<% if true || CurrentUser.user.level < User::Levels::GOLD %>
<%= stripe_button("Upgrade to Gold", 2000) %>
<%= stripe_button("Upgrade to Platinum", 4000) %>
<% elsif CurrentUser.user.level < User::Levels::PLATINUM %>
<%= stripe_button("Upgrade Gold to Platinum", 2000) %>
<% end %>
</div>
</div>