Mostly fixed the packages list, grid and detail views

This commit is contained in:
Christoph Haas 2014-11-30 16:07:28 +01:00
parent 43a8ea9dd3
commit 1c59a5ac74
7 changed files with 206 additions and 1 deletions

View file

@ -12,7 +12,24 @@ class PackagesController < ApplicationController
@packages = @packages.where("screenshots.approved"=>true)
end
@packages = @packages.page(params[:page]).per(12)
if params[:show]=='with'
@packages = @packages.with_screenshots
logger.debug 'Limiting packages to those with screenshots'
elsif params[:show]=='without'
@packages = @packages.without_screenshots
logger.debug 'Limiting packages to those without screenshots'
end
# Show packages as list or grid
if params['view']=='list'
# List view
@packages = @packages.paginate(page: params[:page], per_page: 12)
render 'packages/index-list.slim'
else
# Grid view
@packages = @packages.paginate(page: params[:page], per_page: 24)
render 'packages/index-grid.slim'
end
end
def details