From 82ab7c40ec80adc3768c19ed3fe0cd75eb0521d7 Mon Sep 17 00:00:00 2001 From: Eric Tsai Date: Tue, 29 Oct 2019 14:48:02 +0800 Subject: [PATCH] auto format --- app/controllers/bulletins_controller.rb | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/controllers/bulletins_controller.rb b/app/controllers/bulletins_controller.rb index 2c2d357..da0b705 100644 --- a/app/controllers/bulletins_controller.rb +++ b/app/controllers/bulletins_controller.rb @@ -27,7 +27,7 @@ class BulletinsController < ApplicationController else bulletins = bulletins end - + bulletins = bulletins.where(:is_preview.in=>[false,nil]) bulletins = bulletins.where(:approved.ne => false , :rejected.ne => true) bulletins = bulletins.where(:postdate.lt=>Time.now) @@ -35,7 +35,7 @@ class BulletinsController < ApplicationController bulletins = bulletins.collect do |b| image = request.protocol + request.host_with_port + b.image.url rescue nil - + links = b.bulletin_links.collect do |bl| { "title" => bl.title_translations, @@ -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