Add Danbooru Winter Sale.
This commit is contained in:
@@ -151,8 +151,14 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
time_tag(text, time, class: klass)
|
time_tag(text, time, class: klass)
|
||||||
else
|
elsif time.future?
|
||||||
time_tag("in " + distance_of_time_in_words(Time.now, time), time)
|
if compact
|
||||||
|
text = distance_of_time_in_words(Time.now, time)
|
||||||
|
text = text.gsub(/almost|about|over/, "").gsub(/less than a/, "<1").strip
|
||||||
|
time_tag(text, time)
|
||||||
|
else
|
||||||
|
time_tag("in " + distance_of_time_in_words(Time.now, time), time)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,13 @@ $(function() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#hide-promotion-notice").on("click.danbooru", function(e) {
|
||||||
|
$("#promotion-notice").hide();
|
||||||
|
Cookie.put("hide_promotion_notice", "1", 1 * 18 * 60 * 60);
|
||||||
|
Cookie.put("hide_upgrade_account_notice", "1", 7 * 24 * 60 * 60);
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
$("#hide-dmail-notice").on("click.danbooru", function(e) {
|
$("#hide-dmail-notice").on("click.danbooru", function(e) {
|
||||||
var $dmail_notice = $("#dmail-notice");
|
var $dmail_notice = $("#dmail-notice");
|
||||||
$dmail_notice.hide();
|
$dmail_notice.hide();
|
||||||
|
|||||||
@@ -437,7 +437,9 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tag_query_limit(level)
|
def tag_query_limit(level)
|
||||||
if level >= User::Levels::BUILDER
|
if level >= User::Levels::MEMBER && Danbooru.config.is_promotion?
|
||||||
|
Float::INFINITY
|
||||||
|
elsif level >= User::Levels::BUILDER
|
||||||
Float::INFINITY
|
Float::INFINITY
|
||||||
elsif level == User::Levels::PLATINUM
|
elsif level == User::Levels::PLATINUM
|
||||||
12
|
12
|
||||||
|
|||||||
@@ -37,7 +37,11 @@ class UserUpgrade < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.gold_price
|
def self.gold_price
|
||||||
2000
|
if Danbooru.config.is_promotion?
|
||||||
|
1500
|
||||||
|
else
|
||||||
|
2000
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.platinum_price
|
def self.platinum_price
|
||||||
@@ -161,6 +165,9 @@ class UserUpgrade < ApplicationRecord
|
|||||||
price: price_id,
|
price: price_id,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
}],
|
}],
|
||||||
|
discounts: [{
|
||||||
|
coupon: promotion_discount_id,
|
||||||
|
}],
|
||||||
metadata: {
|
metadata: {
|
||||||
user_upgrade_id: id,
|
user_upgrade_id: id,
|
||||||
purchaser_id: purchaser.id,
|
purchaser_id: purchaser.id,
|
||||||
@@ -218,6 +225,12 @@ class UserUpgrade < ApplicationRecord
|
|||||||
!pending?
|
!pending?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def promotion_discount_id
|
||||||
|
if Danbooru.config.is_promotion?
|
||||||
|
Danbooru.config.stripe_promotion_discount_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def upgrade_price_id(currency)
|
def upgrade_price_id(currency)
|
||||||
case [upgrade_type, currency]
|
case [upgrade_type, currency]
|
||||||
when ["gold", "usd"]
|
when ["gold", "usd"]
|
||||||
|
|||||||
@@ -80,7 +80,20 @@
|
|||||||
<div id="page">
|
<div id="page">
|
||||||
<%= render "users/verification_notice" %>
|
<%= render "users/verification_notice" %>
|
||||||
|
|
||||||
<% if !CurrentUser.is_anonymous? && !CurrentUser.is_gold? && !CurrentUser.user.is_banned? && cookies[:hide_upgrade_account_notice].blank? && params[:action] != "upgrade_information" %>
|
<% if Danbooru.config.is_promotion? && cookies[:hide_promotion_notice].blank? %>
|
||||||
|
<div class="notice notice-info notice-small flex text-center items-center justify-center gap-2" id="promotion-notice">
|
||||||
|
<% file = %w[provgift.png kemogift.png padoru.gif ablobgift.gif].sample %>
|
||||||
|
<%= tag.img src: "/images/#{file}", width: 32, height: 32 %>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<%= link_to "Danbooru Winter Sale", forum_topic_path(Danbooru.config.winter_sale_forum_topic_id) %> ends <%= time_ago_in_words_tagged(Danbooru.config.winter_sale_end_date) %>!
|
||||||
|
<br>
|
||||||
|
<%= link_to "Get 25% off Gold & Platinum", new_user_upgrade_path %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>(<%= link_to "hide", "#", id: "hide-promotion-notice" %>)</span>
|
||||||
|
</div>
|
||||||
|
<% elsif !CurrentUser.is_anonymous? && !CurrentUser.is_gold? && !CurrentUser.user.is_banned? && cookies[:hide_upgrade_account_notice].blank? && params[:action] != "upgrade_information" %>
|
||||||
<%= render "users/upgrade_notice" %>
|
<%= render "users/upgrade_notice" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,14 @@
|
|||||||
their profile page and look for a "Gift Upgrade" link.</p>
|
their profile page and look for a "Gift Upgrade" link.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if Danbooru.config.is_promotion? %>
|
||||||
|
<p>
|
||||||
|
<%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %>
|
||||||
|
<b>Danbooru Winter Sale! Gold and Platinum upgrades are 25% off. Sale ends <%= time_ago_in_words_tagged(Time.utc("2022-01-01")) %>.</b>
|
||||||
|
<%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<table id="feature-comparison" class="w-full text-center table-md mt-8 mb-8">
|
<table id="feature-comparison" class="w-full text-center table-md mt-8 mb-8">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -44,19 +52,25 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td>Free</td>
|
<td>Free</td>
|
||||||
<td>
|
<td>
|
||||||
|
<% if Danbooru.config.is_promotion? %>
|
||||||
|
<s>$20</s>
|
||||||
|
<% end %>
|
||||||
<%= cents_to_usd(UserUpgrade.gold_price) %>
|
<%= cents_to_usd(UserUpgrade.gold_price) %>
|
||||||
<div class="fineprint">One time fee</div>
|
<div class="fineprint">One time fee</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<% if Danbooru.config.is_promotion? %>
|
||||||
|
<s>$40</s>
|
||||||
|
<% end %>
|
||||||
<%= cents_to_usd(UserUpgrade.platinum_price) %>
|
<%= cents_to_usd(UserUpgrade.platinum_price) %>
|
||||||
<div class="fineprint">One time fee</div>
|
<div class="fineprint">One time fee</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Tag Limit</td>
|
<td>Tag Limit</td>
|
||||||
<td><%= User.tag_query_limit(User::Levels::MEMBER) %></td>
|
<td>2</td>
|
||||||
<td><%= User.tag_query_limit(User::Levels::GOLD) %></td>
|
<td>6</td>
|
||||||
<td><%= User.tag_query_limit(User::Levels::PLATINUM) %></td>
|
<td>12</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>See Hidden Tags</td>
|
<td>See Hidden Tags</td>
|
||||||
|
|||||||
@@ -516,6 +516,19 @@ module Danbooru
|
|||||||
# https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/new-relic-license-key/
|
# https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/new-relic-license-key/
|
||||||
def new_relic_license_key
|
def new_relic_license_key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# True if the Winter Sale is active.
|
||||||
|
def is_promotion?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
|
# The end date of the Winter Sale.
|
||||||
|
def winter_sale_end_date
|
||||||
|
end
|
||||||
|
|
||||||
|
# The forum topic linked to in the Winter Sale notice.
|
||||||
|
def winter_sale_forum_topic_id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
EnvironmentConfiguration = Struct.new(:config) do
|
EnvironmentConfiguration = Struct.new(:config) do
|
||||||
|
|||||||
BIN
public/images/blobgift.png
Normal file
BIN
public/images/blobgift.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
public/images/kemogift.png
Normal file
BIN
public/images/kemogift.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/padoru.gif
Normal file
BIN
public/images/padoru.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
public/images/provgift.png
Normal file
BIN
public/images/provgift.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user