parent
4d4a2dc766
commit
20d35e7162
|
@ -1,12 +1,8 @@
|
|||
class PersonalBooksController < ApplicationController
|
||||
def search_all_words(target,word)
|
||||
target=target.upcase
|
||||
words=word.upcase.split(' ')
|
||||
return words.select{|value| target.include? value}==words
|
||||
end
|
||||
def index
|
||||
params = OrbitHelper.params
|
||||
books = Book.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
page_data_count = OrbitHelper.page_data_count
|
||||
books = Book.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(page_data_count)
|
||||
page = Page.where(:page_id => params[:page_id]).first rescue nil
|
||||
|
||||
if page.custom_string_field == "table"
|
||||
|
@ -53,8 +49,8 @@ class PersonalBooksController < ApplicationController
|
|||
else
|
||||
page_to_show = params[:page_no].to_i
|
||||
end
|
||||
books = books_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
|
||||
books_total_pages = (books_show.length/OrbitHelper.page_data_count.to_f).ceil
|
||||
books = books_show[(page_to_show-1)page_data_count...page_to_show*page_data_count]
|
||||
books_total_pages = (books_show.length/page_data_count.to_f).ceil
|
||||
else
|
||||
books_total_pages = books.total_pages
|
||||
end
|
||||
|
@ -179,4 +175,10 @@ class PersonalBooksController < ApplicationController
|
|||
page.save
|
||||
render :json => {"success" => true}.to_json
|
||||
end
|
||||
private
|
||||
def search_all_words(target,word)
|
||||
target=target.upcase
|
||||
words=word.upcase.split(' ')
|
||||
return words.select{|value| target.include? value}==words
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue