ordering added to albums

This commit is contained in:
harrybomrah committed 2015-04-16 23:10:25 +08:00
1 parent 7e432bd1ed
commit 8aead66ac5
8 files changed
+55 -27

No files matched your search

@@ -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
+18 -6
View File
@@ -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
+1 -1
View File
@@ -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,