git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@70 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+1
-69
@@ -7,75 +7,7 @@
|
|||||||
define(['jquery', 'backbone'],
|
define(['jquery', 'backbone'],
|
||||||
function ($, Backbone) {
|
function ($, Backbone) {
|
||||||
|
|
||||||
var Images = {
|
var Images = {
|
||||||
prefix: "images",
|
|
||||||
getThumb: function (id) {
|
|
||||||
var val = this._get(id);
|
|
||||||
if(val.thumb !== "")
|
|
||||||
return val.thumb;
|
|
||||||
|
|
||||||
var response = $.ajax({
|
|
||||||
url: myManifest.Settings.DefaultURL + "/api/photo/thumbnail/" + id + "/1",
|
|
||||||
type: 'GET',
|
|
||||||
async: false
|
|
||||||
}).responseText;
|
|
||||||
val.thumb = response;
|
|
||||||
this._set(id, val);
|
|
||||||
return val.thumb;
|
|
||||||
},
|
|
||||||
getMedium: function (id) {
|
|
||||||
var val = this._get(id);
|
|
||||||
if(val.medium !== "")
|
|
||||||
return val.medium;
|
|
||||||
|
|
||||||
var response = $.ajax({
|
|
||||||
url: myManifest.Settings.DefaultURL + "/api/photo/medium/" + id + "/1",
|
|
||||||
type: 'GET',
|
|
||||||
async: false
|
|
||||||
}).responseText;
|
|
||||||
val.medium = response;
|
|
||||||
this._set(id, val);
|
|
||||||
return val.medium;
|
|
||||||
},
|
|
||||||
getFull: function (id) {
|
|
||||||
var val = this._get(id);
|
|
||||||
if(val.full !== "")
|
|
||||||
return val.full;
|
|
||||||
|
|
||||||
var response = $.ajax({
|
|
||||||
url: myManifest.Settings.DefaultURL + "/api/photo/" + id + "/1",
|
|
||||||
type: 'GET',
|
|
||||||
async: false
|
|
||||||
}).responseText;
|
|
||||||
val.full = response;
|
|
||||||
this._set(id, val);
|
|
||||||
return val.full;
|
|
||||||
},
|
|
||||||
_set:function(id, item){
|
|
||||||
var list = JSON.parse(window.localStorage.getItem(this.prefix));
|
|
||||||
if(list !== null)
|
|
||||||
{
|
|
||||||
list[id] = item;
|
|
||||||
window.localStorage.setItem(this.prefix, JSON.stringify(list));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_get:function(id){
|
|
||||||
var ret = null;
|
|
||||||
var item = JSON.parse(window.localStorage.getItem(this.prefix));
|
|
||||||
if(item === null){
|
|
||||||
item = {};
|
|
||||||
window.localStorage.setItem(this.prefix, JSON.stringify(item));
|
|
||||||
ret = { thumb: "", medium: "", full:""};
|
|
||||||
}
|
|
||||||
else if(item[id] === undefined){
|
|
||||||
ret = { thumb: "", medium: "", full:""};
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ret = item[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return Images;
|
return Images;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/category/categoryViewT
|
|||||||
});*/
|
});*/
|
||||||
html = this.itemtemplate({
|
html = this.itemtemplate({
|
||||||
items: this.collection.toJSON(),
|
items: this.collection.toJSON(),
|
||||||
images: Images
|
myManifest: myManifest
|
||||||
});
|
});
|
||||||
|
|
||||||
$(html).appendTo($ul).enhanceWithin();
|
$(html).appendTo($ul).enhanceWithin();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<% if(item.firstImage === ""){ %>
|
<% if(item.firstImage === ""){ %>
|
||||||
<img class="thmbImg emptyItemList">
|
<img class="thmbImg emptyItemList">
|
||||||
<%}else{%>
|
<%}else{%>
|
||||||
<img class="thmbImg" src='<%=data.images.getThumb(item.firstImage)%>'>
|
<img class="thmbImg" src='<%=myManifest.Settings.DefaultURL%>/api/photo/thumbnail/<%=item.firstImage%>'>
|
||||||
<%}%>
|
<%}%>
|
||||||
<div class='ricettaTitolo'><%= unescape(item.titolo) %></div>
|
<div class='ricettaTitolo'><%= unescape(item.titolo) %></div>
|
||||||
<div class='ricettaAutore'><%= unescape(item.autore) %></div>
|
<div class='ricettaAutore'><%= unescape(item.autore) %></div>
|
||||||
|
|||||||
@@ -69,8 +69,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var imgurl = Images.getThumb(48);
|
|
||||||
|
|
||||||
var images = this.galleryWall.container.find('.brick');
|
var images = this.galleryWall.container.find('.brick');
|
||||||
images.find('img').load(function() {
|
images.find('img').load(function() {
|
||||||
self.galleryWall.fitWidth();
|
self.galleryWall.fitWidth();
|
||||||
|
|||||||
@@ -38,7 +38,8 @@
|
|||||||
<h1>Foto</h1>
|
<h1>Foto</h1>
|
||||||
<div id="Gallery" class="freewallGallery">
|
<div id="Gallery" class="freewallGallery">
|
||||||
<% _.each(ricetta.foto, function(fotoID) {%>
|
<% _.each(ricetta.foto, function(fotoID) {%>
|
||||||
<div class='brick' style='width:<%=widthImg%>px;'><a id="photo_<%=fotoID.ID%>" data-role="none" data-photoid="<%=fotoID.ID%>" href=""><img src='<%=images.getMedium(fotoID.ID)%>' class="imageborder imageborder-<%=profile.data.tema%>"></a></div>
|
<div class='brick' style='width:<%=widthImg%>px;'><a id="photo_<%=fotoID.ID%>" data-role="none" data-photoid="<%=fotoID.ID%>" href="">
|
||||||
|
<img src='<%=myManifest.Settings.DefaultURL%>/api/photo/medium/<%=fotoID.ID%>' class="imageborder imageborder-<%=profile.data.tema%>"></a></div>
|
||||||
<%});%>
|
<%});%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user