frontend fixes

This commit is contained in:
Harry Bomrah 2012-08-23 17:13:33 +08:00
parent 1e4d534908
commit e2c16e1931
3 changed files with 24 additions and 25 deletions

View File

@ -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,13 +115,6 @@ 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){
@ -244,7 +237,7 @@ var galleryAPI = function(){
g.albumArea.css("margin-top","");
// var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
// $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 = $("<div class='rgphoto'><a title='"+image.description+"' href='?theater="+image._id+"'><img src='"+thumb+"'/></a></div>");
@ -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;

View File

@ -128,20 +128,11 @@
galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){
var headarea = null;
if(area == "images"){
headarea = '<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="orbit_gallery"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a> ';
<% if @authenticated %>
headarea+='<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a> ';
headarea+='<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a> ';
headarea+='<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="orbit_gallery?edit='+id+'" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>';
headarea = '<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="gallery"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a> ';
headarea+='<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></a>';
<% end %>
}else if(area == "albums"){
<% if @authenticated %>
headarea = '<a class="btn btn-primary pull-right" title="<%= I18n.t("gallery.add_album") %>" href="albums" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_album") %></a>';
<% end %>
}else if (area == "theater"){
headarea = '<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
headarea+= '<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>';
headarea+= '<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>';
}
if(typeof callbackFn == "function"){
@ -150,7 +141,7 @@ galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){
}
</script>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI" %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "rss" %>
<% end %>

View File

@ -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