class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
	include AdminHelper

	# before_filter :force_order_for_visitor,:only=>[:index]
  before_filter :force_order_for_user#,:except => [:index]

	def show
		if is_manager? || is_admin? || is_sub_manager?
			@authenticated = true  #turn this value to false for view only
		else
			@authenticated = false
		end
		@tags = GalleryTag.all
		@image = GalleryImage.find(params[:id])
		@albumid = @image.gallery_album_id
		@album = GalleryAlbum.find(@albumid)
		@images = @album.gallery_images.all
	end


	def destroy
		images = params['images']
		images.each do |image|
			img = GalleryImage.find(image)
			img.delete
		end
		if params['delete_cover'] == "true"
			album = GalleryAlbum.find(params['id'])
			album.update_attributes(:cover=>"default")
		end
		render :json =>{"success"=>true}.to_json
	end

end
