git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@59 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2016-02-01 17:02:23 +00:00
parent fc7970ec57
commit 7737c750eb
8 changed files with 142 additions and 37 deletions
+24 -13
View File
@@ -1,5 +1,5 @@
define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.html', 'modules/base/baseView', 'classes/profile', 'jQueryPlugins'],
function ($, _, Backbone, itemViewTemplate, BaseView, Profile) {
define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.html', 'modules/base/baseView', 'classes/profile', 'classes/images', 'jQueryPlugins'],
function ($, _, Backbone, itemViewTemplate, BaseView, Profile, Images) {
var ItemView = BaseView.extend({
collRicetta: null,
@@ -57,7 +57,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
onShowed: function(){
var self = this;
$('body').scrollTop(0);
/*
this.galleryWall = new Freewall("#Gallery");
this.galleryWall.reset({
selector: '.brick',
@@ -69,11 +69,13 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
}
});
var images = this.galleryWall.container.find('.brick');
var imgurl = Images.getThumb(48);
/*var images = this.galleryWall.container.find('.brick');
images.find('img').load(function() {
self.galleryWall.fitWidth();
});
*/
});*/
$.mobile.loading('hide');
},
@@ -85,19 +87,28 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
var self = this;
var ric = self.collRicetta.toJSON()[0];
var countImgLoaded = 0;
Profile.existRicettaBloccoNote(ric.ricetta_id,
function (exist) {
self.$el.append(self.template({
ricetta: self.collRicetta.toJSON()[0],
ingredienti: self.collIngredienti.toJSON()
ingredienti: self.collIngredienti.toJSON(),
profile: Profile,
images: Images,
}));
self.scrollPositions = [];
self.$arrayContent = self.$el.find('div[data-role="content"]');
self.$arrayNavBar = self.$el.find('div[data-role="navbar"] a');
/*
self.$photos = self.$el.find('#contentFoto a');
self.$el.find('#contentFoto a img').load(function(){
countImgLoaded++;
if(self.$photos.length == countImgLoaded)
if(self.galleryWall !== null)
self.galleryWall.fitWidth();
});
self.$photos.on("click", function(e){
e.preventDefault();
$.mobile.loading('show', {
@@ -116,7 +127,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
});
});
*/
for (var i = self.$arrayContent.length - 1; i >= 0; i--) {
self.scrollPositions.push(0);
};
@@ -159,9 +170,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
{
this.scrollPositions[this.indexContent] = $('body').scrollTop();
this.indexContent = newIndex;
this.switchContent();
if(this.indexContent == 2)
this.galleryWall.fitWidth();
this.switchContent();
$('body').scrollTop(this.scrollPositions[this.indexContent]);
}
},
@@ -172,6 +181,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
$(this.$arrayContent[this.indexContent]).show();
$(this.$arrayNavBar[this.indexContent]).addClass('ui-btn-active');
$(this.$arrayNavBar[this.indexContent]).addClass('ui-state-persist');
if(this.indexContent == 2)
this.galleryWall.fitWidth();
}
});
return ItemView;