-
-
Save radar/5529441 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def full_title(page_title) | |
base_title = "Vende Comigo" | |
if page_title.empty? | |
base_title | |
else | |
"#{base_title} | #{page_title}" | |
end | |
end | |
def display_base_errors resource | |
return '' if (resource.errors.empty?) or (resource.errors[:base].empty?) | |
messages = resource.errors[:base].map { |msg| content_tag(:p, msg) }.join | |
html = <<-HTML | |
<div class="alert alert-error alert-block"> | |
<i class="icon-remove icon-large"></i> | |
#{messages} | |
</div> | |
HTML | |
html.html_safe | |
end | |
def display_messages | |
flash.each do |name, message| | |
if message.is_a?(String) | |
case name | |
when :error | |
text = "#b94a48" | |
when :warning | |
text = "#c09853" | |
when :success | |
text = "#468847" | |
when :info | |
text = "#3a87ad" | |
else | |
text = "white" | |
end | |
concat(<<-HTML | |
<div class="alert alert-error alert-block"> | |
<i class="icon-remove icon-large"></i> | |
#{message} | |
</div> | |
HTML | |
) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment