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

View File

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

View File

@ -65,6 +65,22 @@ class GalleriesController < ApplicationController
} }
end 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 def theater
params = OrbitHelper.params params = OrbitHelper.params
image = AlbumImage.find(params[:uid]) image = AlbumImage.find(params[:uid])
@ -75,6 +91,7 @@ class GalleriesController < ApplicationController
"album" => album, "album" => album,
"images" => images, "images" => images,
"image" => image, "image" => image,
"wall_images" => imgs(albumid),
"back_to_albums" => OrbitHelper.url_to_show(album.to_param) "back_to_albums" => OrbitHelper.url_to_show(album.to_param)
} }
end end

View File

@ -3,8 +3,11 @@
@album = data["album"] @album = data["album"]
@image = data["image"] @image = data["image"]
@back_link = data["back_to_albums"] @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" %> <%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg"> <div id="orbit_gallery" class="rg">

View File

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