Skip to content

Commit

Permalink
Merge pull request #363 from uclibs/362-correct-class-names-on-flash-…
Browse files Browse the repository at this point in the history
…messages

362 - Correct class names in flash messages
  • Loading branch information
hortongn authored Feb 4, 2024
2 parents 72a12d5 + 12b57cc commit 53cb207
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/controllers/publications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def create
respond_to do |format|
if instance_variable.save
PublicationMailer.publication_submit(helpers.find_submitter(session[:submitter_id]), instance_variable).deliver_now
flash.keep[:success] = "#{controller_name.classify} was successfully created."
class_name = controller_name.classify
formatted_name = class_name.underscore.humanize.titleize
flash.keep[:success] = "#{formatted_name} was successfully created."
format.html { redirect_to publications_path }
format.json { render :show, status: :created, location: instance_variable }
else
Expand All @@ -138,7 +140,9 @@ def update
instance_variable = instance_variable_get("@#{controller_name.singularize}")
respond_to do |format|
if instance_variable.update(allowed_params)
flash.keep[:success] = "#{controller_name.classify} was successfully updated."
class_name = controller_name.classify
formatted_name = class_name.underscore.humanize.titleize
flash.keep[:success] = "#{formatted_name} was successfully updated."
format.html { redirect_to instance_variable }
format.json { render :show, status: :created, location: instance_variable }
else
Expand All @@ -152,7 +156,9 @@ def destroy
instance_variable = instance_variable_get("@#{controller_name.singularize}")
instance_variable.destroy
respond_to do |format|
flash.keep[:warning] = "#{controller_name.classify} was successfully destroyed."
class_name = controller_name.classify
formatted_name = class_name.underscore.humanize.titleize
flash.keep[:warning] = "#{formatted_name} was successfully destroyed."
format.html { redirect_to publications_path }
format.json { head :no_content }
end
Expand Down

0 comments on commit 53cb207

Please sign in to comment.