Kill trailing whitespace in ruby files
This commit is contained in:
@@ -3,7 +3,7 @@ module PostSetPresenters
|
||||
def posts
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
|
||||
def post_previews_html(template)
|
||||
html = ""
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ module PostSetPresenters
|
||||
).map {|x| x[0]}
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
def tag_list_html(template)
|
||||
tag_set_presenter.tag_list_html(template)
|
||||
end
|
||||
|
||||
|
||||
def posts
|
||||
@posts ||= favorite_set.posts
|
||||
end
|
||||
|
||||
@@ -11,11 +11,11 @@ module PostSetPresenters
|
||||
).map {|x| x[0]}
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
def tag_list_html(template)
|
||||
tag_set_presenter.tag_list_html(template)
|
||||
end
|
||||
|
||||
|
||||
def post_previews_html(template)
|
||||
html = ""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module PostSetPresenters
|
||||
class Popular < Base
|
||||
attr_accessor :post_set, :tag_set_presenter
|
||||
delegate :posts, :date, :min_date, :max_date, :to => :post_set
|
||||
|
||||
|
||||
def initialize(post_set)
|
||||
@post_set = post_set
|
||||
end
|
||||
@@ -10,42 +10,42 @@ module PostSetPresenters
|
||||
def prev_day
|
||||
date - 1.day
|
||||
end
|
||||
|
||||
|
||||
def next_day
|
||||
date + 1.day
|
||||
end
|
||||
|
||||
|
||||
def prev_week
|
||||
date - 7.days
|
||||
end
|
||||
|
||||
|
||||
def next_week
|
||||
date + 7.days
|
||||
end
|
||||
|
||||
|
||||
def prev_month
|
||||
1.month.ago(date)
|
||||
end
|
||||
|
||||
|
||||
def next_month
|
||||
1.month.since(date)
|
||||
end
|
||||
|
||||
|
||||
def link_rel_for_scale?(template, scale)
|
||||
(template.params[:scale].blank? && scale == "day") || template.params[:scale].to_s.include?(scale)
|
||||
end
|
||||
|
||||
|
||||
def next_date_for_scale(scale)
|
||||
case scale
|
||||
when "Day"
|
||||
next_day
|
||||
|
||||
|
||||
when "Week"
|
||||
next_week
|
||||
|
||||
|
||||
when "Month"
|
||||
next_month
|
||||
|
||||
|
||||
else
|
||||
nil
|
||||
end
|
||||
@@ -55,41 +55,41 @@ module PostSetPresenters
|
||||
case scale
|
||||
when "Day"
|
||||
prev_day
|
||||
|
||||
|
||||
when "Week"
|
||||
prev_week
|
||||
|
||||
|
||||
when "Month"
|
||||
prev_month
|
||||
|
||||
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def nav_links_for_scale(template, scale)
|
||||
html = []
|
||||
html << '<span class="period">'
|
||||
html << template.link_to(
|
||||
"«prev".html_safe,
|
||||
"«prev".html_safe,
|
||||
template.popular_explore_posts_path(
|
||||
:date => prev_date_for_scale(scale),
|
||||
:date => prev_date_for_scale(scale),
|
||||
:scale => scale.downcase
|
||||
),
|
||||
:rel => (link_rel_for_scale?(template, scale.downcase) ? "prev" : nil)
|
||||
)
|
||||
html << template.link_to(
|
||||
scale,
|
||||
scale,
|
||||
template.popular_explore_posts_path(
|
||||
:date => date,
|
||||
:date => date,
|
||||
:scale => scale.downcase
|
||||
),
|
||||
),
|
||||
:class => "desc"
|
||||
)
|
||||
html << template.link_to(
|
||||
"next»".html_safe,
|
||||
"next»".html_safe,
|
||||
template.popular_explore_posts_path(
|
||||
:date => next_date_for_scale(scale),
|
||||
:date => next_date_for_scale(scale),
|
||||
:scale => scale.downcase
|
||||
),
|
||||
:rel => (link_rel_for_scale?(template, scale.downcase) ? "next" : nil)
|
||||
@@ -97,7 +97,7 @@ module PostSetPresenters
|
||||
html << '</span>'
|
||||
html.join("\n").html_safe
|
||||
end
|
||||
|
||||
|
||||
def nav_links(template)
|
||||
html = []
|
||||
html << '<p id="popular-nav-links">'
|
||||
@@ -107,7 +107,7 @@ module PostSetPresenters
|
||||
html << '</p>'
|
||||
html.join("\n").html_safe
|
||||
end
|
||||
|
||||
|
||||
def range_text
|
||||
if min_date == max_date
|
||||
date.strftime("%B %d, %Y")
|
||||
|
||||
@@ -7,7 +7,7 @@ module PostSetPresenters
|
||||
@post_set = post_set
|
||||
@tag_set_presenter = TagSetPresenter.new(related_tags)
|
||||
end
|
||||
|
||||
|
||||
def related_tags
|
||||
if post_set.is_pattern_search?
|
||||
pattern_tags
|
||||
@@ -21,28 +21,28 @@ module PostSetPresenters
|
||||
related_tags_for_group
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def popular_tags
|
||||
n = 1
|
||||
results = []
|
||||
|
||||
|
||||
while results.empty? && n < 256
|
||||
query = n.days.ago.strftime("date:>%Y-%m-%d")
|
||||
results = RelatedTagCalculator.calculate_from_sample_to_array(query).map(&:first)
|
||||
n *= 2
|
||||
end
|
||||
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
|
||||
def pattern_tags
|
||||
Tag.name_matches(post_set.tag_string).all(:select => "name", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC").map(&:name)
|
||||
end
|
||||
|
||||
|
||||
def related_tags_for_group
|
||||
RelatedTagCalculator.calculate_from_sample_to_array(post_set.tag_string).map(&:first)
|
||||
end
|
||||
|
||||
|
||||
def related_tags_for_single
|
||||
tag = Tag.find_by_name(post_set.tag_string)
|
||||
|
||||
@@ -53,7 +53,7 @@ module PostSetPresenters
|
||||
tag.related_tag_array.map(&:first)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def tag_list_html(template)
|
||||
tag_set_presenter.tag_list_html(template)
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ module PostSetPresenters
|
||||
rescue ActiveRecord::StatementInvalid, PGError
|
||||
[]
|
||||
end
|
||||
|
||||
|
||||
def post_previews_html(template)
|
||||
result = super(template)
|
||||
if result =~ /Nobody here but us chickens/
|
||||
|
||||
Reference in New Issue
Block a user