This commit is contained in:
BoHung Chiu 2021-07-07 12:48:39 +08:00
parent 50c6d02090
commit 3b824b02a3
2 changed files with 6 additions and 6 deletions

View File

@ -5,11 +5,11 @@ require 'json'
module Admin::AnnouncementsHelper module Admin::AnnouncementsHelper
def page_for_bulletin(bulletin) def page_for_bulletin(bulletin)
ann_page = nil ann_page = nil
pages = Page.where(:module=>'announcement') pages = Page.where(:module=>'announcement').select{|page| page.enabled_for.include?(I18n.locale.to_s)}
pages.each do |page| pages.each do |page|
if page.categories.count ==1 if page.categories.count ==1
if page.categories.include?(bulletin.category.id.to_s) if (page.categories.include?(bulletin.category.id.to_s) rescue false)
ann_page = page ann_page = page
end end
end end
@ -18,7 +18,7 @@ module Admin::AnnouncementsHelper
if ann_page.nil? if ann_page.nil?
pages.each do |page| pages.each do |page|
if page.categories.include?(bulletin.category.id.to_s) if (page.categories.include?(bulletin.category.id.to_s) rescue false)
ann_page = page ann_page = page
end end
break if !ann_page.nil? break if !ann_page.nil?
@ -26,7 +26,7 @@ module Admin::AnnouncementsHelper
end end
ann_page = pages.first if ann_page.nil? ann_page = pages.first if ann_page.nil?
request.protocol+(request.host_with_port+ann_page.url+'/'+bulletin.to_param).gsub('//','/') rescue "/" request.protocol+(request.host_with_port+ann_page.url+'/'+bulletin.to_param).gsub('//','/') rescue "#"
end end
def import_this_announcement(row,categories,tags) def import_this_announcement(row,categories,tags)

View File

@ -136,7 +136,7 @@
active_item.addClass("active"); active_item.addClass("active");
active_item.find("li").css("display","block"); active_item.find("li").css("display","block");
flag=true; flag=true;
$('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list.active').eq(0).effect("slide", { direction: "right", mode: 'show', duration: 500},function(){flag=false;}); $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list.active').eq(0).effect("slide", { direction: "left", mode: 'show', duration: 500},function(){flag=false;});
}; };
}); });
$('.btn-right').click(function(){ $('.btn-right').click(function(){
@ -155,7 +155,7 @@
active_item.addClass("active"); active_item.addClass("active");
active_item.find("li").css("display","block"); active_item.find("li").css("display","block");
flag=true; flag=true;
$('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list.active').eq(0).effect("slide", { direction: "left", mode: 'show', duration: 500},function(){flag=false;}); $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list.active').eq(0).effect("slide", { direction: "right", mode: 'show', duration: 500},function(){flag=false;});
}; };
}); });
}); });