fix css error and auto set album cover if it has album_image
This commit is contained in:
parent
05ae474a42
commit
fbbf911193
|
@ -1,4 +1,7 @@
|
||||||
var GalleryTheater = function(){
|
var GalleryTheater = function(){
|
||||||
|
var parent_divs = $('.gallery').parents('div'),
|
||||||
|
parent_div_z_index = parent_divs.eq(parent_divs.length-1).css('z-index')
|
||||||
|
parent_divs.eq(parent_divs.length-1).css('z-index','2000')
|
||||||
var gt = this,
|
var gt = this,
|
||||||
currentPic = {},
|
currentPic = {},
|
||||||
windowHeight = 0,
|
windowHeight = 0,
|
||||||
|
@ -25,6 +28,7 @@ var GalleryTheater = function(){
|
||||||
gt.thumbStrip = null;
|
gt.thumbStrip = null;
|
||||||
gt.descriptionArea = null;
|
gt.descriptionArea = null;
|
||||||
gt.isTheaterInitialized = false;
|
gt.isTheaterInitialized = false;
|
||||||
|
|
||||||
var play_flag = false;
|
var play_flag = false;
|
||||||
var button_left_string = '<button id ="theaterPreviousButton" class="theaterButton">< </button>',
|
var button_left_string = '<button id ="theaterPreviousButton" class="theaterButton">< </button>',
|
||||||
button_right_string = '<button id ="theaterNextButton" class="theaterButton">> </button>',
|
button_right_string = '<button id ="theaterNextButton" class="theaterButton">> </button>',
|
||||||
|
@ -172,6 +176,7 @@ var GalleryTheater = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
gt.destroyTheater = function(){
|
gt.destroyTheater = function(){
|
||||||
|
parent_divs.eq(parent_divs.length-1).css('z-index',parent_div_z_index)
|
||||||
gt.stage.hide();
|
gt.stage.hide();
|
||||||
$("body").removeClass("gallery-mode-on");
|
$("body").removeClass("gallery-mode-on");
|
||||||
gt.imageContainer.empty()
|
gt.imageContainer.empty()
|
||||||
|
|
|
@ -20,7 +20,6 @@ class Album
|
||||||
has_many :album_colors, :autosave => true, :dependent => :destroy
|
has_many :album_colors, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :album_images, :allow_destroy => true
|
accepts_nested_attributes_for :album_images, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :album_colors, :allow_destroy => true
|
accepts_nested_attributes_for :album_colors, :allow_destroy => true
|
||||||
|
|
||||||
def self.find_by_param(input)
|
def self.find_by_param(input)
|
||||||
self.find_by(uid: input)
|
self.find_by(uid: input)
|
||||||
end
|
end
|
||||||
|
@ -49,4 +48,18 @@ class Album
|
||||||
self.where(:id.in=>taggings)
|
self.where(:id.in=>taggings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def cover
|
||||||
|
tmp = self['cover']
|
||||||
|
if tmp=='default'
|
||||||
|
tmp = (self.album_images.first.id.to_s rescue 'default')
|
||||||
|
end
|
||||||
|
tmp
|
||||||
|
end
|
||||||
|
def cover_path
|
||||||
|
tmp = self['cover_path']
|
||||||
|
if tmp.nil?
|
||||||
|
tmp = (self.album_images.first.file.thumb.url rescue nil)
|
||||||
|
end
|
||||||
|
tmp
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue