Major updates for gallery
This commit is contained in:
parent
929cd3b0cc
commit
17dffb15e1
|
@ -181,7 +181,12 @@ var galleryAPI = function(){
|
|||
var $slidelist = $('.slidelist'),
|
||||
$rslide = $('.rslide'),
|
||||
$rslidenav = $('.rslidenav'),
|
||||
$img = $("#main_pic img");
|
||||
$img = $("#main_pic img"),
|
||||
wHeight = $(window).height();
|
||||
|
||||
$("#main_pic").height(picHeight);
|
||||
$img.height("100%");
|
||||
|
||||
$(".slidectrl a.togglelist").click(function(){
|
||||
var rslide_h = $rslide.outerHeight();
|
||||
if ( $slidelist.height() < 1 ){
|
||||
|
@ -195,6 +200,9 @@ var galleryAPI = function(){
|
|||
$(".slidectrl a.togglescreen").click(function(){
|
||||
toggleFullscreen();
|
||||
})
|
||||
$(".slidectrl a.browserfullscreen").click(function(){
|
||||
browserFullScreen();
|
||||
})
|
||||
$slidelist.find("a.list_element").click(function(){
|
||||
imagecount = parseInt($(this).parent().attr("for"));
|
||||
changeImage($(this));
|
||||
|
@ -219,12 +227,19 @@ var galleryAPI = function(){
|
|||
return false;
|
||||
}
|
||||
if(e.keyCode == 27){
|
||||
|
||||
toggleFullscreen();
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 70 || e.keyCode == 102){
|
||||
if($rslide.hasClass("fullscreen"))
|
||||
browserFullScreen();
|
||||
}
|
||||
});
|
||||
|
||||
var browserFullScreen = function(){
|
||||
var el = document.documentElement,
|
||||
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
|
||||
rfs.call(el);
|
||||
}
|
||||
var nextpic = function(dom){
|
||||
if(imagecount == imageArray.length - 1)
|
||||
imagecount = 0;
|
||||
|
@ -232,7 +247,6 @@ var galleryAPI = function(){
|
|||
imagecount++;
|
||||
changeImage(dom);
|
||||
}
|
||||
|
||||
var prevpic = function(dom){
|
||||
if(imagecount == 0)
|
||||
imagecount = imageArray.length - 1
|
||||
|
@ -240,32 +254,39 @@ var galleryAPI = function(){
|
|||
imagecount--;
|
||||
changeImage(dom);
|
||||
}
|
||||
|
||||
var toggleFullscreen = function(){
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$rslide.css("position","relative");
|
||||
$rslide.removeClass("fullscreen");
|
||||
$(".slidectrl a.browserfullscreen").hide();
|
||||
$img.css({"padding":""})
|
||||
$("#main_pic").height(picHeight);
|
||||
}else{
|
||||
$("#main_pic").height(wHeight);
|
||||
// $img.height("100%");
|
||||
$rslide.css("position","");
|
||||
$rslide.addClass("fullscreen");
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
$(".slidectrl a.browserfullscreen").show();
|
||||
}
|
||||
}
|
||||
var changeImage = function(dom){
|
||||
var pageurl = dom.attr('href');
|
||||
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"});
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
}
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
if(pageurl!=window.location){
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||
$(".slideinfo span.info").text(imageArray[imagecount].description);
|
||||
updateNavigation();
|
||||
$img.fadeOut(200,function(){
|
||||
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"});
|
||||
$img.fadeIn(200);
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
}
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
if(pageurl!=window.location){
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||
$(".slideinfo span.info").text(imageArray[imagecount].description);
|
||||
updateNavigation();
|
||||
})
|
||||
}
|
||||
var updateNavigation = function(){
|
||||
var next, prev;
|
||||
|
@ -333,8 +354,8 @@ var galleryAPI = function(){
|
|||
$("#description_loader .txtchange").each(function(){
|
||||
dataArray.push({"id":$(this).attr("for"),"text": $(this).val()});
|
||||
})
|
||||
|
||||
$.post("update_album",{data:dataArray},function(){
|
||||
albumnm = $(".albumname_edit #album_name_text").val();
|
||||
$.post("update_album",{data:dataArray,"aid":id,"name":albumnm},function(){
|
||||
|
||||
})
|
||||
})
|
||||
|
@ -365,15 +386,16 @@ var galleryAPI = function(){
|
|||
doms_to_delete[dom].hide("slide",function(){$(this).remove();})
|
||||
}
|
||||
}
|
||||
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var head = '<a href="orbit_gallery?album='+id+'" class="rgui bt-back rgbt" title="Back"><span id="album_name_span">Back to photos</span></a></div>';
|
||||
head+='<a class="rgui bt-del bt-delete rgbt" onclick="return false;" style="display:none;" title="Delete Selected" href=""><span>Delete Selected</span></a>';
|
||||
head+='<a class="rgui bt-save rgbt" onclick="return false;" style="display:none;" title="Save" href=""><span>Save</span>';
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
rcom.bindDomToHead($(".rghead"));
|
||||
g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){
|
||||
if(xhr.status == 404){
|
||||
$(this).text("Album not found.");
|
||||
|
|
|
@ -241,6 +241,7 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
|
|||
.slidectrl a.togglelist { background-position: 0 -30px; }
|
||||
.slidectrl a.toinline { background-position: -30px 0; }
|
||||
.slidectrl a.sharebt { background-position: -30px -30px; }
|
||||
.slidectrl a.browserfullscreen {background-position: -30px -30px; display:none;}
|
||||
.slidectrl a.slidestop { background-position: 0 -60px; }
|
||||
.slideinfo {
|
||||
height: 30px;
|
||||
|
|
|
@ -2,6 +2,7 @@ class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
|
|||
|
||||
def index
|
||||
@categorylist = GalleryCategory.all
|
||||
@cid = params['cat']
|
||||
end
|
||||
|
||||
def new_category
|
||||
|
@ -115,6 +116,15 @@ class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
|
|||
end
|
||||
|
||||
def update_album
|
||||
data = params['data']
|
||||
album_name = params['name']
|
||||
aid = params['aid']
|
||||
data.each do |d|
|
||||
image = GalleryImage.find(d[1][:id])
|
||||
image.update_attributes(:description=>d[1][:text])
|
||||
end
|
||||
album = GalleryAlbum.find(aid)
|
||||
album.update_attributes(:name => album_name)
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
<option value="">--Select a category--</option>
|
||||
<option value="all">All</option>
|
||||
<% @categorylist.each do |category| %>
|
||||
<% if @cid == category.id.to_s %>
|
||||
<option value='<%= category.id %>' selected><%= category.name %></option>
|
||||
<% else %>
|
||||
<option value='<%= category.id %>'><%= category.name %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<ul id='galleryimagelist' style="display:none;">
|
||||
<% i=0 %>
|
||||
<% @images.each do |image| %>
|
||||
<li for="<%= i %>"><a href="orbit_gallery?theater=<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt=""/></a></li>
|
||||
<li for="<%= i %>"><a href="orbit_gallery?theater=<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
|
||||
<% i=i+1 %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -25,6 +25,7 @@
|
|||
<div class="slidectrl">
|
||||
<a href="" class="togglescreen" title="切換全螢幕" onclick="return false;">Screen</a>
|
||||
<a href="" class="togglelist" title="顯示照片清單" onclick="return false;">List</a>
|
||||
<a href="" class="browserfullscreen" title="顯示照片清單" onclick="return false;">F</a>
|
||||
<div class="slideinfo">
|
||||
<!-- <b class="info"><%= @image.title %></b> -->
|
||||
<span class="info"><%= @image.description %></span>
|
||||
|
|
Loading…
Reference in New Issue