重写url_helper link_to_unless方法,给Kaminari当前页添加样式
This commit is contained in:
parent
55e049edbb
commit
c543a28cc8
|
@ -0,0 +1,22 @@
|
|||
# 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
|
Loading…
Reference in New Issue