From 05dbffd4f6bc5c89ce4edbce37d31805b415beb3 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Fri, 7 Feb 2014 22:15:51 +0100 Subject: [PATCH] foto gallery fix --- app/controllers/galleries_controller.rb | 7 +++++-- app/views/galleries/show.html.erb | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 257ce39..5906b5c 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -21,14 +21,17 @@ class GalleriesController < ApplicationController @pppage_array = [ 25 , 50 , 100 ] #defines number & size of picture chunks @pppage = 0 #starting index of pppage_array - + if params[:pppage].to_i <= 2 && params[:pppage].to_i >= 0 @pppage = params[:pppage].to_i end @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)) + @fotos = Foto.where(:gallery_id => params[:id]) @pages = (Foto.where(:gallery_id => params[:id]).count/(@pppage_array[@pppage])+1) +@showind=[] + @showind.fill(0,@pppage_array[@pppage]){ |i| i+ @pppage_array[@pppage]*(@page-1)} # Hier ausrechnen welche angezeigt werden sollen @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('fotos.new-fotos'), :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-arrow-left', :text=>I18n.t('common.back'), :path=>galleries_path()} diff --git a/app/views/galleries/show.html.erb b/app/views/galleries/show.html.erb index c1be0f8..5a38c19 100644 --- a/app/views/galleries/show.html.erb +++ b/app/views/galleries/show.html.erb @@ -56,10 +56,10 @@