FIX: reduce poll when post is nil
This commit is contained in:
parent
b24938b5ff
commit
a188d15b08
|
@ -437,8 +437,13 @@ after_initialize do
|
|||
|
||||
on(:reduce_excerpt) do |doc, options|
|
||||
post = options[:post]
|
||||
|
||||
replacement = post ?
|
||||
"<a href='#{UrlHelper.escape_uri(post.url)}'>#{I18n.t("poll.poll")}</a>" :
|
||||
"#{I18n.t("poll.poll")}"
|
||||
|
||||
doc.css("div.poll").each do |poll|
|
||||
poll.replace "<a href='#{UrlHelper.escape_uri(post.url)}'>#{I18n.t("poll.poll")}</a>"
|
||||
poll.replace(replacement)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue