Compare commits
No commits in common. "23c083ff1d0056b3c56e42795823db468039c615" and "bb83f6fd36feec1e9e409892d7af093f3b5270f4" have entirely different histories.
23c083ff1d
...
bb83f6fd36
6 changed files with 36 additions and 24 deletions
|
@ -63,7 +63,7 @@ class AltStylesController < ApplicationController
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def alt_style_params
|
def alt_style_params
|
||||||
params.require(:alt_style).permit(:real_series_name, :thumbnail_url)
|
params.require(:alt_style).permit(: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-21")
|
LAST_DAY_OF_ANNOUNCEMENT = Date.parse("2024-10-10")
|
||||||
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, dependent: :destroy
|
has_many :parent_swf_asset_relationships, as: :parent
|
||||||
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,7 +12,8 @@ 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_validation :infer_thumbnail_url, unless: :thumbnail_url?
|
before_create :infer_series_name
|
||||||
|
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)
|
||||||
|
@ -35,21 +36,13 @@ 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
|
||||||
real_series_name || "<New?>"
|
self[: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 real_series_name?
|
def has_real_series_name?
|
||||||
real_series_name.present?
|
self[:series_name].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def adjective_name
|
def adjective_name
|
||||||
|
@ -81,6 +74,19 @@ 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.real_series_name?
|
if alt_style.has_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 :real_series_name, "Series"
|
= f.label :series_name, "Series"
|
||||||
= f.text_field :real_series_name
|
= f.text_field :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,13 +11,19 @@
|
||||||
.content
|
.content
|
||||||
%p
|
%p
|
||||||
%strong
|
%strong
|
||||||
🎃
|
= link_to "This week in DTI: Performance upgrades!",
|
||||||
= link_to "New pet styles are out today!", alt_styles_path
|
"https://blog.openneo.net/2024/10/03/perf-upgrades.html"
|
||||||
If you've seen one we don't have yet, please model it by entering the
|
If you saw the site stutter, whoops, you weren't imagining it! We've
|
||||||
pet's name in the box below. Thank you!!
|
dug into our past and made three changes to speed up the site for
|
||||||
|
everyone, whew!
|
||||||
%p
|
%p
|
||||||
By the way, we had a bug where modeling new styles wasn't working for a
|
Also, in case you can help:
|
||||||
little while. Fixed now! 🤞
|
= succeed "," do
|
||||||
|
= 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