fixes #1242
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
def wordbreakify(string)
|
||||||
|
raw(string.gsub(/(.{10})/, "\\1<wbr>"))
|
||||||
|
end
|
||||||
|
|
||||||
def nav_link_to(text, url, options = nil)
|
def nav_link_to(text, url, options = nil)
|
||||||
if nav_link_match(params[:controller], url)
|
if nav_link_match(params[:controller], url)
|
||||||
klass = "current"
|
klass = "current"
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ module PostVersionsHelper
|
|||||||
html = []
|
html = []
|
||||||
diff[:added_tags].each do |tag|
|
diff[:added_tags].each do |tag|
|
||||||
prefix = diff[:obsolete_added_tags].include?(tag) ? '+<ins class="obsolete">' : '<ins>+'
|
prefix = diff[:obsolete_added_tags].include?(tag) ? '+<ins class="obsolete">' : '<ins>+'
|
||||||
html << prefix + link_to(tag, posts_path(:tags => tag)) + '</ins>'
|
html << prefix + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</ins>'
|
||||||
end
|
end
|
||||||
diff[:removed_tags].each do |tag|
|
diff[:removed_tags].each do |tag|
|
||||||
prefix = diff[:obsolete_removed_tags].include?(tag) ? '-<del class="obsolete">' : '<del>-'
|
prefix = diff[:obsolete_removed_tags].include?(tag) ? '-<del class="obsolete">' : '<del>-'
|
||||||
html << prefix + link_to(tag, posts_path(:tags => tag)) + '</del>'
|
html << prefix + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</del>'
|
||||||
end
|
end
|
||||||
diff[:unchanged_tags].each do |tag|
|
diff[:unchanged_tags].each do |tag|
|
||||||
html << '<span>' + link_to(tag, posts_path(:tags => tag)) + '</span>'
|
html << '<span>' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</span>'
|
||||||
end
|
end
|
||||||
return html.join(" ").html_safe
|
return html.join(" ").html_safe
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ module PostsHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def wordbreakify(string)
|
|
||||||
string.gsub(/(.{15})/, "\\1<wbr>")
|
|
||||||
end
|
|
||||||
|
|
||||||
def post_source_tag(post)
|
def post_source_tag(post)
|
||||||
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
|
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
|
||||||
text = "pixiv/<wbr>#{wordbreakify($1)}"
|
text = "pixiv/<wbr>#{wordbreakify($1)}"
|
||||||
|
|||||||
Reference in New Issue
Block a user