diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb index 25e8a735..37446401 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb @@ -41,32 +41,11 @@ var galleryAPI = function(){ } - this.loadAlbums = function(id){ + this.loadAlbums = function(cids){ g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))}); g.albumArea.addClass('o_gallery'); g.albumArea.find("#imgholder").empty(); - if(id!="all"){ - var cids = []; - var tids = []; - var href = null; - var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); - for(var i = 0; i < hashes.length; i++){ - hash = hashes[i].split('='); - if(hash[0]=="cat"){ - cids.push(hash[1]); - href = "cat="+hash[1]; - }else if(hash[0]=="tag"){ - tids.push(hash[1]); - href = "tag="+hash[1]; - } - $("#filter .filter_btns a[href='"+href+"']").addClass("active"); - } - if(cids.length == 0) - cids = "all"; - }else{ - var cids = "all"; - } - $.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"tid":tids,"inner":true},function(categories){ + $.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"inner":true},function(categories){ $.each(categories,function(x,category){ $.each(category,function(i,album){ album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>") diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb index 47795b70..22e66415 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb @@ -1,5 +1,6 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController def index + @categories = params[:category_id] end def show @@ -9,36 +10,10 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController def get_albums @categoryids = params["cid"] - @tags = params["tid"] @albums = Array.new - if @categoryids == "all" - if @tags - if @tags.kind_of?(Array) - @tags.each do |tag| - @albums << GalleryAlbum.where(tagged_ids: tag) - end - else - @albums << GalleryAlbum.where(tagged_ids: @tags) - end - else - @albums << GalleryAlbum.all - end - else - @categoryids.each do |id| - category = Category.find(id) - if @tags - if @tags.kind_of?(Array) - @tags.each do |tag| - @albums << category.gallery_albums.where(tagged_ids: tag) - end - else - @albums << category.gallery_albums.where(tagged_ids: @tags) - end - else - @albums << category.gallery_albums.all - end - end - end + @albums << GalleryAlbum.where(:category_id.in => @categoryids) + + @output = Array.new @albums.each do |album| @albs = Array.new diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb index c56a4a8a..a99f04aa 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb @@ -27,16 +27,9 @@ diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb index a06c1ad7..4f3c9e40 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb @@ -18,10 +18,7 @@ -
-
- " href="<%= panel_gallery_front_end_albums_path %>"> <%= I18n.t("gallery.back_to_albums") %> -
+