user can't delete self and flash_messages
This commit is contained in:
1 parent
318c264cae
commit
e62df90117
9 files changed
+67
-16
No files matched your search
@@ -1,11 +1,31 @@
|
||||
module ApplicationHelper
|
||||
|
||||
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
||||
|
||||
def colorize_in_use_locale(locale)
|
||||
@site_in_use_locales.include?(locale)? 'green' : 'red'
|
||||
end
|
||||
|
||||
def flash_messages
|
||||
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
|
||||
formatted_messages = messages.map do |type|
|
||||
content_tag :div, :class => type.to_s do
|
||||
message_for_item(flash[type], flash["#{type}_item".to_sym])
|
||||
end
|
||||
end
|
||||
raw(formatted_messages.join)
|
||||
end
|
||||
|
||||
def link_back
|
||||
link_to t('back'), session[:last_page]
|
||||
end
|
||||
|
||||
def message_for_item(message, item = nil)
|
||||
if item.is_a?(Array)
|
||||
message % link_to(*item)
|
||||
else
|
||||
message % item
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user