Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

362 - Correct class names in flash messages #363

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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