diff options
author | re4k <re4k@re4k.info> | 2013-04-28 00:38:21 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-04-28 00:38:21 +0900 |
commit | 4af8acda5e4664d41079e3ff2ea853e1fb74a2a8 (patch) | |
tree | 51a583486af42c349d1d0ff8cedfb40b8265fb5b /app/helpers/application_helper.rb | |
parent | 4189cf84b0c337568133c6dafadc07669daaa868 (diff) | |
download | aclog-4af8acda5e4664d41079e3ff2ea853e1fb74a2a8.tar.gz |
refactor controller
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 52c098e..f54a537 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,15 @@ module ApplicationHelper + def logged_in?; session[:user_id] && session[:account] end + def include_user?; !!params[:include_user] end + def format_time(dt) dt.to_time.localtime("+09:00").strftime("%Y-%m-%d %H:%M:%S") end + def format_days_ago(dt) + "#{(DateTime.now.utc - dt.to_datetime).to_i}d ago" + end + def format_tweet_text(text) ret = text.gsub(/<([a-z]+?):(.+?)(?::(.+?))?>/) do case $1 @@ -37,29 +44,6 @@ module ApplicationHelper "https://twitter.com/#{screen_name}" end - def user_icon_link(user) - logger.error("DEPRECATED user_icon_link") - link_to(image_tag(user.profile_image_url, alt: user.screen_name, title: user.name), user_path(user.screen_name)) - end - - def include_user?; get_bool(params[:include_user]) end - def user_limit - i = params[:limit].to_i - if i > 0 - return i - elsif i == -1 - return nil - else - if params[:action] == "show" - return 100 - else - return 20 - end - end - end - # utf8, form - def utf8_enforcer_tag - raw "" - end + def utf8_enforcer_tag; raw "" end end |