This commit is contained in:
yanxd 2014-01-15 14:28:36 +08:00
parent 61380a5e1a
commit 45f8b15083
4 changed files with 10 additions and 8 deletions

View File

@ -625,7 +625,7 @@ class ApplicationController < ActionController::Base
@obj_count = obj.count
@obj_pages = Paginator.new @obj_count, pre_size, params['page']
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset).all
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
elsif obj.kind_of? Array
obj[@obj_pages.offset, @obj_pages.per_page]
else

View File

@ -15,8 +15,7 @@ class StoresController < ApplicationController
reorder("created_on DESC")
result = result.to_a
result.map { |res| result.delete(res) if res.container.nil?}
@searched_attach = result
return @searched_attach
@searched_attach = paginateHelper result
end
LIMIT = 12 unless const_defined?(:LIMIT)

View File

@ -24,7 +24,8 @@ module StoresHelper
when 'Bid'
bid_path(container)
else
'#'#logger.error "StoresHelper#attachUrl unkown type ==> #{container}"
Rails.logger.error "ERROR: StoresHelper#attachUrl unkown type ==> #{container}"
'#'
end
end
@ -32,6 +33,8 @@ module StoresHelper
come_from_local(attachment).join(" > ").html_safe
end
private
WORD_LIMIT = 100
def come_from_local attachment
@ -93,8 +96,6 @@ module StoresHelper
end
end
private
def project_link project
if project.nil?
Rails.logger.error "ERROR: attachment type unkown #project_link project.nil?"
@ -123,7 +124,7 @@ module StoresHelper
when 3 # 作业
if bid.courses.first.nil?
Rails.logger.error "ERROR: attachment type unkown #bid_link/when 3"
return [link_to(bid.id, '#')]
return [link_to('unkown', '#')]
end
bid_list = link_to l(:label_homework), project_homework_path(bid.courses.first)
bid_item = link_to bid.name, respond_path(bid)

View File

@ -35,4 +35,6 @@
<% end %>
<!-- <%= @searched_attach.to_s %> -->
<!-- <%= @searched_attach.to_s %> -->
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>