socialforge/config/initializers/url_helper.rb

22 lines
883 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Time 2015-01-30 17:02:41
# Author lizanle
# Description 打开redmine\ruby\lib\ruby\gems\1.9.1\gems\actionpack-3.2.13\lib\action_view\helpers\UrlHelper重写link_to_unless方法
# 如果是当前页则给当前页添加样式class=>'current-page'
module ActionView
# = Action View URL Helpers
module Helpers #:nodoc:
# Provides a set of methods for making links and getting URLs that
# depend on the routing subsystem (see ActionDispatch::Routing).
# This allows you to use the same format for links in views
# and controllers.
module UrlHelper
def link_to_unless(condition, name, options = {}, html_options = {}, &block)
if condition
link_to(name, options, html_options.merge(:class => 'current-page'))
else
link_to(name, options, html_options)
end
end
end
end
end