hide titles for items index and show from main body

This commit is contained in:
Emi Matchu 2011-05-13 08:20:29 -04:00
parent 1b3669178c
commit cd947b61b3
2 changed files with 18 additions and 13 deletions

View file

@ -3,32 +3,32 @@ module ApplicationHelper
@body_class ||= '' @body_class ||= ''
@body_class << " #{class_name}" @body_class << " #{class_name}"
end end
def auth_server_icon_url def auth_server_icon_url
"http://#{Openneo::Auth.config.auth_server}/favicon.png" "http://#{Openneo::Auth.config.auth_server}/favicon.png"
end end
def body_class def body_class
"#{params[:controller]} #{params[:controller]}-#{params[:action]}".tap do |output| "#{params[:controller]} #{params[:controller]}-#{params[:action]}".tap do |output|
output << @body_class if @body_class output << @body_class if @body_class
end end
end end
def flashes def flashes
raw(flash.inject('') do |html, pair| raw(flash.inject('') do |html, pair|
key, value = pair key, value = pair
html + content_tag('p', value, :class => key) html + content_tag('p', value, :class => key)
end) end)
end end
def hide_home_link def hide_home_link
@hide_home_link = true @hide_home_link = true
end end
def home_link? def home_link?
!@hide_home_link !@hide_home_link
end end
JAVASCRIPT_LIBRARIES = { JAVASCRIPT_LIBRARIES = {
:addthis => 'http://s7.addthis.com/js/250/addthis_widget.js#username=openneo', :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', :bitly => 'http://bit.ly/javascript-api.js?version=latest&login=openneo&apiKey=R_4d0438829b7a99860de1d3edf55d8dc8',
@ -37,30 +37,35 @@ module ApplicationHelper
:jquery_tmpl => 'http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js', :jquery_tmpl => 'http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js',
:swfobject => 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js' :swfobject => 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'
} }
def include_javascript_libraries(*library_names) def include_javascript_libraries(*library_names)
raw(library_names.inject('') do |html, name| raw(library_names.inject('') do |html, name|
html + javascript_include_tag(JAVASCRIPT_LIBRARIES[name]) html + javascript_include_tag(JAVASCRIPT_LIBRARIES[name])
end) end)
end end
def login_path_with_return_to def login_path_with_return_to
login_path :return_to => request.fullpath login_path :return_to => request.fullpath
end end
def logout_path_with_return_to def logout_path_with_return_to
logout_path :return_to => request.fullpath logout_path :return_to => request.fullpath
end end
def origin_tag(value) def origin_tag(value)
hidden_field_tag 'origin', value, :id => nil hidden_field_tag 'origin', value, :id => nil
end end
def show_title_header?
params[:controller] != 'items'
end
def signed_in_meta_tag def signed_in_meta_tag
%(<meta name="user-signed-in" content="#{user_signed_in?}">).html_safe %(<meta name="user-signed-in" content="#{user_signed_in?}">).html_safe
end end
def title(value) def title(value)
content_for :title, value content_for :title, value
end end
end end

View file

@ -14,7 +14,7 @@
%body{:class => body_class} %body{:class => body_class}
= javascript_include_tag "analytics" = javascript_include_tag "analytics"
#container #container
- if content_for? :title - if content_for?(:title) && show_title_header?
%h1#title= yield :title %h1#title= yield :title
= render 'static/announcement.html' = render 'static/announcement.html'
= yield :before_flashes = yield :before_flashes