Display better error message after admin redirect

This commit is contained in:
Erik Michaels-Ober 2012-01-02 02:04:49 -08:00
parent e7e31d0f99
commit 234c4a9092
5 changed files with 22 additions and 37 deletions

View File

@ -0,0 +1,18 @@
- if flash[:notice]
.alert-message.success{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:notice]
- if flash[:warning]
.alert-message.warning{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:warning]
- if flash[:error]
.alert-message.error{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:error]

View File

@ -1,22 +1,5 @@
#loader{:style => "display: none;"}
= image_tag "ajax-loader.gif"
#info_window
- if flash[:notice]
.alert-message.success{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:notice]
- if flash[:warning]
.alert-message.warning{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:warning]
- if flash[:error]
.alert-message.error{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:error]
= render :partial => "layouts/flash", :locals => {:flash => flash}
= yield

View File

@ -1,19 +1,2 @@
- if flash[:notice]
.alert-message.success{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:notice]
- if flash[:warning]
.alert-message.warning{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:warning]
- if flash[:error]
.alert-message.error{:"data-alert" => true}
%a{:class => "close", :href => "#"}
×
%p
= flash[:error]
= render :partial => "layouts/flash", :locals => {:flash => flash}
= yield

View File

@ -6,6 +6,7 @@
%p.alert-message#tagline
= t("defaults.tagline")
#content
= render :partial => "layouts/flash", :locals => {:flash => flash}
- if signed_in?
= render :partial => "sidebar/search"
- else

View File

@ -1,5 +1,5 @@
RailsAdmin.config do |config|
config.authenticate_with do
redirect_to main_app_root_path unless signed_in? && current_user.admin?
redirect_to(main_app.root_path, :flash => {:warning => "You must be signed-in as an administrator to access that page"}) unless signed_in? && current_user.admin?
end
end