Creating sweet user summary page
This commit is contained in:
@@ -7,4 +7,25 @@ module ApplicationHelper
|
||||
sort_dir = params[:dir] == 'up' ? 'down' : 'up'
|
||||
link_to_unless condition, title, request.parameters.merge( {:sort => column, :dir => sort_dir} )
|
||||
end
|
||||
|
||||
def li_link_to(name = nil, options = nil, html_options = nil, &block)
|
||||
html_options, options, name = options, name, block if block_given?
|
||||
options ||= {}
|
||||
|
||||
html_options = convert_options_to_data_attributes(options, html_options)
|
||||
|
||||
url = url_for(options)
|
||||
html_options['href'] ||= url
|
||||
|
||||
if current_page?(url)
|
||||
content_tag(:li, class: "active") do
|
||||
content_tag(:a, name || url, html_options, &block)
|
||||
end
|
||||
else
|
||||
content_tag(:li) do
|
||||
content_tag(:a, name || url, html_options, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user