diff --git a/app/assets/javascripts/rss.js b/app/assets/javascripts/rss.js index a82d86fa..b7e67fcb 100644 --- a/app/assets/javascripts/rss.js +++ b/app/assets/javascripts/rss.js @@ -346,6 +346,9 @@ getUrlVars : function(){ vars.push(hash[0]); vars[hash[0]] = hash[1]; } + if(vars[0] == window.location.href){ + vars =[]; + } return vars; }, /*function to open a modalwindow on a page.. self reliant no images, no css needed. diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 614424d7..e6954af6 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -68,7 +68,7 @@ <% end -%> -<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') do -%> +<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb index b057a69d..b9bb3a47 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb @@ -4,6 +4,7 @@ var galleryAPI = function(){ this.urlVars = rcom.getUrlVars(); this.albumArea = $("#orbit_gallery"); this.loadArea = ""; + // this.authenticated = false; this.initialize = function(){ $(document).ready(function(){ bindHandlers(); @@ -19,6 +20,9 @@ var galleryAPI = function(){ }else if(typeof g.urlVars['edit']!= "undefined"){ g.editAlbum(g.urlVars['edit']); g.loadArea = "edit"; + }else if(typeof g.urlVars['tag']!= "undefined"){ + g.loadAlbums(g.urlVars['tag']); + g.loadArea = "albums"; }else{ g.loadAlbums("all"); g.loadArea = "albums"; @@ -28,7 +32,7 @@ var galleryAPI = function(){ $("#filter .filter_btns a").click(function(){ if(!$(this).hasClass("active")){ $(this).addClass("active"); - if(typeof g.urlVars['cat'] == "undefined") + if(g.urlVars.length == 0) window.location = "orbit_gallery?" + $(this).attr("href"); else window.location = window.location.href +"&"+ $(this).attr("href"); @@ -45,6 +49,22 @@ var galleryAPI = function(){ } }) } + $("#filter .filter-clear a").click(function(){ + var loc = window.location.href; + var url = null; + var forwhat = $(this).attr("for"); + $("#filter ."+forwhat+" a.active").each(function(){ + $(this).removeClass("active"); + url = loc.replace($(this).attr("href")+"&",""); + if(url == loc) + url = loc.replace($(this).attr("href"),""); + + if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?") + url = url.substr(0,url.length-1); + loc = url; + }) + window.location = url; + }) } this.makeNewAlbum = function(){ $.get("add_album",function(html){ @@ -91,19 +111,29 @@ var galleryAPI = function(){ g.albumArea.find("#imgholder").empty(); var $addsign = $('
'); $addsign.find("a").click(function(){g.makeNewAlbum();}) + if(id!="all"){ - var ids = []; + 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('='); - ids.push(hash[1]); - var href = "cat="+hash[1]; + 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 ids = "all"; + var cids = "all"; } - $.getJSON("get_albums",{cid:ids},function(categories){ + $.getJSON("get_albums",{cid:cids,tid:tids},function(categories){ $.each(categories,function(x,category){ $.each(category,function(i,album){ if(album.cover == "default") @@ -117,12 +147,13 @@ var galleryAPI = function(){ }) } this.loadImages = function(id){ - //