Compare commits
5 commits
bb83f6fd36
...
23c083ff1d
Author | SHA1 | Date | |
---|---|---|---|
23c083ff1d | |||
6b7c73870a | |||
e7a0ff1234 | |||
50c9ba53e7 | |||
89c729ecbe |
6 changed files with 24 additions and 36 deletions
|
@ -63,7 +63,7 @@ class AltStylesController < ApplicationController
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def alt_style_params
|
def alt_style_params
|
||||||
params.require(:alt_style).permit(:series_name, :thumbnail_url)
|
params.require(:alt_style).permit(:real_series_name, :thumbnail_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_color
|
def find_color
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module OutfitsHelper
|
module OutfitsHelper
|
||||||
LAST_DAY_OF_ANNOUNCEMENT = Date.parse("2024-10-10")
|
LAST_DAY_OF_ANNOUNCEMENT = Date.parse("2024-10-21")
|
||||||
def show_announcement?
|
def show_announcement?
|
||||||
Date.today <= LAST_DAY_OF_ANNOUNCEMENT
|
Date.today <= LAST_DAY_OF_ANNOUNCEMENT
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class AltStyle < ApplicationRecord
|
||||||
belongs_to :species
|
belongs_to :species
|
||||||
belongs_to :color
|
belongs_to :color
|
||||||
|
|
||||||
has_many :parent_swf_asset_relationships, as: :parent
|
has_many :parent_swf_asset_relationships, as: :parent, dependent: :destroy
|
||||||
has_many :swf_assets, through: :parent_swf_asset_relationships
|
has_many :swf_assets, through: :parent_swf_asset_relationships
|
||||||
has_many :contributions, as: :contributed, inverse_of: :contributed
|
has_many :contributions, as: :contributed, inverse_of: :contributed
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ class AltStyle < ApplicationRecord
|
||||||
validates :series_name, presence: true, allow_nil: true
|
validates :series_name, presence: true, allow_nil: true
|
||||||
validates :thumbnail_url, presence: true
|
validates :thumbnail_url, presence: true
|
||||||
|
|
||||||
before_create :infer_series_name
|
before_validation :infer_thumbnail_url, unless: :thumbnail_url?
|
||||||
before_create :infer_thumbnail_url
|
|
||||||
|
|
||||||
scope :matching_name, ->(series_name, color_name, species_name) {
|
scope :matching_name, ->(series_name, color_name, species_name) {
|
||||||
color = Color.find_by_name!(color_name)
|
color = Color.find_by_name!(color_name)
|
||||||
|
@ -36,13 +35,21 @@ class AltStyle < ApplicationRecord
|
||||||
# `fits:<New?>-faerie-draik` intentionally will not work, and the canonical
|
# `fits:<New?>-faerie-draik` intentionally will not work, and the canonical
|
||||||
# filter name will be `fits:alt-style-IDNUMBER`, instead.
|
# filter name will be `fits:alt-style-IDNUMBER`, instead.
|
||||||
def series_name
|
def series_name
|
||||||
self[:series_name] || "<New?>"
|
real_series_name || "<New?>"
|
||||||
|
end
|
||||||
|
|
||||||
|
def real_series_name=(new_series_name)
|
||||||
|
self[:series_name] = new_series_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def real_series_name
|
||||||
|
self[:series_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
# You can use this to check whether `series_name` is returning the actual
|
# You can use this to check whether `series_name` is returning the actual
|
||||||
# value or its placeholder value.
|
# value or its placeholder value.
|
||||||
def has_real_series_name?
|
def real_series_name?
|
||||||
self[:series_name].present?
|
real_series_name.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def adjective_name
|
def adjective_name
|
||||||
|
@ -74,19 +81,6 @@ class AltStyle < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Until the end of 2024, assume new alt styles are from the "Nostalgic"
|
|
||||||
# series. That way, we can stop having to manually label them all as they
|
|
||||||
# come out and get modeled (TNT is prolific rn!), but we aren't gonna get too
|
|
||||||
# greedy and forget about this and use Nostalgic for some far-future thing,
|
|
||||||
# in ways that will certainly be fixable but would also be confusing and
|
|
||||||
# embarrassing.
|
|
||||||
NOSTALGIC_FINAL_DAY = Date.new(2024, 12, 31)
|
|
||||||
def infer_series_name
|
|
||||||
if !has_real_series_name? && Date.today <= NOSTALGIC_FINAL_DAY
|
|
||||||
self.series_name = "Nostalgic"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# At time of writing, most batches of Alt Styles thumbnails used a simple
|
# At time of writing, most batches of Alt Styles thumbnails used a simple
|
||||||
# pattern for the item thumbnail URL, but that's not always the case anymore.
|
# pattern for the item thumbnail URL, but that's not always the case anymore.
|
||||||
# For now, let's keep using this format as the default value when creating a
|
# For now, let's keep using this format as the default value when creating a
|
||||||
|
|
|
@ -367,7 +367,7 @@ class Item
|
||||||
# If the real series name has been set in the database by support
|
# If the real series name has been set in the database by support
|
||||||
# staff, use that for the canonical filter text for this alt style.
|
# staff, use that for the canonical filter text for this alt style.
|
||||||
# Otherwise, represent this alt style by ID.
|
# Otherwise, represent this alt style by ID.
|
||||||
if alt_style.has_real_series_name?
|
if alt_style.real_series_name?
|
||||||
series_name = alt_style.series_name.downcase
|
series_name = alt_style.series_name.downcase
|
||||||
color_name = alt_style.color.name.downcase
|
color_name = alt_style.color.name.downcase
|
||||||
species_name = alt_style.species.name.downcase
|
species_name = alt_style.species.name.downcase
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
- @alt_style.errors.each do |error|
|
- @alt_style.errors.each do |error|
|
||||||
%li= error.full_message
|
%li= error.full_message
|
||||||
%fieldset
|
%fieldset
|
||||||
= f.label :series_name, "Series"
|
= f.label :real_series_name, "Series"
|
||||||
= f.text_field :series_name
|
= f.text_field :real_series_name
|
||||||
= f.label :thumbnail_url, "Thumbnail"
|
= f.label :thumbnail_url, "Thumbnail"
|
||||||
.thumbnail-field
|
.thumbnail-field
|
||||||
- if @alt_style.thumbnail_url?
|
- if @alt_style.thumbnail_url?
|
||||||
|
|
|
@ -11,19 +11,13 @@
|
||||||
.content
|
.content
|
||||||
%p
|
%p
|
||||||
%strong
|
%strong
|
||||||
= link_to "This week in DTI: Performance upgrades!",
|
🎃
|
||||||
"https://blog.openneo.net/2024/10/03/perf-upgrades.html"
|
= link_to "New pet styles are out today!", alt_styles_path
|
||||||
If you saw the site stutter, whoops, you weren't imagining it! We've
|
If you've seen one we don't have yet, please model it by entering the
|
||||||
dug into our past and made three changes to speed up the site for
|
pet's name in the box below. Thank you!!
|
||||||
everyone, whew!
|
|
||||||
%p
|
%p
|
||||||
Also, in case you can help:
|
By the way, we had a bug where modeling new styles wasn't working for a
|
||||||
= succeed "," do
|
little while. Fixed now! 🤞
|
||||||
= link_to "I'm job-hunting right now",
|
|
||||||
"https://blog.openneo.net/2024/10/03/perf-upgrades.html#job-hunting"
|
|
||||||
looking for
|
|
||||||
full-time software roles!
|
|
||||||
%em (You gotta ask, right?)
|
|
||||||
|
|
||||||
#outfit-forms
|
#outfit-forms
|
||||||
#pet-preview
|
#pet-preview
|
||||||
|
|
Loading…
Reference in a new issue