From 17dffb15e1761d4f7e7d40bd95569bf4def086e0 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 31 Jul 2012 01:15:48 +0800 Subject: [PATCH] Major updates for gallery --- .../app/assets/javascripts/galleryAPI.js | 62 +++++++++++++------ .../app/assets/stylesheets/gallery.css | 1 + .../back_end/orbit_galleries_controller.rb | 10 +++ .../back_end/orbit_galleries/index.html.erb | 4 ++ .../back_end/orbit_galleries/theater.html.erb | 3 +- 5 files changed, 59 insertions(+), 21 deletions(-) diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js index 37db6b92..c052ca17 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js @@ -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 = 'Back to photos'; head+=''; head+=' @@ -25,6 +25,7 @@
Screen List + F
<%= @image.description %>