26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/platform/apps_controller.rb', line 26
def index
unless Platform::Config.enable_app_directory?
return redirect_to(:controller=>"/platform/developer/apps", :action=>"index")
end
@categories = Platform::Category.root.children
@category = Platform::Category.find(params[:cat_id]) if params[:cat_id]
@category = @categories.first unless @category
@featured_apps = []
@apps = []
@search_apps = []
if params[:search].blank?
@featured_apps = Platform::Application.featured_for_category(@category, page, Platform::Config.featured_apps_per_page)
@apps = Platform::Application.regular_for_category(@category, page, Platform::Config.suggested_apps_per_page)
else
@category = nil
conditions = []
@search_apps = Platform::Application.where("name like ? or description like ?", "%#{params[:search]}%", "%#{params[:search]}%").page(page).per(Platform::Config.searched_apps_per_page).order("name asc")
end
end
|