From 60c49010706bda7f2a4346f670ccc2eb4debec77 Mon Sep 17 00:00:00 2001 From: manson Date: Mon, 26 May 2014 10:08:14 +0800 Subject: [PATCH] Fix widget when album images less then 9 and fix update method redirect path --- app/controllers/admin/galleries_controller.rb | 2 +- app/controllers/galleries_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index f72f7ea..002597a 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -192,7 +192,7 @@ class Admin::GalleriesController < OrbitAdminController end update_children_image_tag(tagsToDestroy,tagsToAdd) @album.update_attributes(album_params) - redirect_to admin_gallery_path(@album) + redirect_to "/admin/galleries/"+@album.id.to_s end def update_children_image_tag(tagsToDestroy,tagsToAdd) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index c5f4d15..e609f0a 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -32,9 +32,9 @@ class GalleriesController < ApplicationController def widget albums = Album.filter_by_widget_categories params = OrbitHelper.params - + images = [] - while images.count < 9 + while images.count < 9 and images.count < AlbumImage.count albums.each do |album| img = album.album_images.sample if !images.include?(img) && img != nil