gallery foto view history fix
This commit is contained in:
@@ -16,13 +16,20 @@ class FotosController < ApplicationController
|
||||
# GET /fotos/1.json
|
||||
def show
|
||||
@foto = Foto.find(params[:id])
|
||||
@gallery=@foto.gallery
|
||||
@openfotoid=@foto.id
|
||||
@pppage=params[:pppage].to_i % 4
|
||||
@pppage_array = [ 25 , 50 , 100, 10000]
|
||||
@page = params[:page].nil? ? 1 : params[:page].to_i
|
||||
|
||||
@fotos_p = @gallery.fotos.page(@page).per(@pppage_array[@pppage])
|
||||
@fotos_n = @gallery.fotos- @fotos_p
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if params[:plain]
|
||||
render "show", layout: false
|
||||
else
|
||||
redirect_to gallery_path(@foto.gallery,:params=>{fotoid: @foto.id})
|
||||
render "galleries/show" #controller: :galleries, action: :show #gallery_path(@foto.gallery,:params=>{fotoid: @foto.id})
|
||||
end
|
||||
}
|
||||
format.json { render json: @foto }
|
||||
|
||||
@@ -31,9 +31,19 @@ end
|
||||
|
||||
|
||||
<% end %>
|
||||
<div id="fb-root"></div>
|
||||
<script>(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/de_DE/sdk.js#xfbml=1&appId=120379864660921&version=v2.0";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));</script>
|
||||
|
||||
<div itemscope itemtype="http://schema.org/ImageGallery">
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
|
||||
<div>
|
||||
<small class="pull-left"><%= @gallery.fotos.size.to_s + " " + I18n.t('fotos.bilder')%> </small>
|
||||
<small class="pull-right" itemprop="dateCreated" datetime="<%= @gallery.try(:datum).try(:to_date) unless @gallery.try(:datum).try(:to_date).nil?%>"><%=I18n.l(@gallery.try(:datum).try(:to_date)) unless @gallery.try(:datum).try(:to_date).nil? %></small></br>
|
||||
@@ -56,9 +66,10 @@ end
|
||||
<div class="pagination pull_left" style="margin:0px 0px 0px 0px">
|
||||
<ul>
|
||||
<li><a href="<%= gallery_path @gallery, {:pppage => @pppage, :page => (@page==1 ? @page : @page-1)} %>"><%=I18n.t('fotos.prev')%></a></li>
|
||||
<% for i in 1..@pages do %>
|
||||
<% # for i in 1..@pages do
|
||||
i=1 %>
|
||||
<li><a href="<%= gallery_path @gallery, {:pppage => @pppage, :page => i} %>"><%=i%></a></li>
|
||||
<% end %>
|
||||
<% # end %>
|
||||
<li><a href="<%= gallery_path @gallery, {:pppage => @pppage, :page => (@page==@pages ? @page : @page+1)} %>"><%=I18n.t('fotos.next')%></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -119,7 +130,7 @@ end
|
||||
<!-- <a href="<%= f.datei.resized.url%>" title="<%=f.title%>" data-gallery>
|
||||
<%=image_tag(f.datei.thumb.url,{:class=>"img-polaroid img-rounded"}) %></a>-->
|
||||
<div <% if (@openfotoid.to_i==f.id) %> itemprop="primaryImageOfPage"<% else %> itemprop="hasPart" <% end %> itemscope itemtype="http://schema.org/ImageObject">
|
||||
<a href="<%= gallery_foto_path(f.gallery, f,:params=>{plain: true}) %>" data-type="text/html" type="text/html" title="<%=f.title%>" data-gallery <% if (@openfotoid.to_i==f.id) %>id="openpic" <% end %>>
|
||||
<a href="<%= gallery_foto_path(f.gallery, f,:params=>{plain: true}) %>" data-type="text/html" type="text/html" title="<%=f.title%>" histItem="<%= gallery_foto_path(f.gallery, f,:params=>{plain: nil, theme: nil}) %>" data-gallery <% if (@openfotoid.to_i==f.id) %>id="openpic" <% end %>>
|
||||
<%= image_tag(f.datei.thumb.url,{:class=>"img-polaroid img-rounded"}) %>
|
||||
<meta itemprop="thumbnailUrl" content="<%= f.datei.thumb.url %>"/>
|
||||
<meta itemprop="dateModified" content="<%= f.updated_at %>"/>
|
||||
@@ -137,7 +148,7 @@ end
|
||||
<% end %>
|
||||
<% @fotos_n.each do |f| %>
|
||||
<div id="links">
|
||||
<a href="<%= f.datei.resized.url%>" title="<%=f.title%>" data-gallery></a>
|
||||
<a href="<%= f.datei.resized.url%>" title="<%=f.title%>" data-gallery></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -159,11 +170,14 @@ end
|
||||
</div>
|
||||
<%= @pppage_array[@pppage] %>
|
||||
<%= javascript_include_tag "blueimp-gallery-all" %>
|
||||
|
||||
<script>
|
||||
blueimp.Gallery.prototype.textFactory = function (obj, callback) {
|
||||
var $element = $('<div>')
|
||||
.addClass('slide-content')
|
||||
.attr('title', obj.title);
|
||||
.attr('title', obj.title)
|
||||
.attr('histItem',obj.getAttribute('histitem'));
|
||||
|
||||
$.get(obj.href)
|
||||
.done(function (result) {
|
||||
$element.html(result);
|
||||
@@ -181,6 +195,14 @@ blueimp.Gallery.prototype.textFactory = function (obj, callback) {
|
||||
return $element[0];
|
||||
};
|
||||
$('#openpic').click()
|
||||
|
||||
|
||||
blueimp.Gallery.prototype.onslide = (function(_super) {
|
||||
return function(index) {
|
||||
history.pushState({},"Foto",String(this.list[index].getAttribute('histitem')));
|
||||
return _super.apply(this, arguments);
|
||||
};
|
||||
})(blueimp.Gallery.prototype.onslide);
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user