fix some error
This commit is contained in:
parent
8491ec8283
commit
69682e9b79
|
@ -9,17 +9,20 @@ module AnnouncementsHelper
|
|||
subpart.select_options.each do |select_option|
|
||||
if !(@show_options.nil?) && select_option.field_name == @show_options.keys.first.to_s
|
||||
value = YAML.load(select_option.value)
|
||||
if value[I18n.locale] == t('announcement.small_size')
|
||||
tmp = value[:en]
|
||||
I18n.with_locale(:en) do
|
||||
if tmp == t('announcement.small_size')
|
||||
@image_version = 'thumb'
|
||||
elsif value[I18n.locale] == t('announcement.medium_size')
|
||||
elsif tmp == t('announcement.medium_size')
|
||||
@image_version = 'mobile'
|
||||
elsif value[I18n.locale] == t('announcement.orignal_size')
|
||||
elsif tmp == t('announcement.orignal_size')
|
||||
@image_version = 'orignal'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
def data_to_human_type(a)
|
||||
statuses = a.statuses_with_classname.collect do |status|
|
||||
{
|
||||
|
@ -141,13 +144,13 @@ module AnnouncementsHelper
|
|||
sorted
|
||||
end
|
||||
end
|
||||
def get_sorted_annc
|
||||
def get_sorted_annc(data_count=nil)
|
||||
params = OrbitHelper.params
|
||||
locale = OrbitHelper.get_site_locale.to_s
|
||||
page = Page.where(url:params['url']).first
|
||||
page_number = OrbitHelper.page_number.to_i
|
||||
page_number = 1 if page_number == 0
|
||||
page_data_count = OrbitHelper.page_data_count.to_i
|
||||
page_data_count = data_count || OrbitHelper.page_data_count.to_i
|
||||
feeds_anns = []
|
||||
tags = page.tags
|
||||
categories = params['category']=='all' ? (page.categories || []) : ([Category.find(params['category'])] rescue (page.categories || []))
|
||||
|
|
|
@ -10,20 +10,24 @@
|
|||
page.select_option_items.each do |select_option_item|
|
||||
if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s
|
||||
value = YAML.load(select_option_item.value)
|
||||
if value[I18n.locale] == t('announcement.not_show')
|
||||
tmp = value[:en]
|
||||
I18n.with_locale(:en) do
|
||||
if tmp == t('announcement.not_show')
|
||||
@show_back_and_next_flag = 0
|
||||
elsif value[I18n.locale] == t('announcement.show_top')
|
||||
elsif tmp == t('announcement.show_top')
|
||||
@show_back_and_next_flag = 1
|
||||
elsif value[I18n.locale] == t('announcement.show_bottom')
|
||||
elsif tmp == t('announcement.show_bottom')
|
||||
@show_back_and_next_flag = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if @show_back_and_next_flag != 0
|
||||
uid = params['uid']
|
||||
sorted,total_pages = get_sorted_annc
|
||||
now_index = sorted.to_enum.with_index.select{|v| v[0].uid==uid}[0][1]
|
||||
sorted,total_pages = get_sorted_annc(0)
|
||||
now_index = sorted.to_enum.with_index.select{|v| v[0].uid==uid}[0][1] rescue nil
|
||||
if !now_index.nil?
|
||||
if now_index != 0
|
||||
prev_result = sorted[now_index-1]
|
||||
prev_url = params['url'] + '/' + prev_result.to_param
|
||||
|
@ -35,6 +39,9 @@
|
|||
next_content = "<a href='#{next_url}' title='#{t('announcement.next')}' class='next'><b>#{t('announcement.next')}</b><p>#{next_result['title'][I18n.locale]}</p></a>"
|
||||
end
|
||||
content = "<div class='see_more_boxTitle'>#{prev_content}#{next_content}</div>".html_safe
|
||||
else
|
||||
content = ''
|
||||
end
|
||||
end
|
||||
%>
|
||||
<% if @show_back_and_next_flag!=0 %>
|
||||
|
|
Loading…
Reference in New Issue