FIX: Correct calculation of necessary pages + change from debug size
This commit is contained in:
@@ -19,7 +19,7 @@ class GalleriesController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
@gallery = Gallery.find(params[:id])
|
@gallery = Gallery.find(params[:id])
|
||||||
|
|
||||||
@pppage_array = [ 5 , 50 , 100 ] #defines number & size of picture chunks
|
@pppage_array = [ 25 , 50 , 100 ] #defines number & size of picture chunks
|
||||||
@pppage = 0 #starting index of pppage_array
|
@pppage = 0 #starting index of pppage_array
|
||||||
|
|
||||||
if params[:pppage].to_i <= 2 && params[:pppage].to_i >= 0
|
if params[:pppage].to_i <= 2 && params[:pppage].to_i >= 0
|
||||||
@@ -28,7 +28,7 @@ class GalleriesController < ApplicationController
|
|||||||
|
|
||||||
@page = params[:page].nil? ? 1 : params[:page].to_i
|
@page = params[:page].nil? ? 1 : params[:page].to_i
|
||||||
@fotos = Foto.where(:gallery_id => params[:id]).limit(@pppage_array[@pppage]).offset(@pppage_array[@pppage]*(@page-1))
|
@fotos = Foto.where(:gallery_id => params[:id]).limit(@pppage_array[@pppage]).offset(@pppage_array[@pppage]*(@page-1))
|
||||||
@pages = (Foto.where(:gallery_id => params[:id]).count/5)+1
|
@pages = (Foto.where(:gallery_id => params[:id]).count/(@pppage_array[@pppage])+1)
|
||||||
@toolbar_elements << {:hicon=>'icon-plus', :text=> "NewFoto", :path=>new_gallery_foto_path(@gallery)}
|
@toolbar_elements << {:hicon=>'icon-plus', :text=> "NewFoto", :path=>new_gallery_foto_path(@gallery)}
|
||||||
@toolbar_elements << {:hicon=>'icon-pencil', :text => I18n.t('common.edit'), :path=>edit_gallery_path(@gallery)}
|
@toolbar_elements << {:hicon=>'icon-pencil', :text => I18n.t('common.edit'), :path=>edit_gallery_path(@gallery)}
|
||||||
@toolbar_elements << {:text=>"Back", :path=>galleries_path()}
|
@toolbar_elements << {:text=>"Back", :path=>galleries_path()}
|
||||||
|
|||||||
Reference in New Issue
Block a user