1
0
Fork 0
forked from OpenNeo/impress

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!
This commit is contained in:
Emi Matchu 2023-08-06 17:33:57 -07:00
parent d65aafdd4c
commit 83bbb84382
9 changed files with 15 additions and 15 deletions

View file

@ -124,10 +124,10 @@ ul.buttons
padding: .25em .5em padding: .25em .5em
text-align: center text-align: center
.success, .alert, .warning .notice, .alert, .warning
+flash +flash
.success .notice
+notice +notice
.alert .alert

View file

@ -9,7 +9,7 @@ class ClosetHangersController < ApplicationController
@closet_list.hangers.destroy_all @closet_list.hangers.destroy_all
respond_to do |format| respond_to do |format|
format.html { 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)) redirect_back!(user_closet_hangers_path(current_user))
} }
@ -149,7 +149,7 @@ class ClosetHangersController < ApplicationController
ClosetHanger.set_quantity!(quantity, :user_id => @user.id, ClosetHanger.set_quantity!(quantity, :user_id => @user.id,
:item_id => @item.id, :key => key) :item_id => @item.id, :key => key)
end end
flash[:success] = t('closet_hangers.update_quantities.success', flash[:notice] = t('closet_hangers.update_quantities.success',
:item_name => @item.name) :item_name => @item.name)
end end
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
@ -169,7 +169,7 @@ class ClosetHangersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { format.html {
ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' 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) :item_name => @item.name)
redirect_back!(@item) redirect_back!(@item)
} }
@ -197,12 +197,12 @@ class ClosetHangersController < ApplicationController
format.html { format.html {
ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted'
if @closet_hanger.list 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, :item_name => @item.name,
:list_name => @closet_hanger.list.name, :list_name => @closet_hanger.list.name,
:count => @closet_hanger.quantity) :count => @closet_hanger.quantity)
else 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, :item_name => @item.name,
:count => @closet_hanger.quantity) :count => @closet_hanger.quantity)
end end

View file

@ -14,7 +14,7 @@ class ClosetListsController < ApplicationController
def destroy def destroy
@closet_list.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) redirect_to user_closet_hangers_path(current_user)
end end
@ -48,7 +48,7 @@ class ClosetListsController < ApplicationController
end end
def save_successful! 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) redirect_to user_closet_hangers_path(current_user)
end end
end end

View file

@ -42,7 +42,7 @@ class DonationsController < ApplicationController
flash[:alert] = "Couldn't save donation details. Do those outfits exist?" flash[:alert] = "Couldn't save donation details. Do those outfits exist?"
redirect_to @donation redirect_to @donation
else else
flash[:success] = 'Donation details saved! ' + flash[:notice] = 'Donation details saved! ' +
'Also, have we thanked you yet today? Thank you!' 'Also, have we thanked you yet today? Thank you!'
redirect_to @donation redirect_to @donation
end end

View file

@ -56,7 +56,7 @@ class NeopetsPageImportTasksController < ApplicationController
expected_index: neopets_page.index + 1, list_id: @import_task.list_id) expected_index: neopets_page.index + 1, list_id: @import_task.list_id)
end end
flash[:success] = messages.join(' ') flash[:notice] = messages.join(' ')
redirect_to destination redirect_to destination
end end

View file

@ -13,7 +13,7 @@ class NeopetsUsersController < ApplicationController
@neopets_user.load! @neopets_user.load!
@neopets_user.save_hangers! @neopets_user.save_hangers!
flash[:success] = t('neopets_users.create.success', flash[:notice] = t('neopets_users.create.success',
:user_name => @neopets_user.username, :user_name => @neopets_user.username,
:count => @neopets_user.hangers.size) :count => @neopets_user.hangers.size)
redirect_to user_closet_hangers_path(current_user) redirect_to user_closet_hangers_path(current_user)

View file

@ -32,7 +32,7 @@ class OutfitsController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { format.html {
flash[:success] = t('outfits.destroy.success', flash[:notice] = t('outfits.destroy.success',
:outfit_name => @outfit.name) :outfit_name => @outfit.name)
redirect_to current_user_outfits_path redirect_to current_user_outfits_path
} }

View file

@ -22,7 +22,7 @@ class UsersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { format.html {
if success if success
flash[:success] = t('users.update.success') flash[:notice] = t('users.update.success')
redirect_back! user_closet_hangers_path(@user) redirect_back! user_closet_hangers_path(@user)
else else
flash[:alert] = t('users.update.invalid', flash[:alert] = t('users.update.invalid',

View file

@ -125,7 +125,7 @@
- localized_cache :action_suffix => 'templates' do - localized_cache :action_suffix => 'templates' do
%script#pet-query-notice-template{:type => 'text/x-jquery-tmpl'} %script#pet-query-notice-template{:type => 'text/x-jquery-tmpl'}
.success .notice
%img.inline-image{:src => '${pet_image_url}'} %img.inline-image{:src => '${pet_image_url}'}
= t '.pet_query.notice_html', :pet_name => '${pet_name}' = t '.pet_query.notice_html', :pet_name => '${pet_name}'