module Admin::OlympiamanagementsHelper
def create_pagination(page=1,fields=ClassSettingFields)
page = 1 if page == 0
per_page_num = 10
all_page_num = fields.all.count / per_page_num + 1
pagination = '
'+((I18n.locale.to_s == 'zh_tw') ? "第 #{page} 頁" : "page #{page}") +'/'+ ((I18n.locale.to_s == 'zh_tw') ? "共 #{all_page_num} 頁" : "Total #{all_page_num} page(s)")+'
'+
((page == 1) ? '- ['+t('olympiamanagement.prev_page')+']
' : '- ['+t('olympiamanagement.prev_page')+']
')
(1..all_page_num).to_a.each{|page_num| pagination += ((page_num == page) ? '- '+page_num.to_s+'
' : '- '+page_num.to_s+'
')}
pagination += (((page==all_page_num) ? '- ['+t('olympiamanagement.next_page')+']
' : '- ['+t('olympiamanagement.next_page')+']
')+'
')
end
end