Show success messages as.. success.

This commit is contained in:
David Cook
2023-12-01 14:38:42 +11:00
parent 1cd9d9aafd
commit a2b8fb5105
2 changed files with 7 additions and 7 deletions

View File

@@ -48,7 +48,7 @@ module Admin
@order_cycle_form = OrderCycleForm.new(@order_cycle, order_cycle_params, spree_current_user)
if @order_cycle_form.save
flash[:notice] = t('.success')
flash[:success] = t('.success')
render json: { success: true,
edit_path: main_app.admin_order_cycle_incoming_path(@order_cycle) }
else
@@ -66,7 +66,7 @@ module Admin
if @order_cycle_form.save
update_nil_subscription_line_items_price_estimate(@order_cycle)
respond_to do |format|
flash[:notice] = t('.success') if params[:reloading] == '1'
flash[:success] = t('.success') if params[:reloading] == '1'
format.html { redirect_to_after_update_path }
format.json { render json: { success: true } }
end
@@ -118,7 +118,7 @@ module Admin
@order_cycle = OrderCycle.find params[:id]
@order_cycle.clone!
redirect_to main_app.admin_order_cycles_path,
notice: t('.success', name: @order_cycle.name)
flash: { success: t('.success', name: @order_cycle.name) }
end
# Send notifications to all producers who are part of the order cycle
@@ -126,7 +126,7 @@ module Admin
OrderCycleNotificationJob.perform_later params[:id].to_i
redirect_to main_app.admin_order_cycles_path,
notice: t('.success')
flash: { success: t('.success') }
end
protected

View File

@@ -252,14 +252,14 @@ module Admin
it "sets flash message" do
spree_put :update, params
expect(flash[:notice]).to eq('Your order cycle has been updated.')
expect(flash[:success]).to eq('Your order cycle has been updated.')
end
end
context "when the page is not reloading" do
it "does not set flash message" do
spree_put :update, params
expect(flash[:notice]).to be nil
expect(flash[:success]).to be nil
end
end
end
@@ -445,7 +445,7 @@ module Admin
it "redirects back to the order cycles path with a success message" do
spree_post :notify_producers, id: order_cycle.id
expect(response).to redirect_to admin_order_cycles_path
expect(flash[:notice]).to eq('Emails to be sent to producers have been queued for sending.')
expect(flash[:success]).to eq('Emails to be sent to producers have been queued for sending.')
end
end