git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_4.0.0@85 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2016-05-16 15:52:25 +00:00
parent 38daf2c82d
commit 0acf60e400
7 changed files with 86 additions and 34 deletions
+38 -17
View File
@@ -7,6 +7,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
fetchedRicetta: false,
fetchedIngredienti: false,
galleryWall: null,
currentPhotoIndex: null,
//initialize template
template: _.template(itemViewTemplate),
initialize: function (options) {
@@ -95,6 +96,23 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
self.switchContent();
$.mobile.loading('hide');
},
loadImage: function(){
var self = this;
$.mobile.loading('show', {
text: 'Caricamento immagine...',
textVisible: true,
//theme: 'z',
html: ""
});
var photoID = $(self.$photos[self.currentPhotoIndex]).attr("data-photoid");
self.$el.find('#photoFull').attr("src" , myManifest.Settings.DefaultURL + "/api/photo/" + photoID);
self.$el.find('#photoFull').load(function(){
$.mobile.loading('hide');
self.$el.find('#fullPhotoPopupDialog').popup("open");
});
},
//render the content into div of view
render: function () {
if (this.fetchedIngredienti && this.fetchedRicetta)
@@ -128,22 +146,9 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
});
self.$photos.on("click", function(e){
e.preventDefault();
$.mobile.loading('show', {
text: 'Caricamento immagine...',
textVisible: true,
//theme: 'z',
html: ""
});
var photoID = $(this).attr("data-photoid");
self.$el.find('#photoFull').attr("src" , myManifest.Settings.DefaultURL + "/api/photo/" + photoID);
self.$el.find('#photoFull').load(function(){
$.mobile.loading('hide');
self.$el.find('#fullPhotoPopupDialog').popup("open");
});
e.preventDefault();
self.currentPhotoIndex = self.$photos.index(this);
self.loadImage();
});
for (var i = self.$arrayContent.length - 1; i >= 0; i--) {
@@ -167,7 +172,23 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
self.$arrayContent.on("swiperight", function (e) {
var index = jQuery.inArray(this, self.$arrayContent);
self.goToContent(index - 1);
});
});
self.$el.find('#fullPhotoPopupDialog div').
on("swiperight", function (e) {
self.currentPhotoIndex--;
if(self.currentPhotoIndex < 0)
self.currentPhotoIndex = 0;
else
self.loadImage();
}).on("swipeleft", function (e) {
self.currentPhotoIndex++;
if(self.currentPhotoIndex > self.$photos.length - 1)
self.currentPhotoIndex = self.$photos.length -1;
else
self.loadImage();
});
if(myManifest.Agent.browser.name != "Safari" || myManifest.Agent.browser.name != "Mobile Safari"){
new Clipboard('#copyBtn', {