Sha256: 0b2cd16848985d66f0292ada726bba96e676f103db9974ef1143436135f72a8f
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# encoding: utf-8 module Gluttonberg module Admin module Messages # Renders model errors if there is any in Gluttonberg's default style def gb_error_messages_for(model_object) if model_object.errors.any? lis = "" model_object.errors.full_messages.each do |msg| lis << content_tag(:li , msg) end ul = content_tag(:ul , lis.html_safe).html_safe heading = content_tag(:h4 , "Sorry there was an error" , :class => "alert-heading" ) content_tag(:div , (heading.html_safe + ul.html_safe) , :class => "model-error alert alert-block alert-error") end end # Renders flash messages (notice, warning and error) if there is any in Gluttonberg's default style def render_flash_messages html = "" ["notice", "warning", "error"].each do |type| unless flash[type.intern].nil? html << content_tag("div", flash[type.intern].to_s.html_safe, :id => "alert alert-#{type}", :class => "flash").html_safe end end content_tag("div", html.html_safe, :id => "flash").html_safe end end end end
Version data entries
3 entries across 3 versions & 1 rubygems