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 435a71ff..ed1d360f 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 @@ -246,8 +246,6 @@ var galleryAPI = function(){ g.albumArea.find("#imgholder").empty(); $("#filter").remove(); g.albumArea.css("margin-top",""); - // var $addsign = $('
Add Album
'); - // $addsign.find("a").click(function(){showUploadPanel();}) $.getJSON("get_images",{aid:id},function(album){ $.each(album.images,function(i,image){ var thumb = image.file.thumb.url; @@ -255,10 +253,16 @@ var galleryAPI = function(){ g.albumArea.find("#imgholder").append($img); }) g.tagList.find("input").attr("checked",false); - $.each(album.tags,function(i,tag){ - - g.tagList.find("li[data-content="+tag+"] input").attr("checked",true); - }) + if(typeof album.tag_names == "undefined"){ + $.each(album.tags,function(i,tag){ + g.tagList.find("li[data-content="+tag+"] input").attr("checked",true); + }) + }else{ + $.each(album.tag_names,function(i,tagname){ + $li = $("
  • "+tagname+"
  • "); + g.tagList.append($li); + }) + } // g.albumArea.find("#imgholder").append($addsign); }) // g.albumArea.find("#imgholder").append($addsign); diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb index dcd99cb0..d1bbcaf0 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb @@ -1,8 +1,9 @@ class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController include AdminHelper + @authenticated = false def index if is_manager? || is_admin? || is_sub_manager? - @authenticated = true #turn this value to false for view only + @authenticated = false #turn this value to false for view only else @authenticated = false end @@ -126,7 +127,26 @@ include AdminHelper def get_images @album = GalleryAlbum.find(params["aid"]) - render :json=>{"images" => @album.gallery_images.all, "tags" => @album.tag_ids}.to_json + @tag_names = Array.new + @images = @album.gallery_images.all + @output = Array.new + @images.each do |values| + tags = Array.new + values.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + + @output << {"_id"=>values.id,"description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags} + end + @authenticated = false + if @authenticated + render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json + else + @album.tag_ids.each do |tag| + @tag_names << GalleryTag.find(tag)[I18n.locale] + end + render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json + end end def theater diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb index 5f47d692..8ecc4ba4 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb @@ -86,24 +86,20 @@ include AdminHelper end end end - i = 0 + @output = Array.new @albums.each do |album| + @albs = Array.new album.each do |values| - # if values.tag_ids.kind_of?(Array) tags = Array.new - values.tag_ids.each do |tag| - tags << GalleryTag.find(tag)[I18n.locale] - end - # end - values.tag_names = tags - values.save + values.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + category = GalleryCategory.find(values.gallery_category_id).name + @albs << {"_id"=>values.id,"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags} end - i = i + 1 + @output << @albs end - # @albums = GalleryAlbum.find("5017a7babd98eb049900000a") - # @albums.update_attributes({:tag_ids =>["501ba786bd98eb0232000126"]}) - - render :json=>@albums.to_json + render :json=>@output.to_json end def upload_image diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb index 51b0a527..4126a2b6 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb @@ -68,7 +68,6 @@ - <% if @authenticated %>
    @@ -86,16 +85,20 @@
    - + <% if @authenticated %> + + <% end %>
    - <% end %> +