From e2c16e193112e476fa5166c881a408e38b5fc46b Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 23 Aug 2012 17:13:33 +0800 Subject: [PATCH] frontend fixes --- .../javascripts/galleryAPI_frontend.js.erb | 17 +++++------------ .../front_end/orbit_galleries/index.html.erb | 17 ++++------------- .../built_in_modules/gallery/config/routes.rb | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 25 deletions(-) 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 4f7a068a..f95a8b9b 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 @@ -51,7 +51,7 @@ var galleryAPI = function(){ if(!$(this).hasClass("active")){ $(this).addClass("active"); if(g.urlVars.length == 0) - window.location = "orbit_gallery?" + $(this).attr("href"); + window.location = "gallery?" + $(this).attr("href"); else window.location = window.location.href +"&"+ $(this).attr("href"); }else{ @@ -115,14 +115,7 @@ var galleryAPI = function(){ }) } - this.deleteAlbum = function(id){ - if(confirm("<%= I18n.t('gallery.del_album?') %>")){ - $.post("delete_album",{aid:id},function(){ - window.location = "orbit_gallery"; - }) - } - } - + this.loadAlbums = function(id){ g.loadFooterPanel(g.loadArea,id,function(headbtn){ headbtn = $(headbtn); @@ -244,7 +237,7 @@ var galleryAPI = function(){ g.albumArea.css("margin-top",""); // var $addsign = $('
Add Album
'); // $addsign.find("a").click(function(){showUploadPanel();}) - $.getJSON("get_images",{aid:id},function(album){ + $.getJSON("panel/gallery/front_end/get_images",{aid:id,"inner":true},function(album){ $.each(album.images,function(i,image){ var thumb = image.file.thumb.url; var $img = $("
"); @@ -447,7 +440,7 @@ var galleryAPI = function(){ } var preparestage = function(albumid){ - $.getJSON("get_images",{aid:albumid},function(album){ + $.getJSON("panel/gallery/front_end/get_images",{aid:albumid,"inner":true},function(album){ imageArray = eval(album.images); $.each(album.images,function(i,image){ if(image._id == id) @@ -456,7 +449,7 @@ var galleryAPI = function(){ bindHandlers(); }) } - g.albumArea.find("#imgholder").load("theater?pic="+id,function(theater,response,xhr){ + g.albumArea.find("#imgholder").load("panel/gallery/front_end/theater?pic="+id+"&inner=true",function(theater,response,xhr){ if(xhr.status == 404){ $(this).text("<%= I18n.t('gallery.pic_not_found') %>."); return false; diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/index.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/index.html.erb index 93fe2d14..c4c0574f 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/index.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/index.html.erb @@ -128,20 +128,11 @@ galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){ var headarea = null; if(area == "images"){ - headarea = '" href="orbit_gallery"><%= I18n.t("gallery.back_to_albums") %> '; - <% if @authenticated %> - headarea+='" href="images" onclick="return false;"><%= I18n.t("gallery.add_images") %> '; - headarea+='" href="delete" onclick="return false;"><%= I18n.t("gallery.del_album") %> '; - headarea+='" href="orbit_gallery?edit='+id+'" ><%= I18n.t("gallery.edit") %>'; - headarea+='" href="" ><%= I18n.t("gallery.album_tag") %>'; - <% end %> - }else if(area == "albums"){ - <% if @authenticated %> - headarea = '" href="albums" onclick="return false;"><%= I18n.t("gallery.add_album") %>'; - <% end %> + headarea = '" href="gallery"><%= I18n.t("gallery.back_to_albums") %> '; + headarea+='" href="" ><%= I18n.t("gallery.album_tag") %>'; + }else if (area == "theater"){ headarea = '"><%= I18n.t("gallery.back_to_photos") %>'; - headarea+= '" href="" ><%= I18n.t("gallery.edit") %>'; headarea+= '" href="" ><%= I18n.t("gallery.photo_tag") %>'; } if(typeof callbackFn == "function"){ @@ -150,7 +141,7 @@ galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){ } <% content_for :page_specific_javascript do %> - <%= javascript_include_tag "galleryAPI" %> + <%= javascript_include_tag "galleryAPI_frontend" %> <%= javascript_include_tag "rss" %> <% end %> diff --git a/vendor/built_in_modules/gallery/config/routes.rb b/vendor/built_in_modules/gallery/config/routes.rb index 8e656f53..ba8840fd 100644 --- a/vendor/built_in_modules/gallery/config/routes.rb +++ b/vendor/built_in_modules/gallery/config/routes.rb @@ -23,7 +23,22 @@ Rails.application.routes.draw do end namespace :front_end do match "orbit_galleries" => "orbit_galleries#index" + match "gallery_category_save" => "orbit_galleries#new_category" + match "categorylist" => "orbit_galleries#categorylist" + match "gallery_category_delete" => "orbit_galleries#gallery_category_delete" + match "add_album" => "orbit_galleries#add_album" + match "create_album" => "orbit_galleries#create_album" match "get_albums" => "orbit_galleries#get_albums" + match "upload_image" => "orbit_galleries#upload_image" + match "upload_panel" => "orbit_galleries#upload_panel" + match "get_images" => "orbit_galleries#get_images" + match "theater" => "orbit_galleries#theater" + match "delete_album" => "orbit_galleries#delete_album" + match "edit_album" => "orbit_galleries#edit_album" + match "set_cover" => "orbit_galleries#set_cover" + match "delete_images" => "orbit_galleries#delete_images" + match "update_album" => "orbit_galleries#update_album" + match "save_tags" => "orbit_galleries#save_tags" end end end