mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Show success messages as.. success.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user