Fix backend gallery show page go_back issue and theater exit fullscreen

This commit is contained in:
manson committed 2014-07-21 16:28:09 +08:00
1 parent 6f2ca20be3
commit 1825842ad0
6 files changed
+47 -19

No files matched your search

+6 -10
View File
@@ -145,16 +145,12 @@ $(function() {
}
}
var photosData = null;
if($("#imgholder").length){
$.getJSON(window.location.pathname, function(json, textStatus) {
photosData = json;
$('.open').pageslide({
loadComplete: function(instance,elem) {
bindEvent(instance,elem);
}
})
});
$('.open').pageslide({
loadComplete: function(instance,elem) {
bindEvent(instance,elem);
}
})
}
@@ -242,7 +238,7 @@ $(function() {
var lastid = ( $("li.rgalbum:last").length ? $("li.rgalbum:last").data("image-id") : null),
albumid = $("#fileupload_aid").val();
$.getJSON(window.location.pathname, function(json, textStatus) {
$.getJSON('/admin/galleries/get_photoData_json?id='+albumid, function(json, textStatus) {
photosData = json;
});
+11 -1
View File
@@ -11,6 +11,8 @@ var galleryAPI = function(){
this.loadArea = null;
this.tagList = $("ul#gallery_tag_list");
this.loading = $("#loading");
this.fullscreen_mode = false;
this.loadTheater = function(id){
@@ -139,9 +141,17 @@ var galleryAPI = function(){
}
});
var browserFullScreen = function(){
var el = document.documentElement,
if(g.fullscreen_mode==false){
var el = document.documentElement,
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
rfs.call(el);
g.fullscreen_mode = true;
}else{
var el = document,
rfs = el.exitFullscreen || el.msExitFullscreen || el.webkitExitFullscreen || el.mozCancelFullScreen;
rfs.call(el);
g.fullscreen_mode = false;
}
}
$(window).resize(function(){
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
@@ -11,6 +11,7 @@ var galleryAPI = function(){
this.loadArea = "theater";
this.tagList = $(".taglist ul");
this.loading = $("#loading");
this.fullscreen_mode = false;
// this.authenticated = false;
this.initialize = function(callbackFn){
if(g.loadArea == "theater"){
@@ -109,9 +110,17 @@ var galleryAPI = function(){
}
});
var browserFullScreen = function(){
var el = document.documentElement,
if(g.fullscreen_mode==false){
var el = document.documentElement,
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
rfs.call(el);
g.fullscreen_mode = true;
}else{
var el = document,
rfs = el.exitFullscreen || el.msExitFullscreen || el.webkitExitFullscreen || el.mozCancelFullScreen;
rfs.call(el);
g.fullscreen_mode = false;
}
}
$(window).resize(function(){
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
+13 -6
View File
@@ -10,15 +10,12 @@ class Admin::GalleriesController < ApplicationController
def show
@album = Album.find(params[:id])
@images = @album.album_images
@image_content = []
image_content = []
@images.each do |image|
@image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}}
image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}}
end
@tags = @module_app.tags
respond_to do |h|
h.html
h.json {render json: @image_content}
end
@photos_data = {"galleries" => image_content}.to_json
end
def new
@@ -61,6 +58,16 @@ class Admin::GalleriesController < ApplicationController
render :json =>{"success"=>true}.to_json
end
def get_photoData_json
@album = Album.find(params[:id])
@images = @album.album_images
image_content = []
@images.each do |image|
image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}}
end
render :json=>{"galleries" => image_content}.to_json
end
def get_album_json
albums = Album.all
output = Array.new
+4
View File
@@ -162,6 +162,10 @@
</div>
</div>
<script type="text/javascript">
var photosData = <%= @photos_data.html_safe %>;
</script>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "jquery.masonry.min.js" %>
<%= javascript_include_tag "jquery.lite.image.resize.js" %>