diff --git a/app/assets/javascripts/gallery.js b/app/assets/javascripts/gallery.js index 25e12d7..11563d3 100644 --- a/app/assets/javascripts/gallery.js +++ b/app/assets/javascripts/gallery.js @@ -43,10 +43,10 @@ $(function() { $img = $('.rgalbum img'); $('.rgalbum > a').rsImg(); if($containerData.galleryId == 'gallery') { - $container.masonry({ - itemSelector : '.rgalbum', - isAnimated: true, - }); + // $container.masonry({ + // itemSelector : '.rgalbum', + // isAnimated: true, + // }); $albumname.each(function(i) { var $albumblock = $(this).closest('a').height(), $H = $(this).outerHeight(true); @@ -69,12 +69,7 @@ $(function() { }; }); $('#orbit_gallery').delegate('.icons-tag', clickEvent, function(){ - $(this).parents('.gallery_info').nextAll('.albumtag').slideToggle(300, function() { - $container.masonry({ - itemSelector : '.rgalbum', - isAnimated: true, - }); - }); + $(this).parents('.gallery_info').nextAll('.albumtag').slideToggle(300); }); }; }); @@ -229,11 +224,12 @@ $(function() { $container.data("order-edit","1"); el.text("Save Order"); }else{ - var temp = $container.sortable( "toArray", { attribute: "data-image-id" }); + var temp = $container.sortable( "toArray", { attribute: "data-image-id" }), + type = $container.attr("id"); if(images_order.toString() != temp.toString()){ $.ajax({ url : "/admin/galleries/order", - data : {"imageids" : temp }, + data : {"imageids" : temp, "type" : type}, type : "post", dataType : "json" }) diff --git a/app/assets/stylesheets/gallery.css b/app/assets/stylesheets/gallery.css index 53d8c79..920a349 100644 --- a/app/assets/stylesheets/gallery.css +++ b/app/assets/stylesheets/gallery.css @@ -4,10 +4,17 @@ list-style: none; } #orbit_gallery .rgalbum { + position: relative; + float: left; margin: 5px; - padding: 10px; + padding: 5px; width: 200px; background: #FFFFFF; + overflow: hidden; + -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -o-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); -webkit-transition-property: left, right, top; -moz-transition-property: left, right, top; -ms-transition-property: left, right, top; @@ -522,6 +529,7 @@ .order-edit-notification{ background-color: #ffffd5; + z-index: 10; display: none; height: 25px; margin-left: 40%; diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index 60627e2..a77a1af 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -4,7 +4,7 @@ class Admin::GalleriesController < OrbitAdminController before_action :log_user_action layout "back_end" def index - @albums = Album.all + @albums = Album.all.asc(:order) @tags = @module_app.tags end diff --git a/app/controllers/admin/images_controller.rb b/app/controllers/admin/images_controller.rb index e71d03b..536d78b 100644 --- a/app/controllers/admin/images_controller.rb +++ b/app/controllers/admin/images_controller.rb @@ -8,12 +8,24 @@ class Admin::ImagesController < OrbitAdminController end def changeorder - images = params[:imageids] - images.each_with_index do |image, i| - img = AlbumImage.find(image) rescue nil - if !img.nil? - img.order = i - img.save + type = params[:type] + if type == "imgholder" + images = params[:imageids] + images.each_with_index do |image, i| + img = AlbumImage.find(image) rescue nil + if !img.nil? + img.order = i + img.save + end + end + elsif type == "orbit_gallery" + albums = params[:imageids] + albums.each_with_index do |albumid, i| + album = Album.find(albumid) rescue nil + if !album.nil? + album.order = i + album.save + end end end render :json => {"success" => true}.to_json diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 5494361..68b23e7 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -1,6 +1,6 @@ class GalleriesController < ApplicationController def index - albums = Album.filter_by_categories + albums = Album.filter_by_categories.asc(:order) galleries = albums.collect do |a| { "album-name" => a.name, diff --git a/app/models/album.rb b/app/models/album.rb index 7481441..aea0e8a 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -13,6 +13,7 @@ class Album field :tag_names field :uid, type: String field :rss2_id, type: String + field :order, type: Integer, default: 0 # has_and_belongs_to_many :tags, :class_name => "GalleryTag" has_many :album_images, :autosave => true, :dependent => :destroy diff --git a/app/views/admin/galleries/_album.html.erb b/app/views/admin/galleries/_album.html.erb index bbce8f8..5562c90 100644 --- a/app/views/admin/galleries/_album.html.erb +++ b/app/views/admin/galleries/_album.html.erb @@ -1,4 +1,4 @@ -