removed unknown authorization error for gallery frontend

This commit is contained in:
Harry Bomrah 2014-10-20 20:25:58 +08:00
parent c7bebc6e0a
commit 5f3d97d7c2
5 changed files with 30 additions and 8 deletions

View File

@ -231,15 +231,15 @@ var galleryAPI = function(){
updateNavigation();
}
var preparestage = function(albumid){
$.getJSON("/admin/galleries/"+albumid+"/imgs", function(album){
imageArray = eval(album.images);
$.each(album.images,function(i,image){
var preparestage = function(images){
// $.getJSON("/galleries/imgs?id=" + albumid, function(album){
imageArray = images;
$.each(images,function(i,image){
if(image._id == id)
imagecount = i;
})
bindHandlers();
})
// })
}
// if(rcom.getInternetExplorerVersion()!=-1){
// var url_constructor = window.location.href.split("/");
@ -258,7 +258,7 @@ var galleryAPI = function(){
var albumid = $("#main_pic").attr("data-content");
g.albumArea.css("margin-bottom","0");
// picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
preparestage(albumid);
preparestage(json_image_data);
}
this.loadcomplete = function(){

View File

@ -125,7 +125,8 @@ class Admin::GalleriesController < OrbitAdminController
end
def imgs
@album = Album.find(params[:gallery_id])
@album = Album.find(params[:id])
debugger
@tag_names = Array.new
@images = @album.album_images.all
@output = Array.new

View File

@ -65,6 +65,22 @@ class GalleriesController < ApplicationController
}
end
def imgs(album_id)
album = Album.find(album_id)
tag_names = Array.new
images = album.album_images.all
output = Array.new
images.each do |values|
output << { _id: values.id.to_s,
description: values.description,
title: values.title,
file: values.file.as_json[:file],
gallery_album_id: values.album_id,
tags: values.tags}
end
return output
end
def theater
params = OrbitHelper.params
image = AlbumImage.find(params[:uid])
@ -75,6 +91,7 @@ class GalleriesController < ApplicationController
"album" => album,
"images" => images,
"image" => image,
"wall_images" => imgs(albumid),
"back_to_albums" => OrbitHelper.url_to_show(album.to_param)
}
end

View File

@ -3,8 +3,11 @@
@album = data["album"]
@image = data["image"]
@back_link = data["back_to_albums"]
@wall_images = data["wall_images"]
%>
<script type="text/javascript">
var json_image_data = <%= @wall_images.to_json.html_safe %>;
</script>
<%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg">

View File

@ -19,5 +19,6 @@ Rails.application.routes.draw do
post "galleries/image_tagging" => "images#image_tagging"
# match "image_tagging" => "album_images#image_tagging"
end
end
end