Skip to content

Commit

Permalink
Use more standard way of styling flash alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
jvendetti committed May 20, 2023
1 parent 2009d96 commit d4e83a9
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def index
def show
projects = LinkedData::Client::Models::Project.find_by_acronym(params[:id])
if projects.blank?
flash[:notice] = flash_error("Project not found: #{params[:id]}")
flash.alert = "Project not found: #{params[:id]}"
redirect_to projects_path
return
end
Expand Down Expand Up @@ -47,7 +47,7 @@ def new
def edit
projects = LinkedData::Client::Models::Project.find_by_acronym(params[:id])
if projects.blank?
flash[:notice] = flash_error("Project not found: #{params[:id]}")
flash.alert = "Project not found: #{params[:id]}"
redirect_to projects_path
return
end
Expand Down Expand Up @@ -86,7 +86,7 @@ def create
def update
projects = LinkedData::Client::Models::Project.find_by_acronym(params[:id])
if projects.blank?
flash[:notice] = flash_error("Project not found: #{params[:id]}")
flash.alert = "Project not found: #{params[:id]}"
redirect_to projects_path
return
end
Expand All @@ -109,7 +109,7 @@ def update
def destroy
projects = LinkedData::Client::Models::Project.find_by_acronym(params[:id])
if projects.blank?
flash[:notice] = flash_error("Project not found: #{params[:id]}")
flash.alert = "Project not found: #{params[:id]}"
redirect_to projects_path
return
end
Expand Down Expand Up @@ -140,11 +140,4 @@ def project_params
p[:ontologyUsed].reject!(&:blank?)
p.to_h
end

def flash_error(msg)
html = ''.html_safe
html << '<span style=color:red;>'.html_safe
html << msg
html << '</span>'.html_safe
end
end

0 comments on commit d4e83a9

Please sign in to comment.