В application_helper.rb:
def twitterized_type(type)
case type
when :alert
"alert-block"
when :error
"alert-error"
when :notice
"alert-info"
when :success
"alert-success"
else
type.to_s
end
end
В нужном месте лейаута или вьюхи:
=render :partial => "shared/flash_messages", :locals => {:flash => flash}
- flash.each do |type, message|
%div.alert{ "data-alert" => "alert", :class => twitterized_type(type) }
%a.close{:href => "#", "data-dismiss" => "alert"} ×
%p
= message
def twitterized_type(type)
case type
when :alert
"alert-block"
when :error
"alert-error"
when :notice
"alert-info"
when :success
"alert-success"
else
type.to_s
end
end
В нужном месте лейаута или вьюхи:
=render :partial => "shared/flash_messages", :locals => {:flash => flash}
В паршеле _flash_messages.html.haml:
%div.alert{ "data-alert" => "alert", :class => twitterized_type(type) }
%a.close{:href => "#", "data-dismiss" => "alert"} ×
%p
= message
Комментариев нет:
Отправить комментарий