diaspora/app/helpers/layout_helper.rb
2011-09-14 11:23:12 -07:00

39 lines
1.1 KiB
Ruby

# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
content_for(:title) { page_title.to_s }
@show_title = show_title
end
def page_title(text=nil)
return text unless text.blank?
current_user ? current_user.name : t("application.helper.diaspora_alpha")
end
def show_title?
@show_title
end
def stylesheet(*args)
content_for(:head) { stylesheet_link_tag(*args) }
end
def javascript(*args)
content_for(:head) { javascript_include_tag(*args) }
end
def new_notification_text(count)
t('notifications.helper.new_notifications', :count => count)
end
def new_message_text(count)
t('conversations.helper.new_messages', :count => count)
end
end