Add Danbooru Winter Sale.

This commit is contained in:
evazion
2020-12-25 05:46:04 -06:00
parent ae49ed2b1a
commit fd18291382
11 changed files with 50 additions and 2 deletions

View File

@@ -7,6 +7,13 @@ $(function() {
e.preventDefault();
});
$("#hide-promotion-notice").on("click.danbooru", function(e) {
$("#promotion-notice").hide();
Cookie.put("hide_promotion_notice", "1", 1);
Cookie.put("hide_upgrade_account_notice", "1", 1);
e.preventDefault();
});
$("#hide-dmail-notice").on("click.danbooru", function(e) {
var $dmail_notice = $("#dmail-notice");
$dmail_notice.hide();

View File

@@ -404,7 +404,9 @@ class User < ApplicationRecord
end
def tag_query_limit
if is_platinum?
if is_member? && Danbooru.config.is_promotion?
1_000_000
elsif is_platinum?
Danbooru.config.base_tag_query_limit * 2
elsif is_gold?
Danbooru.config.base_tag_query_limit

View File

@@ -34,7 +34,11 @@ class UserUpgrade < ApplicationRecord
end
def self.gold_price
2000
if Danbooru.config.is_promotion?
1500
else
2000
end
end
def self.platinum_price

View File

@@ -70,6 +70,25 @@
<div id="page">
<%= render "users/verification_notice" %>
<% if Danbooru.config.is_promotion? && cookies[:hide_promotion_notice].blank? %>
<div class="notice notice-info notice-large" id="promotion-notice">
<% if rand <= 0.0025 %>
<%= tag.img src: "/images/provgift.png", width: 24, height: 24 %>
<% elsif rand <= 0.0025 %>
<%= tag.img src: "/images/kemogift.png", width: 24, height: 24 %>
<% elsif rand <= 0.0025 %>
<%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %>
<% elsif rand <= 0.0025 %>
<%= tag.img src: "/images/ablobgift.gif", width: 24, height: 24 %>
<% else %>
<%= tag.img src: "/images/blobgift.png", width: 24, height: 24 %>
<% end %>
<%= link_to "Danbooru Winter Sale!", forum_topic_path(17832) %> 25% off Gold and unlimited searches for Members!
(<%= link_to "hide", "#", id: "hide-promotion-notice" %>)
</div>
<% end %>
<% if !CurrentUser.is_anonymous? && !CurrentUser.is_gold? && cookies[:hide_upgrade_account_notice].blank? && params[:action] != "upgrade_information" %>
<%= render "users/upgrade_notice" %>
<% end %>

View File

@@ -18,6 +18,10 @@
<% else %>
<h1>Upgrade Account</h1>
<% if Danbooru.config.is_promotion? %>
<p><b>Danbooru Winter Sale! Gold and Platinum upgrades are 25% off from now until January 1st.</b></p>
<% end %>
<p>Upgrading your account gives you exclusive benefits and helps support
<%= Danbooru.config.canonical_app_name %>. Your support helps keep the
site ad-free for everyone!</p>
@@ -44,10 +48,16 @@
<td></td>
<td>Free</td>
<td>
<% if Danbooru.config.is_promotion? %>
<s>$20</s>
<% end %>
<%= cents_to_usd(UserUpgrade.gold_price) %>
<div class="fineprint">One time fee</div>
</td>
<td>
<% if Danbooru.config.is_promotion? %>
<s>$40</s>
<% end %>
<%= cents_to_usd(UserUpgrade.platinum_price) %>
<div class="fineprint">One time fee</div>
</td>

View File

@@ -494,6 +494,12 @@ module Danbooru
def redis_url
"redis://localhost:6379"
end
def is_promotion?
Time.use_zone("UTC") do
Time.zone.now < Time.zone.parse("2021-01-01")
end
end
end
EnvironmentConfiguration = Struct.new(:config) do

BIN
public/images/ablobgift.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
public/images/blobgift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/images/kemogift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
public/images/padoru.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
public/images/provgift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB