From 9509bdd55ff75c8c43f685de46d99fbf874fb352 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 27 Nov 2013 16:04:44 +0800 Subject: [PATCH] gallery fixed bugs including tags and tags while uploading. --- sftp-config.json | 2 +- .../gallery/app/assets/javascripts/gallery.js | 4 ++++ .../panel/gallery/back_end/album_images_controller.rb | 2 +- .../controllers/panel/gallery/back_end/albums_controller.rb | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sftp-config.json b/sftp-config.json index 0e0efa6c..f489bec4 100644 --- a/sftp-config.json +++ b/sftp-config.json @@ -6,7 +6,7 @@ "type": "sftp", "save_before_upload": true, - "upload_on_save": true, + "upload_on_save": false, "sync_down_on_open": false, "sync_skip_deletes": false, "confirm_downloads": false, diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js b/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js index de2d501c..b0f6e82a 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js @@ -241,6 +241,10 @@ $(function() { var fetchNewImages = function(){ var lastid = ( $("li.rgalbum:last").length ? $("li.rgalbum:last").data("image-id") : null), albumid = $("#fileupload_aid").val(); + + $.getJSON(window.location.pathname, function(json, textStatus) { + photosData = json; + }); $.ajax({ url : "/panel/gallery/back_end/new_images", diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb index 95c26c06..2247592f 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb @@ -54,7 +54,7 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController def image_tagging images = params[:image_ids] - tags = params[:tag_ids] + tags = params[:tag_ids] || [] i = nil images.each do |image| img = AlbumImage.find(image) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index 65569315..c4c52a66 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -156,6 +156,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController @files.each do |file| @image = @album.album_images.new @image.file = file + @image.tagged_ids = @album.tag_ids @image.save! a << {"thumbnail_url"=>@image.file.thumb.url,"url"=>panel_gallery_back_end_album_image_path(@image)} end