mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
Clean up JS, add YUIDoc support, automatically create IIFE via asset pipeline
This commit is contained in:
@@ -36,20 +36,20 @@ module Oneboxer
|
||||
|
||||
excerpt = post.excerpt(SiteSetting.post_onebox_maxlength)
|
||||
excerpt.gsub!("\n"," ")
|
||||
# hack to make it render for now
|
||||
# hack to make it render for now
|
||||
excerpt.gsub!("[/quote]", "[quote]")
|
||||
quote = "[quote=\"#{post.user.username}, topic:#{topic.id}, slug:#{slug}, post:#{post.post_number}\"]#{excerpt}[/quote]"
|
||||
|
||||
|
||||
cooked = PrettyText.cook(quote)
|
||||
return cooked
|
||||
return cooked
|
||||
|
||||
else
|
||||
# Topic Link
|
||||
topic = Topic.where(id: route[:topic_id].to_i).includes(:user).first
|
||||
topic = Topic.where(id: route[:topic_id].to_i).includes(:user).first
|
||||
post = topic.posts.first
|
||||
Guardian.new(nil).ensure_can_see!(topic)
|
||||
|
||||
posters = topic.posters_summary.map do |p|
|
||||
posters = topic.posters_summary.map do |p|
|
||||
{username: p[:user][:username],
|
||||
avatar: PrettyText.avatar_img(p[:user][:username], 'tiny'),
|
||||
description: p[:description],
|
||||
@@ -58,8 +58,7 @@ module Oneboxer
|
||||
|
||||
category = topic.category
|
||||
if category
|
||||
category = "<a href=\"/category/#{category.name}\" class=\"badge badge-category excerptable\" data-excerpt-size=\"medium\" style=\"background-color: ##{category.color}\">#{category.name}</a>"
|
||||
|
||||
category = "<a href=\"/category/#{category.name}\" class=\"badge badge-category\" style=\"background-color: ##{category.color}\">#{category.name}</a>"
|
||||
end
|
||||
|
||||
quote = post.excerpt(SiteSetting.post_onebox_maxlength)
|
||||
@@ -76,7 +75,7 @@ module Oneboxer
|
||||
|
||||
@template = 'topic'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return nil unless @template
|
||||
|
||||
Reference in New Issue
Block a user