From 66438eae1ae5dbcc07667ba1bd18908ae3ecdb03 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 22 Oct 2024 16:39:25 -0700 Subject: [PATCH 1/4] Add mode to keep labeled alt styles until they're all labeled If you check this box, it'll keep you in a mode where saving an alt style redirects you to the *next* one that needs labeling, until they're all done. Useful for big drops! --- app/assets/stylesheets/alt_styles/edit.sass | 20 ++++++++++++++++---- app/controllers/alt_styles_controller.rb | 19 ++++++++++++++++++- app/models/alt_style.rb | 2 ++ app/views/alt_styles/edit.html.haml | 7 ++++++- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/alt_styles/edit.sass b/app/assets/stylesheets/alt_styles/edit.sass index 0a138cf2..d1398948 100644 --- a/app/assets/stylesheets/alt_styles/edit.sass +++ b/app/assets/stylesheets/alt_styles/edit.sass @@ -21,11 +21,11 @@ max-width: 100% box-sizing: border-box - input[type=url] - font-size: .85em + input[type=url] + font-size: .85em - label - font-weight: bold + label + font-weight: bold .thumbnail-field display: flex @@ -41,3 +41,15 @@ .field_with_errors display: contents + + .actions + display: flex + align-items: center + gap: 1em + + label + display: flex + align-items: center + gap: .25em + font-size: .85em + font-style: italic diff --git a/app/controllers/alt_styles_controller.rb b/app/controllers/alt_styles_controller.rb index 93a10c46..7f51d7a6 100644 --- a/app/controllers/alt_styles_controller.rb +++ b/app/controllers/alt_styles_controller.rb @@ -54,7 +54,7 @@ class AltStylesController < ApplicationController if @alt_style.update(alt_style_params) flash[:notice] = "\"#{@alt_style.full_name}\" successfully saved!" - redirect_to alt_styles_path + redirect_to destination_after_save else render action: :edit, status: :bad_request end @@ -79,4 +79,21 @@ class AltStylesController < ApplicationController Species.find_by(name: params[:species]) end end + + def destination_after_save + if params[:next] == "unlabeled-style" + next_unlabeled_style_path + else + alt_styles_path + end + end + + def next_unlabeled_style_path + unlabeled_style = AltStyle.unlabeled.newest.first + if unlabeled_style + edit_alt_style_path(unlabeled_style, next: "unlabeled-style") + else + alt_styles_path + end + end end diff --git a/app/models/alt_style.rb b/app/models/alt_style.rb index fd52912e..0e9a47bf 100644 --- a/app/models/alt_style.rb +++ b/app/models/alt_style.rb @@ -22,6 +22,8 @@ class AltStyle < ApplicationRecord scope :by_creation_date, -> { order("DATE(created_at) DESC") } + scope :unlabeled, -> { where(series_name: nil) } + scope :newest, -> { order(created_at: :desc) } def pet_name I18n.translate('pet_types.human_name', color_human_name: color.human_name, diff --git a/app/views/alt_styles/edit.html.haml b/app/views/alt_styles/edit.html.haml index 0b061bde..abe67336 100644 --- a/app/views/alt_styles/edit.html.haml +++ b/app/views/alt_styles/edit.html.haml @@ -28,7 +28,12 @@ - if @alt_style.thumbnail_url? = image_tag @alt_style.thumbnail_url = f.url_field :thumbnail_url - = f.submit "Save changes" + .actions + = f.submit "Save changes" + %label{title: "If checked, takes you to the next unlabeled pet style, if any. Useful for labeling in bulk!"} + = check_box_tag "next", "unlabeled-style", + checked: params[:next] == "unlabeled-style" + Then: Go to unlabeled style - content_for :stylesheets do = stylesheet_link_tag "application/breadcrumbs" From 29aa769bda6ee9b02b9a1befe71db160eb56911b Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 22 Oct 2024 16:44:42 -0700 Subject: [PATCH 2/4] Oops, tiny copy edit for alt styles page Right, missed this when renaming them, lol! --- app/views/alt_styles/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/alt_styles/index.html.haml b/app/views/alt_styles/index.html.haml index 25605bf8..621ab62d 100644 --- a/app/views/alt_styles/index.html.haml +++ b/app/views/alt_styles/index.html.haml @@ -17,7 +17,7 @@ Only some items fit pets wearing Pet Styles: mostly Backgrounds, Foregrounds, and other items that aren't designed to fit a specific body shape. - If you have an Pet Style we don't, please model it by entering your pet's + If you have a Pet Style we don't, please model it by entering your pet's name on the homepage! Thank you! 💖 [1]: https://www.neopets.com/mall/stylingstudio/ From 930bfca0283eaf97c5d6d48184d3aaa9f7e63419 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 22 Oct 2024 16:46:55 -0700 Subject: [PATCH 3/4] Add creation date to alt styles listings Copied from how pet types do it! --- app/views/alt_styles/_alt_style.html.haml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/alt_styles/_alt_style.html.haml b/app/views/alt_styles/_alt_style.html.haml index e17e2be6..9be4b858 100644 --- a/app/views/alt_styles/_alt_style.html.haml +++ b/app/views/alt_styles/_alt_style.html.haml @@ -3,4 +3,10 @@ = image_tag alt_style.preview_image_url, class: "preview", loading: "lazy" .name %span= alt_style.series_name - %span= alt_style.pet_name \ No newline at end of file + %span= alt_style.pet_name + .info + %p + Added + = time_tag alt_style.created_at, + title: alt_style.created_at.to_formatted_s(:long_nst) do + = time_with_only_month_if_old alt_style.created_at \ No newline at end of file From c78d45a0b5de18dc1f4f319c6ccefb8a5617de93 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 22 Oct 2024 16:48:37 -0700 Subject: [PATCH 4/4] Copy edit on pet styles The NC Pet Styles sentence getting broken across two lines I think makes it too hard to notice. Design-wise, it would be nice to just call better attention to this feature altogether in some higher-level design-language-y way, but! Whatever! --- app/views/pet_types/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pet_types/index.html.haml b/app/views/pet_types/index.html.haml index 5f36524a..e9c48af6 100644 --- a/app/views/pet_types/index.html.haml +++ b/app/views/pet_types/index.html.haml @@ -3,7 +3,7 @@ :markdown Welcome, welcome! These are all the colors and species of pet we've seen - before. You can also check out our [NC Pet Styles][1] listings, too! + before. We have [NC Pet Styles][1], too! If you've seen a new kind of pet, you can enter its name on the homepage to show us! Thank you so much 💖