Created
November 2, 2012 09:26
-
-
Save alvir/3999725 to your computer and use it in GitHub Desktop.
Typical smell. Conditions in extended array
This file contains hidden or 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 listed_date_links(feed_search, since_last_visit = false) | |
['Any', FeedSearch::SINCE_LAST_VIEW_VALUE, *FeedSearch::LAST_DAYS_VALUES].each do |col| | |
if col == current_listed_date_column(feed_search, since_last_visit).to_s | |
concat content_tag(:div, title_listed_date(col), :class => 'active') | |
else | |
concat link_to(title_listed_date(col), '#', :column_name => col, :class => 'subheader_link listed_date_column') | |
end | |
end | |
end | |
def current_listed_date_column(feed_search, since_last_visit = false) | |
return FeedSearch::SINCE_LAST_VIEW_VALUE if since_last_visit | |
feed_search.listed_date || 'Any' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment