diff options
author | rhenium <rhenium@rhe.jp> | 2015-04-05 15:58:03 +0900 |
---|---|---|
committer | rhenium <rhenium@rhe.jp> | 2015-04-05 15:58:03 +0900 |
commit | a1812b253efdc1b06dba4ef59b6c3dcc8ef22c54 (patch) | |
tree | 558bb10f0bdf4b0b7b50916a5c3aa5c5e80db21c /app/helpers/application_helper.rb | |
parent | e3d1ef82877f8bbeb6c2e9d6499fdd5ecbc40c94 (diff) | |
download | aclog-a1812b253efdc1b06dba4ef59b6c3dcc8ef22c54.tar.gz |
web: reorganize views
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7508780..0c61d34 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,6 @@ module ApplicationHelper include Twitter::Autolink - def title(*args) - content_for :title do - (args.compact).join(" - ") - end - end - def register_view_part(name) (@view_parts ||= []) << name end @@ -22,6 +16,15 @@ module ApplicationHelper } end + def title(name = nil, suffix = false) + if name + @title = name + title + else + ["aclog", @title].compact.join(" - ") + end + end + def link_to_with_active(name, options = {}, html_options = {}, &block) if current_page?(options) html_options[:class] = (html_options[:class].to_s + " active").strip @@ -39,6 +42,29 @@ module ApplicationHelper end end + def render_sidebars + str = "" + if @sidebars + @sidebars.each do |sidebar| + case sidebar + when :user + str << render("shared/sidebar/user") + when :all + str << render("shared/sidebar/all") + when :reactions_thresholds + str << render("shared/sidebar/reactions_thresholds") + when :recent_thresholds + str << render("shared/sidebar/recent_thresholds") + end + end + end + str.html_safe + end + + def sidebar? + @sidebars && @sidebars.size > 0 + end + # utf8, form def utf8_enforcer_tag; raw "" end end |