From c158108576f16d28ca0e20892ee6cd144a915293 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 6 Nov 2013 15:23:28 +0800 Subject: [PATCH] gallery all bugs fixed.. --- .../gallery/app/assets/javascripts/gallery.js | 2 +- .../app/assets/javascripts/galleryAPI.js.erb | 1 + .../app/assets/stylesheets/gallery.css | 6 ++++++ .../app/assets/stylesheets/gallery_old.css | 4 ++-- .../gallery/back_end/albums_controller.rb | 21 ++++++++++++------- .../gallery/back_end/albums/_album.html.erb | 5 +++-- .../gallery/back_end/albums/_form.html.erb | 17 ++++----------- .../gallery/back_end/albums/index.html.erb | 6 ++++++ .../gallery/back_end/albums/show.html.erb | 2 +- 9 files changed, 38 insertions(+), 26 deletions(-) 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 7bf7ce183..8c1138393 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js @@ -239,7 +239,7 @@ $(function() { } }); var fetchNewImages = function(){ - var lastid = $("li.rgalbum:last").data("image-id"), + var lastid = ( $("li.rgalbum:last").length ? $("li.rgalbum:last").data("image-id") : null), albumid = $("#fileupload_aid").val(); $.ajax({ 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 5082929d2..d4e5a6188 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 @@ -13,6 +13,7 @@ var galleryAPI = function(){ this.loading = $("#loading"); this.loadTheater = function(id){ + $( ".breadcrumb li:eq(1) a" ).attr("href","/panel/gallery/back_end/albums"); g.loadstart(); var imageArray; var imagecount = 0; diff --git a/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery.css b/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery.css index 12b870775..1b166cba8 100644 --- a/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery.css +++ b/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery.css @@ -230,6 +230,12 @@ #imgholder .rgalbum a img { max-width: none; } + +.gallery_info.clearfix a { + max-height: 20px; + max-width: 15px; +} + #imgholder .rgalbum .check { position: absolute; top: 0; diff --git a/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_old.css b/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_old.css index 37cbec2e9..a3a2cb5e0 100755 --- a/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_old.css +++ b/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_old.css @@ -557,8 +557,8 @@ } #loading{ - background: #fff 0 center url("../../../assets/gallery/ajax-loader.gif") no-repeat; + background: #fff 0 center url("../../../assets/loading.gif") no-repeat; height: 16px; margin: auto; - width: 32px; + width: 220px; } 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 9a5a301ad..0240663dc 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 @@ -155,10 +155,15 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController render :json=>{"files"=>a}.to_json end - def new_images - @lastimage = GalleryImage.find(params[:last_image_id]) - @album = GalleryAlbum.find(params[:album_id]) - @newimages = @album.gallery_images.where(:created_at.gt => @lastimage.created_at) + def new_images + if params[:last_image_id] != "" + @lastimage = GalleryImage.find(params[:last_image_id]) + @album = GalleryAlbum.find(params[:album_id]) + @newimages = @album.gallery_images.where(:created_at.gt => @lastimage.created_at) + else + @album = GalleryAlbum.find(params[:album_id]) + @newimages = @album.gallery_images + end render :layout=>false end @@ -184,9 +189,11 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController tagsToDestroy << tag end end - new_tags.each do |tag| - if !old_tags.include?(tag) - tagsToAdd << tag + if new_tags != nil + new_tags.each do |tag| + if !old_tags.include?(tag) + tagsToAdd << tag + end end end update_children_image_tag(tagsToDestroy,tagsToAdd) diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb index a69d80cf8..0e3ffea0a 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/_album.html.erb @@ -8,9 +8,10 @@

<%= album.name %>