Fix announcement iframe bug.
This commit is contained in:
parent
f531708a5f
commit
ed06f3e891
|
@ -371,6 +371,7 @@ class AnnouncementsController < ApplicationController
|
||||||
else
|
else
|
||||||
@categories = params[:categories]
|
@categories = params[:categories]
|
||||||
end
|
end
|
||||||
|
OrbitHelper.set_site_locale(I18n.locale)
|
||||||
OrbitHelper.set_current_widget_module("announcement")
|
OrbitHelper.set_current_widget_module("announcement")
|
||||||
OrbitHelper.set_params(params,current_user)
|
OrbitHelper.set_params(params,current_user)
|
||||||
Bulletin.remove_expired_status
|
Bulletin.remove_expired_status
|
||||||
|
|
|
@ -426,9 +426,13 @@ module AnnouncementsHelper
|
||||||
dates = html.css("*[date-format]")
|
dates = html.css("*[date-format]")
|
||||||
if !dates.blank?
|
if !dates.blank?
|
||||||
dates.each do |d|
|
dates.each do |d|
|
||||||
|
begin
|
||||||
format = d.attributes["date-format"].value
|
format = d.attributes["date-format"].value
|
||||||
date = DateTime.parse(d.inner_text)
|
date = DateTime.parse(d.inner_text)
|
||||||
d.inner_html = d.inner_html.gsub(d.inner_text.strip, " " + date.strftime(format))
|
d.inner_html = d.inner_html.gsub(d.inner_text.strip, " " + date.strftime(format))
|
||||||
|
rescue
|
||||||
|
next
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.css("body").to_html.html_safe
|
html.css("body").to_html.html_safe
|
||||||
|
|
Loading…
Reference in New Issue