auto format
This commit is contained in:
parent
862dc14449
commit
82ab7c40ec
|
@ -44,7 +44,7 @@ class BulletinsController < ApplicationController
|
|||
end rescue nil
|
||||
|
||||
files = b.bulletin_files.collect do |bf|
|
||||
file = request.protocol + request.host_with_port + bf.file.url rescue nil
|
||||
file = request.protocol + request.host_with_port + bf.file.url rescue nil
|
||||
{
|
||||
"title" => bf.title_translations,
|
||||
"description" => bf.description_translations,
|
||||
|
@ -106,17 +106,17 @@ class BulletinsController < ApplicationController
|
|||
def smart_convertor(text)
|
||||
html_string = text
|
||||
links = html_string.scan(/img.*?src="(.*?)"/i)
|
||||
links.each do |link|
|
||||
l = link.first
|
||||
new_link = nil
|
||||
if l.starts_with?("/")
|
||||
new_link = request.protocol + request.host_with_port + l
|
||||
elsif l.starts_with?("..")
|
||||
l1 = l.gsub("../","")
|
||||
new_link = request.protocol + request.host_with_port + "/" + l1
|
||||
end
|
||||
html_string = html_string.sub(l,new_link) if !new_link.nil?
|
||||
links.each do |link|
|
||||
l = link.first
|
||||
new_link = nil
|
||||
if l.starts_with?("/")
|
||||
new_link = request.protocol + request.host_with_port + l
|
||||
elsif l.starts_with?("..")
|
||||
l1 = l.gsub("../","")
|
||||
new_link = request.protocol + request.host_with_port + "/" + l1
|
||||
end
|
||||
html_string = html_string.sub(l,new_link) if !new_link.nil?
|
||||
end
|
||||
return html_string
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue