2010-05-14 15:12:31 -07:00
|
|
|
module ApplicationHelper
|
2010-10-18 15:10:50 -07:00
|
|
|
def auth_server_icon_url
|
|
|
|
# TODO: if auth servers expand, don't hardcode path
|
|
|
|
URI::HTTP.build(
|
|
|
|
:host => Openneo::Auth.config.auth_server,
|
|
|
|
:path => '/favicon.png'
|
|
|
|
).to_s
|
|
|
|
end
|
|
|
|
|
2010-11-05 15:45:05 -07:00
|
|
|
def body_class
|
|
|
|
"#{params[:controller]} #{params[:controller]}-#{params[:action]}"
|
|
|
|
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
|
|
|
|
|
|
|
|
JAVASCRIPT_LIBRARIES = {
|
|
|
|
:addthis => 'http://s7.addthis.com/js/250/addthis_widget.js#username=openneo',
|
|
|
|
:bitly => 'http://bit.ly/javascript-api.js?version=latest&login=openneo&apiKey=R_4d0438829b7a99860de1d3edf55d8dc8',
|
|
|
|
:html5 => 'http://html5shim.googlecode.com/svn/trunk/html5.js',
|
|
|
|
:jquery => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js',
|
|
|
|
:swfobject => 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'
|
|
|
|
}
|
|
|
|
|
|
|
|
def include_javascript_libraries(*library_names)
|
|
|
|
raw(library_names.inject('') do |html, name|
|
|
|
|
html + javascript_include_tag(JAVASCRIPT_LIBRARIES[name])
|
|
|
|
end)
|
2010-05-15 10:47:46 -07:00
|
|
|
end
|
2010-10-18 15:17:08 -07:00
|
|
|
|
|
|
|
def login_path_with_return_to
|
|
|
|
login_path :return_to => request.request_uri
|
|
|
|
end
|
2010-05-14 15:12:31 -07:00
|
|
|
end
|