X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2357118c460e4a2d367e4a446a0f3e883d251415..15ea756ae655d1ea009efa22a87155136c30fee3:/app/helpers/application_helper.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5b08e515..adcf5c6c0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,9 +3,9 @@ module ApplicationHelper def linkify(text) if text.html_safe? - Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow")).html_safe + Rinku.auto_link(text, :urls, tag_builder.tag_options(:rel => "nofollow")).html_safe else - Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow")) + Rinku.auto_link(text, :urls, tag_builder.tag_options(:rel => "nofollow")) end end @@ -21,12 +21,12 @@ module ApplicationHelper css = "" css << ".hidden { display: none !important }" - css << ".hide_unless_logged_in { display: none !important }" unless @user - css << ".hide_if_logged_in { display: none !important }" if @user - css << ".hide_if_user_#{@user.id} { display: none !important }" if @user - css << ".show_if_user_#{@user.id} { display: inline !important }" if @user - css << ".hide_unless_administrator { display: none !important }" unless @user && @user.administrator? - css << ".hide_unless_moderator { display: none !important }" unless @user && @user.moderator? + css << ".hide_unless_logged_in { display: none !important }" unless current_user + css << ".hide_if_logged_in { display: none !important }" if current_user + css << ".hide_if_user_#{current_user.id} { display: none !important }" if current_user + css << ".show_if_user_#{current_user.id} { display: inline !important }" if current_user + css << ".hide_unless_administrator { display: none !important }" unless current_user && current_user.administrator? + css << ".hide_unless_moderator { display: none !important }" unless current_user && current_user.moderator? content_tag(:style, css, :type => "text/css") end @@ -40,9 +40,7 @@ module ApplicationHelper end def if_user(user, tag = :div, &block) - if user - content_tag(tag, capture(&block), :class => "hidden show_if_user_#{user.id}") - end + content_tag(tag, capture(&block), :class => "hidden show_if_user_#{user.id}") if user end def unless_user(user, tag = :div, &block) @@ -107,12 +105,10 @@ module ApplicationHelper :preferred_editor => preferred_editor } - if @user - data[:user] = @user.id.to_json + if current_user + data[:user] = current_user.id.to_json - unless @user.home_lon.nil? || @user.home_lat.nil? - data[:user_home] = { :lat => @user.home_lat, :lon => @user.home_lon } - end + data[:user_home] = { :lat => current_user.home_lat, :lon => current_user.home_lon } unless current_user.home_lon.nil? || current_user.home_lat.nil? end data[:location] = session[:location] if session[:location]