accelerate!
This commit is contained in:
parent
0b3084bcd1
commit
a8c015f3e5
|
@ -171,37 +171,35 @@ class AnnouncementsController < ApplicationController
|
||||||
end
|
end
|
||||||
cats = cats.uniq
|
cats = cats.uniq
|
||||||
tags = tags.uniq
|
tags = tags.uniq
|
||||||
tags_translations = tags.map{|tag_id|
|
tags_translations = Tag.where(:id.in=>tags).map{|t| [t.id.to_s,t.name]}
|
||||||
if tag_id == "all"
|
if tags.include?("all")
|
||||||
t = I18n.t(:all)
|
tags_translations = ["all",I18n.t(:all)] + tags_translations
|
||||||
else
|
end
|
||||||
t = Tag.find(tag_id).name rescue ""
|
tags_translations = tags_translations.to_h
|
||||||
end
|
cats_translations = Category.where(:id.in=>cats).map{|c| [c.id.to_s,c.title]}
|
||||||
[tag_id,t]
|
if cats.include?("all")
|
||||||
}.to_h
|
cats_translations = ["all",I18n.t(:all)] + cats_translations
|
||||||
cats_translations = cats.map{|cat_id|
|
end
|
||||||
if cat_id == "all"
|
cats_translations = cats_translations.to_h
|
||||||
t = I18n.t(:all)
|
|
||||||
else
|
|
||||||
t = Category.find(cat_id).title rescue ""
|
|
||||||
end
|
|
||||||
[cat_id,t]
|
|
||||||
}.to_h
|
|
||||||
cats_relations = cats_translations.map{|cat_id,t|
|
cats_relations = cats_translations.map{|cat_id,t|
|
||||||
if cat_id == "all"
|
if cat_id == "all"
|
||||||
t = "all"
|
t = "all"
|
||||||
end
|
end
|
||||||
[cat_id,t]
|
[cat_id,t]
|
||||||
}.to_h
|
}.to_h
|
||||||
home_page = Page.first
|
home_page = subpart.page_part.page rescue Page.first
|
||||||
page = nil
|
page_url = (subpart.get_read_more_page_url rescue nil)
|
||||||
locale = I18n.locale.to_s
|
locale = I18n.locale.to_s
|
||||||
if home_page.respond_to?(:find_page)
|
if page_url.nil?
|
||||||
page = home_page.find_page(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
page = nil
|
||||||
page = home_page.find_page(:module=>"announcement",:enabled_for=>locale).first rescue nil if page.nil?
|
if home_page.respond_to?(:find_page)
|
||||||
else
|
page = home_page.find_page(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
||||||
page = Page.where(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
page = home_page.find_page(:module=>"announcement",:enabled_for=>locale).first rescue nil if page.nil?
|
||||||
page = Page.where(:module=>"announcement",:enabled_for=>locale).first rescue nil if page.nil?
|
else
|
||||||
|
page = Page.where(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
||||||
|
page = Page.where(:module=>"announcement",:enabled_for=>locale).first rescue nil if page.nil?
|
||||||
|
end
|
||||||
|
page_url = page.get_url
|
||||||
end
|
end
|
||||||
all_cats = cats.dup
|
all_cats = cats.dup
|
||||||
all_cats.delete "all"
|
all_cats.delete "all"
|
||||||
|
@ -219,7 +217,7 @@ class AnnouncementsController < ApplicationController
|
||||||
"<div style=\"clear: both;\"></div>" +
|
"<div style=\"clear: both;\"></div>" +
|
||||||
"<ul class=\"nav_tabs_filter\">" +
|
"<ul class=\"nav_tabs_filter\">" +
|
||||||
(use_tag ? tags.map.with_index{|tag,i|
|
(use_tag ? tags.map.with_index{|tag,i|
|
||||||
read_more_url = "/#{locale + page.url}" rescue ""
|
read_more_url = "/#{locale + page_url}" rescue ""
|
||||||
read_more_url = read_more_url + "?" + {"category"=>all_cats,"tags"=>(tag == 'all' ? all_tags : [tag])}.to_param if read_more_url != ""
|
read_more_url = read_more_url + "?" + {"category"=>all_cats,"tags"=>(tag == 'all' ? all_tags : [tag])}.to_param if read_more_url != ""
|
||||||
read_more_text = I18n.t("announcement.more")
|
read_more_text = I18n.t("announcement.more")
|
||||||
if tag != "all"
|
if tag != "all"
|
||||||
|
@ -231,7 +229,7 @@ class AnnouncementsController < ApplicationController
|
||||||
end
|
end
|
||||||
"<li class=\"filter_tab#{i == 0 ? ' active' : ''}\" #{(tag == 'all' && @all_setting_option == 0) ? "data-count_limit=\"#{max_all_count}\"" : ''} data-read_more_text=\"#{read_more_text}\" data-read_more=\"#{read_more_url}\" data-tags=\"#{tag}\">#{tags_translations[tag]}</li>"
|
"<li class=\"filter_tab#{i == 0 ? ' active' : ''}\" #{(tag == 'all' && @all_setting_option == 0) ? "data-count_limit=\"#{max_all_count}\"" : ''} data-read_more_text=\"#{read_more_text}\" data-read_more=\"#{read_more_url}\" data-tags=\"#{tag}\">#{tags_translations[tag]}</li>"
|
||||||
}.join("") : cats.map.with_index{|cat,i|
|
}.join("") : cats.map.with_index{|cat,i|
|
||||||
read_more_url = "/#{locale + page.url}" rescue ""
|
read_more_url = "/#{locale + page_url}" rescue ""
|
||||||
read_more_url = read_more_url + "?" + {"category"=>(cat == 'all' ? all_cats : cat)}.to_param if read_more_url != ""
|
read_more_url = read_more_url + "?" + {"category"=>(cat == 'all' ? all_cats : cat)}.to_param if read_more_url != ""
|
||||||
read_more_text = I18n.t("announcement.more")
|
read_more_text = I18n.t("announcement.more")
|
||||||
if cat != "all"
|
if cat != "all"
|
||||||
|
@ -374,7 +372,7 @@ class AnnouncementsController < ApplicationController
|
||||||
"
|
"
|
||||||
end
|
end
|
||||||
if @tab_option == 0
|
if @tab_option == 0
|
||||||
read_more_url = "/#{locale + page.url}" rescue ""
|
read_more_url = "/#{locale + page_url}" rescue ""
|
||||||
read_more_url = read_more_url + "?" + {"category"=>all_cats,"tags"=>all_tags}.to_param if read_more_url != ""
|
read_more_url = read_more_url + "?" + {"category"=>all_cats,"tags"=>all_tags}.to_param if read_more_url != ""
|
||||||
extra_after_html += "
|
extra_after_html += "
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue