Skip to content

Commit

Permalink
Fixes picture per page in overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Sep 20, 2018
1 parent 0dbd7f2 commit db2af65
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/controllers/alchemy/admin/pictures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@ def destroy
end

def items_per_page
cookies[:alchemy_pictures_per_page] = params[:per_page] || cookies[:alchemy_pictures_per_page] || pictures_per_page_for_size(@size)
if in_overlay?
case @size
when 'small' then 25
when 'large' then 4
else
9
end
else
cookies[:alchemy_pictures_per_page] = params[:per_page] || cookies[:alchemy_pictures_per_page] || pictures_per_page_for_size(@size)
end
end

def items_per_page_options
Expand All @@ -125,12 +134,10 @@ def items_per_page_options

def pictures_per_page_for_size(size)
case size
when 'small'
in_overlay? ? 25 : 60
when 'large'
in_overlay? ? 4 : 12
when 'small' then 60
when 'large' then 12
else
in_overlay? ? 9 : 20
20
end
end

Expand Down

0 comments on commit db2af65

Please sign in to comment.