From 83bbb843823049a4b5d4e655e46ddc7270bf69b3 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 6 Aug 2023 17:33:57 -0700 Subject: [PATCH] Use flash[:notice] instead of flash[:success] This is a bit more standard, and has the bonus of being compatible with Devise, which is using `flash[:notice]` and so its flashes were coming out unstyled, oops! --- app/assets/stylesheets/_layout.sass | 4 ++-- app/controllers/closet_hangers_controller.rb | 10 +++++----- app/controllers/closet_lists_controller.rb | 4 ++-- app/controllers/donations_controller.rb | 2 +- .../neopets_page_import_tasks_controller.rb | 2 +- app/controllers/neopets_users_controller.rb | 2 +- app/controllers/outfits_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- app/views/outfits/new.html.haml | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass index 63c33f54..f21e6e82 100644 --- a/app/assets/stylesheets/_layout.sass +++ b/app/assets/stylesheets/_layout.sass @@ -124,10 +124,10 @@ ul.buttons padding: .25em .5em text-align: center -.success, .alert, .warning +.notice, .alert, .warning +flash -.success +.notice +notice .alert diff --git a/app/controllers/closet_hangers_controller.rb b/app/controllers/closet_hangers_controller.rb index 2e0445d4..71d70b8d 100644 --- a/app/controllers/closet_hangers_controller.rb +++ b/app/controllers/closet_hangers_controller.rb @@ -9,7 +9,7 @@ class ClosetHangersController < ApplicationController @closet_list.hangers.destroy_all respond_to do |format| format.html { - flash[:success] = t("closet_hangers.destroy_all.success") + flash[:notice] = t("closet_hangers.destroy_all.success") redirect_back!(user_closet_hangers_path(current_user)) } @@ -149,7 +149,7 @@ class ClosetHangersController < ApplicationController ClosetHanger.set_quantity!(quantity, :user_id => @user.id, :item_id => @item.id, :key => key) end - flash[:success] = t('closet_hangers.update_quantities.success', + flash[:notice] = t('closet_hangers.update_quantities.success', :item_name => @item.name) end rescue ActiveRecord::RecordInvalid => e @@ -169,7 +169,7 @@ class ClosetHangersController < ApplicationController respond_to do |format| format.html { ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' - flash[:success] = t("closet_hangers.destroy.success.#{ownership_key}", + flash[:notice] = t("closet_hangers.destroy.success.#{ownership_key}", :item_name => @item.name) redirect_back!(@item) } @@ -197,12 +197,12 @@ class ClosetHangersController < ApplicationController format.html { ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' if @closet_hanger.list - flash[:success] = t("closet_hangers.create.success.#{ownership_key}.in_list", + flash[:notice] = t("closet_hangers.create.success.#{ownership_key}.in_list", :item_name => @item.name, :list_name => @closet_hanger.list.name, :count => @closet_hanger.quantity) else - flash[:success] = t("closet_hangers.create.success.#{ownership_key}.unlisted", + flash[:notice] = t("closet_hangers.create.success.#{ownership_key}.unlisted", :item_name => @item.name, :count => @closet_hanger.quantity) end diff --git a/app/controllers/closet_lists_controller.rb b/app/controllers/closet_lists_controller.rb index 68c968ee..f633a19a 100644 --- a/app/controllers/closet_lists_controller.rb +++ b/app/controllers/closet_lists_controller.rb @@ -14,7 +14,7 @@ class ClosetListsController < ApplicationController def destroy @closet_list.destroy - flash[:success] = "Successfully deleted \"#{@closet_list.name}\"" + flash[:notice] = "Successfully deleted \"#{@closet_list.name}\"" redirect_to user_closet_hangers_path(current_user) end @@ -48,7 +48,7 @@ class ClosetListsController < ApplicationController end def save_successful! - flash[:success] = "Successfully saved \"#{@closet_list.name}\"" + flash[:notice] = "Successfully saved \"#{@closet_list.name}\"" redirect_to user_closet_hangers_path(current_user) end end diff --git a/app/controllers/donations_controller.rb b/app/controllers/donations_controller.rb index d12d4541..08892ec8 100644 --- a/app/controllers/donations_controller.rb +++ b/app/controllers/donations_controller.rb @@ -42,7 +42,7 @@ class DonationsController < ApplicationController flash[:alert] = "Couldn't save donation details. Do those outfits exist?" redirect_to @donation else - flash[:success] = 'Donation details saved! ' + + flash[:notice] = 'Donation details saved! ' + 'Also, have we thanked you yet today? Thank you!' redirect_to @donation end diff --git a/app/controllers/neopets_page_import_tasks_controller.rb b/app/controllers/neopets_page_import_tasks_controller.rb index f43e856a..afe63b15 100644 --- a/app/controllers/neopets_page_import_tasks_controller.rb +++ b/app/controllers/neopets_page_import_tasks_controller.rb @@ -56,7 +56,7 @@ class NeopetsPageImportTasksController < ApplicationController expected_index: neopets_page.index + 1, list_id: @import_task.list_id) end - flash[:success] = messages.join(' ') + flash[:notice] = messages.join(' ') redirect_to destination end diff --git a/app/controllers/neopets_users_controller.rb b/app/controllers/neopets_users_controller.rb index a8346eb1..e8e57f44 100644 --- a/app/controllers/neopets_users_controller.rb +++ b/app/controllers/neopets_users_controller.rb @@ -13,7 +13,7 @@ class NeopetsUsersController < ApplicationController @neopets_user.load! @neopets_user.save_hangers! - flash[:success] = t('neopets_users.create.success', + flash[:notice] = t('neopets_users.create.success', :user_name => @neopets_user.username, :count => @neopets_user.hangers.size) redirect_to user_closet_hangers_path(current_user) diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 91c6838a..f58f7ca1 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -32,7 +32,7 @@ class OutfitsController < ApplicationController respond_to do |format| format.html { - flash[:success] = t('outfits.destroy.success', + flash[:notice] = t('outfits.destroy.success', :outfit_name => @outfit.name) redirect_to current_user_outfits_path } diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 48d09e50..4854976c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -22,7 +22,7 @@ class UsersController < ApplicationController respond_to do |format| format.html { if success - flash[:success] = t('users.update.success') + flash[:notice] = t('users.update.success') redirect_back! user_closet_hangers_path(@user) else flash[:alert] = t('users.update.invalid', diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 722d9c09..8038dce2 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -125,7 +125,7 @@ - localized_cache :action_suffix => 'templates' do %script#pet-query-notice-template{:type => 'text/x-jquery-tmpl'} - .success + .notice %img.inline-image{:src => '${pet_image_url}'} = t '.pet_query.notice_html', :pet_name => '${pet_name}'