Created
May 25, 2010 15:52
-
-
Save bjensen/413297 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>Filter Tickets</h3> | |
<ul id="filter-links"> | |
<%= ticket_filter_links 'open', @current_user.id -%> | |
<%= ticket_filter_links 'closed', @current_user.id -%> | |
<%= ticket_filter_links 'open' -%> | |
<%= ticket_filter_links 'closed' -%> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ticket_filter_links(status_name, user_id=nil) | |
if user_id.nil? | |
if status_name.downcase == 'closed' | |
content_tag(:li, link_to("All Closed Tickets", tickets_path + "?search[status_id_equals]=#{@closed_status.id}")) | |
else | |
content_tag(:li, link_to("All Active Tickets", tickets_path)) | |
end | |
else | |
if status_name.downcase == 'closed' | |
content_tag(:li, link_to("My Closed Tickets", tickets_path + "?search[status_id_equals]=#{@closed_status.id}&search[owned_by_equals]=#{user_id}")) | |
else | |
content_tag(:li, link_to("My Open Tickets", tickets_path + "?search[status_id_equals]=#{@open_status.id}&search[owned_by_equals]=#{user_id}")) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment