From 346e36e16023f8600158073277124a1f3ea44c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sat, 18 Feb 2023 10:07:54 +0800 Subject: [PATCH] Use success notices where appropriate --- app/controllers/admin/donations_controller.rb | 17 ++++++++++++++--- app/controllers/invitations_controller.rb | 5 ++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/donations_controller.rb b/app/controllers/admin/donations_controller.rb index 84d98d9..ffbae14 100644 --- a/app/controllers/admin/donations_controller.rb +++ b/app/controllers/admin/donations_controller.rb @@ -33,7 +33,11 @@ class Admin::DonationsController < Admin::BaseController respond_to do |format| if @donation.save - format.html { redirect_to admin_donation_url(@donation), notice: 'Donation was successfully created.' } + format.html do + redirect_to admin_donation_url(@donation), flash: { + success: 'Donation was successfully created.' + } + end format.json { render :show, status: :created, location: @donation } else format.html { render :new } @@ -47,7 +51,11 @@ class Admin::DonationsController < Admin::BaseController def update respond_to do |format| if @donation.update(donation_params) - format.html { redirect_to admin_donation_url(@donation), notice: 'Donation was successfully updated.' } + format.html do + redirect_to admin_donation_url(@donation), flash: { + success: 'Donation was successfully updated.' + } + end format.json { render :show, status: :ok, location: @donation } else format.html { render :edit } @@ -61,7 +69,10 @@ class Admin::DonationsController < Admin::BaseController def destroy @donation.destroy respond_to do |format| - format.html { redirect_to admin_donations_url, notice: 'Donation was successfully destroyed.' } + format.html do redirect_to admin_donations_url, flash: { + success: 'Donation was successfully destroyed.' + } + end format.json { head :no_content } end end diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 2bc9d80..3bb038a 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -27,7 +27,10 @@ class InvitationsController < ApplicationController respond_to do |format| if @invitation.save - format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' } + format.html do redirect_to @invitation, flash: { + success: 'Invitation was successfully created.' + } + end format.json { render :show, status: :created, location: @invitation } else format.html { render :new }