impress/app/helpers/application_helper.rb

52 lines
1 KiB
Ruby
Raw Normal View History

2010-05-14 15:12:31 -07:00
module ApplicationHelper
2010-11-08 17:40:03 -08:00
def add_body_class(class_name)
@body_class ||= ''
@body_class << " #{class_name}"
end
2010-10-18 15:10:50 -07:00
def auth_server_icon_url
"http://#{Openneo::Auth.config.auth_server}/favicon.png"
2010-10-18 15:10:50 -07:00
end
2010-11-05 15:45:05 -07:00
def body_class
2010-11-08 17:40:03 -08:00
"#{params[:controller]} #{params[:controller]}-#{params[:action]}".tap do |output|
output << @body_class if @body_class
end
2010-11-05 15:45:05 -07:00
end
2010-05-15 10:47:46 -07:00
def flashes
2010-11-05 15:45:05 -07:00
raw(flash.inject('') do |html, pair|
2010-05-15 10:47:46 -07:00
key, value = pair
2010-11-05 15:45:05 -07:00
html + content_tag('p', value, :class => key)
end)
end
2010-11-30 13:52:38 -08:00
def hide_home_link
@hide_home_link = true
end
def home_link?
!@hide_home_link
end
2010-10-18 15:17:08 -07:00
def login_path_with_return_to
login_path :return_to => request.fullpath
end
def logout_path_with_return_to
logout_path :return_to => request.fullpath
2010-10-18 15:17:08 -07:00
end
2010-11-05 17:09:03 -07:00
def origin_tag(value)
hidden_field_tag 'origin', value, :id => nil
end
2010-11-06 08:52:58 -07:00
def signed_in_meta_tag
%(<meta name="user-signed-in" content="#{user_signed_in?}">).html_safe
end
2010-11-06 08:52:58 -07:00
def title(value)
content_for :title, value
end
2010-05-14 15:12:31 -07:00
end