22 lines
862 B
Ruby
22 lines
862 B
Ruby
|
# 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
|