git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@33 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache'], function
|
||||
($, _, Backbone, Router, Profile, Cache) {
|
||||
define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache', 'libs/fastclick'], function
|
||||
($, _, Backbone, Router, Profile, Cache, FastClick) {
|
||||
'use strict';
|
||||
var init = function () {
|
||||
//create backbone router
|
||||
var router = new Router();
|
||||
|
||||
Backbone.history.start();
|
||||
Backbone.emulateJSON = true;
|
||||
|
||||
|
||||
hello.init({
|
||||
facebook: '1466942266882168',
|
||||
google: '319140243944-qk0lfhgmi8shi4go97r83l69f1k0gdf4.apps.googleusercontent.com'
|
||||
}, {display: 'page', scope: 'email'});
|
||||
|
||||
|
||||
//console.log("Backbone history start");
|
||||
// Trigger 'route' event on router instance.
|
||||
router.on('route', function (name, args) {
|
||||
//alert(name);
|
||||
});
|
||||
|
||||
|
||||
Cache.checkCacheFromServer();
|
||||
|
||||
|
||||
if (Profile.isConnected()) {
|
||||
Profile.loadProfile();
|
||||
}
|
||||
@@ -47,22 +50,22 @@ define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classe
|
||||
email = json.email;
|
||||
gender = json.gender;
|
||||
}
|
||||
Profile.internalLoadProfile(id, function(retVal){
|
||||
if(retVal === false)
|
||||
Profile._loadProfile(id, function (retVal) {
|
||||
if (retVal === false)
|
||||
{
|
||||
Profile.createProfile(
|
||||
id,
|
||||
auth.network,
|
||||
displayName,
|
||||
email,
|
||||
gender,
|
||||
function () {
|
||||
window.location.href = "#syncView/tokenFound";
|
||||
}
|
||||
id,
|
||||
auth.network,
|
||||
displayName,
|
||||
email,
|
||||
gender,
|
||||
function () {
|
||||
window.location.href = "";
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
window.location.href = "#syncView/tokenFound";
|
||||
window.location.href = "";
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,12 +20,15 @@ define(['jquery', 'underscore', 'backbone', 'classes/cache'],
|
||||
{
|
||||
window.setTimeout(function () {
|
||||
self[options.reset ? 'reset' : 'set'](false, options);
|
||||
deferred.resolve(cachedItem);
|
||||
//deferred.resolve(cachedItem);
|
||||
|
||||
deferred.notify(self);
|
||||
self.push(cachedItem);
|
||||
self.trigger('sync', self, false, options);
|
||||
if (_.isFunction(options.success)) {
|
||||
options.success(self, false, options);
|
||||
}
|
||||
}
|
||||
deferred.resolve(cachedItem);
|
||||
self.trigger('sync', self, false, options);
|
||||
return deferred;
|
||||
}, 0);
|
||||
}
|
||||
@@ -48,6 +51,11 @@ define(['jquery', 'underscore', 'backbone', 'classes/cache'],
|
||||
// return a promise which provides the same methods as a jqXHR object
|
||||
return deferred;
|
||||
}
|
||||
},
|
||||
isCached: function () {
|
||||
var cachedItem = Cache.get(this.cacheName);
|
||||
|
||||
return (cachedItem !== null);
|
||||
}
|
||||
});
|
||||
return CachedCollection;
|
||||
|
||||
+199
-161
@@ -2,165 +2,183 @@
|
||||
* Created by Denis on 19/06/2014.
|
||||
*/
|
||||
define(['jquery', 'backbone'],
|
||||
function($, Backbone){
|
||||
function ($, Backbone) {
|
||||
|
||||
var Profile = {
|
||||
|
||||
_loadme:function(){
|
||||
if(this.isConnected()) {
|
||||
if (this.data.type == null)
|
||||
this.loadProfile();
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
dataloaded: false,
|
||||
|
||||
data: {
|
||||
"name": null,
|
||||
"email": null,
|
||||
"gender":null,
|
||||
"tema": 'b',
|
||||
"risRic": '10',
|
||||
"type": null
|
||||
},
|
||||
|
||||
isConnected: function(){
|
||||
return this.getKeySave() != "null" &&
|
||||
this.getKeySave() != null &&
|
||||
this.getKeySave() != "undefined" &&
|
||||
this.getKeySave() != undefined;
|
||||
},
|
||||
|
||||
loadProfile:function(successFn) {
|
||||
this.internalLoadProfile(this.getKeySave(), successFn);
|
||||
},
|
||||
|
||||
internalLoadProfile:function(keyStore, successFn){
|
||||
if(this.dataloaded)
|
||||
return;
|
||||
//var keyStore = this.getKeySave();
|
||||
var self = this;
|
||||
var retBool = false;
|
||||
var resp = $.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/" + keyStore,
|
||||
//dataType: "json",
|
||||
async: false,
|
||||
type: 'GET'
|
||||
}).responseText;
|
||||
|
||||
var response = JSON.parse(resp);
|
||||
if(response.length > 0)
|
||||
{
|
||||
self.dataloaded = true;
|
||||
self.setKeySave(keyStore);
|
||||
self.data.name = response[0].Name;
|
||||
self.data.gender = response[0].Gender;
|
||||
self.data.tema = response[0].TemaUI;
|
||||
self.data.risRic = response[0].RisultatiRicerca;
|
||||
self.data.type = response[0].TipoAccesso;
|
||||
retBool = true;
|
||||
}
|
||||
if(successFn)
|
||||
successFn(retBool);
|
||||
},
|
||||
|
||||
getKeySave: function(){
|
||||
return window.localStorage.getItem("KeySave");
|
||||
},
|
||||
setKeySave: function(val){
|
||||
window.localStorage.setItem("KeySave", val);
|
||||
},
|
||||
|
||||
isGPlusConnected: function(){
|
||||
if(this.data.type === "google")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
isFbConnected: function(){
|
||||
if(this.data.type === "facebook")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
addRicettaBloccoNote: function(ricetta_id, successFn) {
|
||||
var sendobj = {
|
||||
"ricetta_id": ricetta_id,
|
||||
"keyStore": this.getKeySave()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/ricetta",
|
||||
//dataType: "json",
|
||||
type: 'POST',
|
||||
data: { dataPair: JSON.stringify(sendobj) },
|
||||
success: function(msg){
|
||||
if(successFn)
|
||||
successFn(msg);
|
||||
var Profile = {
|
||||
_loadme: function () {
|
||||
this.data.name = this.getName();
|
||||
this.data.gender = this.getGender();
|
||||
if (this.isConnected()) {
|
||||
if (this.data.type == null)
|
||||
this.loadProfile();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
removeRicettaBloccoNote: function(ricetta_id, successFn) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/" + this.getKeySave() + "/ricetta/" + ricetta_id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE',
|
||||
success: function(msg){
|
||||
if(successFn)
|
||||
successFn(msg);
|
||||
return this;
|
||||
},
|
||||
dataloaded: false,
|
||||
data: {
|
||||
"name": null,
|
||||
"email": null,
|
||||
"gender": null,
|
||||
"tema": 'd',
|
||||
"risRic": '10',
|
||||
"type": null,
|
||||
"picture": null
|
||||
},
|
||||
isConnected: function () {
|
||||
return this.getKeySave() != "null" &&
|
||||
this.getKeySave() != null &&
|
||||
this.getKeySave() != "undefined" &&
|
||||
this.getKeySave() != undefined;
|
||||
},
|
||||
setPictureEvent: null,
|
||||
setPicture: function (val) {
|
||||
this.data.picture = val;
|
||||
if (this.setPictureEvent)
|
||||
this.setPictureEvent(val);
|
||||
},
|
||||
loadProfile: function (successFn) {
|
||||
this._loadProfile(this.getKeySave(), successFn);
|
||||
},
|
||||
_loadProfile: function (keyStore, successFn) {
|
||||
if (this.dataloaded) {
|
||||
if (successFn)
|
||||
successFn(retBool);
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
//var keyStore = this.getKeySave();
|
||||
var self = this;
|
||||
var retBool = false;
|
||||
var resp = $.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/" + keyStore,
|
||||
//dataType: "json",
|
||||
//async: false,
|
||||
type: 'GET',
|
||||
success: function (response) {
|
||||
if (response.length > 0)
|
||||
{
|
||||
self.dataloaded = true;
|
||||
self.data.name = response[0].Name;
|
||||
self.data.gender = response[0].Gender;
|
||||
self.data.tema = response[0].TemaUI;
|
||||
self.data.risRic = response[0].RisultatiRicerca;
|
||||
self.data.type = response[0].TipoAccesso;
|
||||
self.setKeySave(keyStore);
|
||||
self.setName(self.data.name);
|
||||
self.setGender(self.data.gender);
|
||||
retBool = true;
|
||||
|
||||
existRicettaBloccoNote: function(ricettaID, successFn){
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/" + this.getKeySave() + "/ricetta/" + ricettaID,
|
||||
//dataType: "json",
|
||||
type: 'GET',
|
||||
success: function(msg){
|
||||
if(successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
switch (self.data.type)
|
||||
{
|
||||
case "facebook":
|
||||
img = "https://graph.facebook.com/" + keyStore + "/picture?type=normal";
|
||||
self.setPicture(img);
|
||||
break;
|
||||
case "google":
|
||||
var resp = $.ajax({
|
||||
url: "https://www.googleapis.com/plus/v1/people/" + keyStore + "?fields=image&key=" + myManifest.getGPublicApiKey(),
|
||||
//dataType: "json",
|
||||
//async: false,
|
||||
type: 'GET',
|
||||
success: function (resp) {
|
||||
self.setPicture(resp.image.url.replace("?sz=50", "?sz=150"));
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (successFn)
|
||||
successFn(retBool);
|
||||
}
|
||||
});
|
||||
},
|
||||
_getVal: function (key) {
|
||||
return window.localStorage.getItem(key);
|
||||
},
|
||||
_setVal: function (key, val) {
|
||||
window.localStorage.setItem(key, val);
|
||||
},
|
||||
getKeySave: function () {
|
||||
return this._getVal("KeySave");
|
||||
},
|
||||
setKeySave: function (val) {
|
||||
this._setVal("KeySave", val);
|
||||
},
|
||||
getName: function () {
|
||||
return this._getVal("userName");
|
||||
},
|
||||
setName: function (val) {
|
||||
this._setVal("userName", val);
|
||||
},
|
||||
getGender: function () {
|
||||
return this._getVal("userGender");
|
||||
},
|
||||
setGender: function (val) {
|
||||
this._setVal("userGender", val);
|
||||
},
|
||||
isGPlusConnected: function () {
|
||||
if (this.data.type === "google")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
isFbConnected: function () {
|
||||
if (this.data.type === "facebook")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
addRicettaBloccoNote: function (ricetta_id, successFn) {
|
||||
var sendobj = {
|
||||
"ricetta_id": ricetta_id,
|
||||
"keyStore": this.getKeySave()
|
||||
};
|
||||
|
||||
createProfile: function(keyStore, typeProfile, name, email,gender, successFn) {
|
||||
this.data.type = typeProfile;
|
||||
this.data.name = name;
|
||||
this.data.email = email;
|
||||
this.data.gender = gender;
|
||||
this.setKeySave(keyStore);
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/ricetta",
|
||||
//dataType: "json",
|
||||
type: 'POST',
|
||||
data: {dataPair: JSON.stringify(sendobj)},
|
||||
success: function (msg) {
|
||||
if (successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
removeRicettaBloccoNote: function (ricetta_id, successFn) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/" + this.getKeySave() + "/ricetta/" + ricetta_id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE',
|
||||
success: function (msg) {
|
||||
if (successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
existRicettaBloccoNote: function (ricettaID, successFn) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/" + this.getKeySave() + "/ricetta/" + ricettaID,
|
||||
//dataType: "json",
|
||||
type: 'GET',
|
||||
success: function (msg) {
|
||||
if (successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
createProfile: function (keyStore, typeProfile, name, email, gender, successFn) {
|
||||
this.data.type = typeProfile;
|
||||
this.data.name = name;
|
||||
this.data.email = email;
|
||||
this.data.gender = gender;
|
||||
this.setKeySave(keyStore);
|
||||
|
||||
window.localStorage.removeItem("risRic");
|
||||
window.localStorage.removeItem("tema");
|
||||
window.localStorage.removeItem("risRic");
|
||||
window.localStorage.removeItem("tema");
|
||||
|
||||
var sendobj = {
|
||||
"keyStore": this.getKeySave(),
|
||||
"name": this.data.name,
|
||||
"email": this.data.email,
|
||||
"gender": this.data.gender,
|
||||
"tema": this.data.tema,
|
||||
"risRic": this.data.risRic,
|
||||
"type": this.data.type
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile",
|
||||
//dataType: "json",
|
||||
type: 'POST',
|
||||
data: { dataPair: JSON.stringify(sendobj) },
|
||||
success: function(msg){
|
||||
if(successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
updateProfile: function(successFn) {
|
||||
if(this.isConnected()) {
|
||||
var sendobj = {
|
||||
"keyStore": this.getKeySave(),
|
||||
"name": this.data.name,
|
||||
"email": this.data.email,
|
||||
"gender": this.data.gender,
|
||||
"tema": this.data.tema,
|
||||
"risRic": this.data.risRic,
|
||||
"type": this.data.type
|
||||
@@ -169,20 +187,40 @@ define(['jquery', 'backbone'],
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile",
|
||||
//dataType: "json",
|
||||
type: 'PUT',
|
||||
data: { dataPair: JSON.stringify(sendobj) },
|
||||
type: 'POST',
|
||||
data: {dataPair: JSON.stringify(sendobj)},
|
||||
success: function (msg) {
|
||||
if (successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
updateProfile: function (successFn) {
|
||||
if (this.isConnected()) {
|
||||
var sendobj = {
|
||||
"keyStore": this.getKeySave(),
|
||||
"tema": this.data.tema,
|
||||
"risRic": this.data.risRic,
|
||||
"type": this.data.type
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile",
|
||||
//dataType: "json",
|
||||
type: 'PUT',
|
||||
data: {dataPair: JSON.stringify(sendobj)},
|
||||
success: function (msg) {
|
||||
if (successFn)
|
||||
successFn(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
window.localStorage.setItem("risRic", this.data.risRic);
|
||||
window.localStorage.setItem("tema", this.data.tema);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
window.localStorage.setItem("risRic", this.data.risRic);
|
||||
window.localStorage.setItem("tema", this.data.tema);
|
||||
}
|
||||
}
|
||||
};
|
||||
return Profile._loadme();
|
||||
});
|
||||
};
|
||||
return Profile._loadme();
|
||||
});
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
|
||||
<div data-role="navbar" class="nav-glyphish-example">
|
||||
<ul>
|
||||
<li><a href="#noteView" id="noteBtn" data-icon="custom">Blocco note</a></li>
|
||||
<li><a href="#faqView" id="faqBtn" data-icon="custom">Lo sai che?</a></li>
|
||||
<li><a href="#indexView" id="indexBtn" data-icon="custom">Indice</a></li>
|
||||
<li><a href="#searchView" id="searchBtn" data-icon="custom">Cerca</a></li>
|
||||
<li><a href="#faqView" id="faqBtn" data-icon="custom">Lo sai che?</a></li>
|
||||
<!--<li><a href="#indexView" id="indexBtn" data-icon="custom">Indice</a></li>
|
||||
<li><a href="#searchView" id="searchBtn" data-icon="custom">Cerca</a></li>-->
|
||||
<li><a href="#moreView" id="moreBtn" data-icon="custom">Altro</a></li>
|
||||
<!--<li><a href="#aboutView" id="infoBtn" data-icon="custom">About</a></li>
|
||||
<li><a href="#toolsView" id="toolsBtn" data-icon="custom">Tools</a></li>-->
|
||||
|
||||
+6
-5
@@ -1,16 +1,17 @@
|
||||
define(['jquery'], function ($){
|
||||
'use strict';
|
||||
define(['jquery'], function ($) {
|
||||
'use strict';
|
||||
$(document).bind("mobileinit", function () {
|
||||
$.mobile.ajaxEnabled = false;
|
||||
$.mobile.linkBindingEnabled = false;
|
||||
$.mobile.hashListeningEnabled = false;
|
||||
$.mobile.pushStateEnabled = false;
|
||||
$.support.cors = true;
|
||||
$.mobile.allowCrossDomainPages = true;
|
||||
//$.mobile.defaultPageTransition = 'slidefade';
|
||||
$.mobile.allowCrossDomainPages = true;
|
||||
//$.mobile.defaultPageTransition = 'flip';
|
||||
$.mobile.buttonMarkup.hoverDelay = 0;
|
||||
// Remove page from DOM when it's being replaced
|
||||
$(document).on("pagecontainerhide", function (event, ui) {
|
||||
$("div[data-role='page']:not(.ui-page-active)").remove();
|
||||
$("div[data-role='page'][stay-in-page='false']:not(.ui-page-active)").remove();
|
||||
});
|
||||
});
|
||||
});
|
||||
+841
-828
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -1,3 +1,6 @@
|
||||
define(['plugins/jquery.rating.pack', 'plugins/jquery.mobile.alphascroll.min', 'plugins/jquery.validate.min'], function ($) {
|
||||
define(['plugins/jquery.rating.pack',
|
||||
'plugins/jquery.mobile.alphascroll.min',
|
||||
'plugins/jquery.validate.min',
|
||||
'plugins/freewall'], function ($) {
|
||||
// Do nothing
|
||||
});
|
||||
+13
-9
@@ -1,20 +1,24 @@
|
||||
var myManifest = {
|
||||
Debug: false,
|
||||
Debug: (window.location.port !== ""),
|
||||
Name: "Il Lievitario",
|
||||
Version: "2.5.0",
|
||||
Version: "2.8.1.0",
|
||||
Author: "Denis Ironi",
|
||||
Settings: {
|
||||
//DefaultURL: "http://localhost:8081/Service_Manut",
|
||||
DefaultURL: "http://app.gruppolapastamadre.it/Service",
|
||||
DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"),
|
||||
JQueryVersion: "1.11.1",
|
||||
JQueryMobileVersion: "1.4.3",
|
||||
Device:{
|
||||
JQueryMobileVersion: "1.4.5",
|
||||
Device: {
|
||||
Width: (window.innerWidth > 0) ? window.innerWidth : screen.width,
|
||||
Height: (window.innerHeight > 0) ? window.innerHeight : screen.height
|
||||
}
|
||||
},
|
||||
Agent: (new UAParser()).getResult(),
|
||||
getUrlArg: function(){
|
||||
return (this.Debug ? this.Version + "." + (Math.random() * 1000) : this.Version);
|
||||
Agent: (new UAParser()).getResult(),
|
||||
getUrlArg: function () {
|
||||
return this.Version;
|
||||
},
|
||||
getGPublicApiKey: function () {
|
||||
if (myManifest.Debug)
|
||||
return "AIzaSyBnai4MPffctg_ygCCincgjFUBQaytCH9k";
|
||||
return "AIzaSyCwZVaNHV_z79Uull23XpBlP-5jTkzI3rE";
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel', 'classes/cachedCollection'],
|
||||
function (app, $, _, Backbone, Category, CachedCollection){
|
||||
|
||||
var CategoryItems=CachedCollection.extend({
|
||||
var CategoryItems = CachedCollection.extend({
|
||||
|
||||
categoryId: null,
|
||||
initialize: function (options) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel'],
|
||||
function (app, $, _, Backbone, Category){
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/searchItemModel'],
|
||||
function (app, $, _, Backbone, SearchItem){
|
||||
|
||||
var FoundItems=Backbone.Collection.extend({
|
||||
dataFilter: null,
|
||||
numItems: null,
|
||||
indexItems: null,
|
||||
totalRecords: 0,
|
||||
initialize: function (options) {
|
||||
this.dataFilter = {
|
||||
titolo: options.titolo,
|
||||
@@ -10,14 +13,24 @@ define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryI
|
||||
categoryId: options.categoryId
|
||||
};
|
||||
this.numItems = options.nResult;
|
||||
this.indexItems = options.indexItems;
|
||||
},
|
||||
|
||||
parse: function(data){
|
||||
this.totalRecords = data["0"].TotalRecords;
|
||||
return data.records;
|
||||
},
|
||||
// Book is the model of the collection
|
||||
model:SearchItem,
|
||||
|
||||
getTotalRecords: function(){
|
||||
return this.totalRecords;
|
||||
},
|
||||
|
||||
|
||||
// Book is the model of the collection
|
||||
model:Category,
|
||||
|
||||
url: function() {
|
||||
var u = myManifest.Settings.DefaultURL + "/api/categoryitems/search/" + this.numItems +
|
||||
var u = myManifest.Settings.DefaultURL + "/api/categoryitems/search/" +
|
||||
this.numItems +
|
||||
"/" + this.indexItems +
|
||||
"/" + this.dataFilter.categoryId +
|
||||
"/" + this.dataFilter.difficolta;
|
||||
if(this.dataFilter.titolo !== null)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
define(['jquery', 'underscore', 'backbone'],
|
||||
function ($, _, Backbone){
|
||||
|
||||
var SearchItem = Backbone.Model.extend({
|
||||
//default attributes
|
||||
defaults: {
|
||||
ricetta_id: "",
|
||||
titolo: '',
|
||||
autore: '',
|
||||
valutazione: 0,
|
||||
difficolta: 0,
|
||||
categoria_name: 0
|
||||
}
|
||||
});
|
||||
|
||||
return SearchItem;
|
||||
});
|
||||
|
||||
+30
-29
@@ -1,30 +1,31 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/about/aboutViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function($, _, Backbone, aboutViewTemplate, BaseView, Profile){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/about/aboutViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function ($, _, Backbone, aboutViewTemplate, BaseView, Profile) {
|
||||
|
||||
var AboutView = BaseView.extend({
|
||||
|
||||
//initialize template
|
||||
template:_.template(aboutViewTemplate),
|
||||
|
||||
initialize: function () {
|
||||
AboutView.__super__.initialize.call(this);
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
AboutView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template( { app: myManifest, profile: Profile }));
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#infoBtn").addClass("ui-btn-active");
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return AboutView;
|
||||
});
|
||||
var AboutView = BaseView.extend({
|
||||
//initialize template
|
||||
template: _.template(aboutViewTemplate),
|
||||
initialize: function () {
|
||||
this.id = "AboutView";
|
||||
AboutView.__super__.initialize.call(this);
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
AboutView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({app: myManifest, profile: Profile}));
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#infoBtn").addClass("ui-btn-active");
|
||||
}
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return AboutView;
|
||||
});
|
||||
@@ -1,7 +1,8 @@
|
||||
<div data-role="content">
|
||||
<br>
|
||||
<center>
|
||||
<h1 style='font-size: xx-large;'><%= app.Name %></h1>
|
||||
<h1 style='font-size: xx-large;'><%= app.Name %><sup style='font-size: medium;'>©</sup></h1>
|
||||
<p>Copyright 2014<br>Lievitario è un marchio registrato</p>
|
||||
<br>Applicazione Ricettario del <br><br>'<i><b>Gruppo La Pasta Madre</b></i>'<br><br>
|
||||
<b>Versione:</b> <%= app.Version %><br><br>
|
||||
<b>Sviluppatore:</b> <%= app.Author %><br><br>
|
||||
@@ -17,6 +18,8 @@
|
||||
<i>Per il codice del convertitore</i><br><br>
|
||||
ringrazio l'autore Giuseppe Burgio <a href="http://www.pastamadre.eu/">PastaMadre</a><br><br>
|
||||
<i>Per l'inserimento di tutte le ricette</i><br><br>
|
||||
Monica R.<br>
|
||||
Rita M.<br>
|
||||
Angela P.<br>
|
||||
Carlotta G.<br>
|
||||
Cristina D.<br>
|
||||
@@ -26,7 +29,6 @@
|
||||
Lucia A.<br>
|
||||
Malek Ben C.<br>
|
||||
Raffaella G.<br>
|
||||
Rita M.<br>
|
||||
Serenella S.<br>
|
||||
Valentina C.<br>
|
||||
Valentina D'a.<br>
|
||||
|
||||
@@ -3,22 +3,45 @@ function($, _, Backbone, Footer, Header, Profile){
|
||||
|
||||
var BaseView = Backbone.View.extend({
|
||||
|
||||
id: "",
|
||||
header: null,
|
||||
footer: null,
|
||||
created: true,
|
||||
|
||||
initialize: function () {
|
||||
this.header = new Header({ title: "Il Lievitario"});
|
||||
this.footer = new Footer();
|
||||
this.footer = new Footer();
|
||||
if( this.id !== "")
|
||||
{
|
||||
var el = $('#' + this.id);
|
||||
if(el.length !== 0)
|
||||
{
|
||||
this.created = false;
|
||||
this.setElement(el);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
render: function(){
|
||||
this.header.render();
|
||||
this.footer.render();
|
||||
//add the attribute 'data-role="page" ' for each view's div
|
||||
this.$el.attr('data-role', 'page');
|
||||
this.$el.attr('data-theme', Profile.data.tema);
|
||||
isStayInPage:function(){
|
||||
return true;
|
||||
},
|
||||
|
||||
render: function(){
|
||||
if(this.created === true)
|
||||
{
|
||||
this.header.render();
|
||||
this.footer.render();
|
||||
//add the attribute 'data-role="page" ' for each view's div
|
||||
this.$el.attr('data-role', 'page');
|
||||
this.$el.attr('data-theme', Profile.data.tema);
|
||||
this.$el.attr('stay-in-page', this.isStayInPage());
|
||||
this.$el.attr('id', this.id);
|
||||
}
|
||||
},
|
||||
onShowed: null
|
||||
onShowing: null,
|
||||
onShowed: null,
|
||||
onClosing: null,
|
||||
onClosed: null
|
||||
});
|
||||
return BaseView;
|
||||
});
|
||||
@@ -1,59 +1,67 @@
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/category/categoryViewTemplate.html', 'text!modules/category/categoryItemTemplate.html', 'modules/base/baseView'],
|
||||
function ($, _, Backbone, categoryViewTemplate, categoryItemTemplate, BaseView) {
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/category/categoryViewTemplate.html',
|
||||
'text!modules/category/categoryItemTemplate.html', 'modules/base/baseView', 'libs/fastclick', 'classes/debug'],
|
||||
function ($, _, Backbone, categoryViewTemplate, categoryItemTemplate, BaseView, FastClick, Debug) {
|
||||
|
||||
var CategoryView = BaseView.extend({
|
||||
collection: null,
|
||||
categoryName: null,
|
||||
//initialize template
|
||||
template: _.template(categoryViewTemplate),
|
||||
itemtemplate: _.template(categoryItemTemplate),
|
||||
itemtemplate: _.template(categoryItemTemplate, {variable: 'data'}),
|
||||
initialize: function (options) {
|
||||
this.id = "CategoryView" + options.categoryId;
|
||||
var self = this;
|
||||
CategoryView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
this.categoryName = options.categoryName;
|
||||
this.collection.fetch({
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
self.renderItem();
|
||||
//if (this.created === true)
|
||||
{
|
||||
this.collection = options.collection;
|
||||
this.categoryName = options.categoryName;
|
||||
if(!this.collection.isCached() ||
|
||||
this.$el.find('#allRicette').length === 0){
|
||||
this.collection.fetch({
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
self.renderItem();
|
||||
}
|
||||
});
|
||||
}
|
||||
//success: function(){ self.renderItem(); }
|
||||
});
|
||||
}
|
||||
},
|
||||
renderItem: function () {
|
||||
var $ul = $('#allRicette');
|
||||
var $ul = this.$el.find('#allRicette');
|
||||
if ($ul.html().trim() === "") {
|
||||
// var start = new Date().getTime();
|
||||
|
||||
var items = this.itemtemplate({data: this.collection.toJSON()});
|
||||
|
||||
$ul.html(items);
|
||||
$ul.listview("refresh");
|
||||
$ul.trigger("updatelayout");
|
||||
|
||||
$ul.find('input[type=radio].star').rating({
|
||||
callback: function (value, link) {
|
||||
var tip = $('#hover-test');
|
||||
if (value === undefined)
|
||||
{
|
||||
$('#hover-test').html("Nessuna" || 'value: ');
|
||||
}
|
||||
else
|
||||
$('#hover-test').html(link.title || 'value: ' + value);
|
||||
}
|
||||
});
|
||||
var self = this;
|
||||
var html = "";
|
||||
//$ul.html(html);
|
||||
/*_.each(this.collection.toJSON(), function (d) {
|
||||
html += self.itemtemplate(d);
|
||||
});*/
|
||||
html = this.itemtemplate(this.collection.toJSON());
|
||||
|
||||
$ul.html(html);
|
||||
$ul.listview("refresh");
|
||||
//$ul.trigger("updatelayout");
|
||||
}
|
||||
|
||||
$.mobile.loading('hide');
|
||||
//$( '[data-alpha="true"]' ).alphascroll();
|
||||
|
||||
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
//this.header.title = "pippo";
|
||||
CategoryView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({categoryName: this.categoryName}));
|
||||
this.$el.append(this.footer.$el);
|
||||
//return to enable chained calls
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
CategoryView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({categoryName: this.categoryName}));
|
||||
this.$el.append(this.footer.$el);
|
||||
//return to enable chained calls
|
||||
}
|
||||
this.$el.find("#indexBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2,17 +2,26 @@
|
||||
<h1>Nessuna ricetta trovata</h1>
|
||||
<%} else { for (var i = 0; i < data.length; i++) { %>
|
||||
<% var item = data[i]; %>
|
||||
<li><a href="#ricetta/<%= item.ricetta_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r">
|
||||
<div class='ricettaTitolo'><%= unescape(item.titolo) %></div>
|
||||
<div class='ricettaAutore'><%= unescape(item.autore) %></div>
|
||||
<div id="valutazione" style="clear:both;">
|
||||
<form id="difficoltaFrm" data-role="none">
|
||||
<input name="difficolta" <% if(item.difficolta==="1"){%>checked="checked"<%}%> type="radio" data-role="none" value="1" disabled="disabled" title="Molto Semplice" class="star"/>
|
||||
<input name="difficolta" <% if(item.difficolta==="2"){%>checked="checked"<%}%> type="radio" data-role="none" value="2" disabled="disabled" title="Semplice" class="star"/>
|
||||
<input name="difficolta" <% if(item.difficolta==="3"){%>checked="checked"<%}%> type="radio" data-role="none" value="3" disabled="disabled" title="Normale" class="star"/>
|
||||
<input name="difficolta" <% if(item.difficolta==="4"){%>checked="checked"<%}%> type="radio" data-role="none" value="4" disabled="disabled" title="Difficile" class="star"/>
|
||||
<input name="difficolta" <% if(item.difficolta==="5"){%>checked="checked"<%}%> type="radio" data-role="none" value="5" disabled="disabled" title="Molto Difficile" class="star"/>
|
||||
</form>
|
||||
</div>
|
||||
</a></li>
|
||||
<li><a href="#ricetta/<%= item.ricetta_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r">
|
||||
<div class='ricettaTitolo'><%= unescape(item.titolo) %></div>
|
||||
<div class='ricettaAutore'><%= unescape(item.autore) %></div>
|
||||
<br><div class='ricettaAutore'>Diff.: </div>
|
||||
<div id="valutazione">
|
||||
<div role="text" data-role="none" aria-label="Molto Semplice" class="star-rating rater-0 star star-rating-applied star-rating-live <% if(parseInt(item.difficolta)>=1){%>star-rating-on<%}%>">
|
||||
<div data-role="none" title="Molto Semplice">1</div>
|
||||
</div>
|
||||
<div data-role="none" role="text" aria-label="Semplice" class="star-rating rater-0 star star-rating-applied star-rating-live <% if(parseInt(item.difficolta)>=2){%>star-rating-on<%}%>">
|
||||
<div data-role="none" title="Semplice">2</div>
|
||||
</div>
|
||||
<div data-role="none" role="text" aria-label="Normale" class="star-rating rater-0 star star-rating-applied star-rating-live <% if(parseInt(item.difficolta)>=3){%>star-rating-on<%}%>">
|
||||
<div data-role="none" title="Normale">3</div>
|
||||
</div>
|
||||
<div data-role="none" role="text" aria-label="Difficile" class="star-rating rater-0 star star-rating-applied star-rating-live <% if(parseInt(item.difficolta)>=4){%>star-rating-on<%}%>">
|
||||
<div data-role="none" title="Difficile">4</div>
|
||||
</div>
|
||||
<div data-role="none" role="text" aria-label="Molto Difficile" class="star-rating rater-0 star star-rating-applied star-rating-live <% if(parseInt(item.difficolta)>=5){%>star-rating-on<%}%>">
|
||||
<div data-role="none" title="Molto Difficile">5</div>
|
||||
</div>
|
||||
</div>
|
||||
</a></li>
|
||||
<% }} %>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="categoryListContent" data-role="content">
|
||||
<h1>Indice Ricette<br><%= categoryName %></h1>
|
||||
<h1>Indice <%= categoryName %></h1>
|
||||
<ul id="allRicette" data-role="listview" data-autodividers="true" data-alpha="true" data-inset="true">
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,31 +1,31 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/donation/donationViewTemplate.html', 'modules/base/baseView'],
|
||||
function($, _, Backbone, homeViewTemplate, BaseView){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/donation/donationViewTemplate.html', 'modules/base/baseView'],
|
||||
function ($, _, Backbone, homeViewTemplate, BaseView) {
|
||||
|
||||
var DonationView = BaseView.extend({
|
||||
|
||||
//initialize template
|
||||
template:_.template(homeViewTemplate),
|
||||
|
||||
initialize: function () {
|
||||
DonationView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
DonationView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#moreBtn").addClass("ui-btn-active");
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return DonationView;
|
||||
});
|
||||
var DonationView = BaseView.extend({
|
||||
//initialize template
|
||||
template: _.template(homeViewTemplate),
|
||||
initialize: function () {
|
||||
this.id = "DonationView";
|
||||
DonationView.__super__.initialize.call(this);
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
DonationView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#moreBtn").addClass("ui-btn-active");
|
||||
}
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return DonationView;
|
||||
});
|
||||
+29
-29
@@ -1,30 +1,30 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/faq/faqViewTemplate.html', 'modules/base/baseView'],
|
||||
function($, _, Backbone, faqViewTemplate, BaseView){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/faq/faqViewTemplate.html', 'modules/base/baseView'],
|
||||
function ($, _, Backbone, faqViewTemplate, BaseView) {
|
||||
|
||||
var FaqView = BaseView.extend({
|
||||
|
||||
//initialize template
|
||||
template:_.template(faqViewTemplate),
|
||||
|
||||
initialize: function () {
|
||||
FaqView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
FaqView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#faqBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return FaqView;
|
||||
});
|
||||
var FaqView = BaseView.extend({
|
||||
//initialize template
|
||||
template: _.template(faqViewTemplate),
|
||||
initialize: function () {
|
||||
this.id = "FaqView";
|
||||
FaqView.__super__.initialize.call(this);
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
FaqView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
}
|
||||
this.$el.find("#faqBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return FaqView;
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
<div data-role="content">
|
||||
<h1>Lo sai che?</h1>
|
||||
<ul data-role="listview" id="faqList">
|
||||
<ul data-role="listview" id="faqList" style="padding-left: 15px; padding-right: 15px;">
|
||||
<li data-role="collapsible" data-iconpos="left" data-inset="false"><h2>PM. Iniziare</h2> <div data-role="collapsible"><h4>Come ottenere il Lievito Madre</h4><p>Il modo più semplice ed immediato è trovare uno spacciatore che ci doni gratuitamente un pezzetto del suo Lievito Madre.
|
||||
Al link seguente trovi la mappa degli spacciatori del gruppo e quella generale della comunità del cibo.<br>
|
||||
<a href="https://www.facebook.com/notes/gruppo-la-pasta-madre/la-mappa-spacciatori-del-gruppo/733005206786758">Link Gruppo FB</a><br>
|
||||
|
||||
+92
-44
@@ -1,47 +1,95 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/home/homeViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function($, _, Backbone, homeViewTemplate, BaseView, Profile){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html',
|
||||
'modules/base/baseView', 'classes/profile', 'classes/debug', 'jQueryPlugins'],
|
||||
function ($, _, Backbone, homeViewTemplate, BaseView, Profile, Debug) {
|
||||
|
||||
var HomeView = BaseView.extend({
|
||||
var HomeView = BaseView.extend({
|
||||
//initialize template
|
||||
template: _.template(homeViewTemplate),
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
this.id = "HomeView";
|
||||
HomeView.__super__.initialize.call(this);
|
||||
if (Profile.data.picture === null)
|
||||
{
|
||||
Profile.setPictureEvent = this.changePicture;
|
||||
}
|
||||
},
|
||||
changePicture: function (val) {
|
||||
var item = $('.itemMenuHomeMetro a[href="#settingsView"]');
|
||||
if (item.length > 0)
|
||||
{
|
||||
$('.profileClass').removeClass("profileClass");
|
||||
item.css('background', 'url(' + val + ') 50% 50% no-repeat');
|
||||
}
|
||||
},
|
||||
events: {
|
||||
//"click #goFbGroup": "goFbGroup"
|
||||
},
|
||||
//goFbGroup: function () {
|
||||
// window.localStorage.setItem("goFbGroup", 1);
|
||||
// window.location.href = "https://www.facebook.com/groups/732844273469518/";
|
||||
//},
|
||||
freeWall: null,
|
||||
onShowed: function ()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
//initialize template
|
||||
template:_.template(homeViewTemplate),
|
||||
var size = $('.itemMenuHomeMetro').first().css("width").replace("px", "");
|
||||
if (parseInt(size) === 0)
|
||||
{
|
||||
size = $('.itemMenuHomeMetro').first().attr("lastSize");
|
||||
}
|
||||
|
||||
$('.itemMenuHomeMetro').first().attr("lastSize", size);
|
||||
if (this.freeWall === null) {
|
||||
this.freeWall = new freewall("#menuHomeMetro");
|
||||
}
|
||||
this.freeWall.reset({
|
||||
selector: '.itemMenuHomeMetro',
|
||||
animate: true,
|
||||
cellW: size,
|
||||
cellH: size,
|
||||
onResize: function () {
|
||||
this.refresh();
|
||||
Debug.writeMessage("onResize");
|
||||
}
|
||||
});
|
||||
this.freeWall.fitWidth();
|
||||
|
||||
if (Profile.data.picture !== null)
|
||||
{
|
||||
this.changePicture(Profile.data.picture);
|
||||
}
|
||||
|
||||
initialize: function () {
|
||||
HomeView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
|
||||
events: {
|
||||
"click #goFbGroup": "goFbGroup"
|
||||
},
|
||||
|
||||
goFbGroup: function(){
|
||||
window.localStorage.setItem("goFbGroup", 1);
|
||||
window.location.href = "https://www.facebook.com/groups/732844273469518/";
|
||||
},
|
||||
|
||||
onShowed: function()
|
||||
{
|
||||
if(window.localStorage.getItem("goFbGroup") !== "1")
|
||||
this.$el.find("#nuovoGruppo").popup("open");
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
HomeView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({ profile: Profile}));
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#homeBtn").addClass("ui-btn-active");
|
||||
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return HomeView;
|
||||
});
|
||||
Debug.writeMessage(myManifest.Agent.ua);
|
||||
//if (window.localStorage.getItem("goFbGroup") !== "1")
|
||||
// this.$el.find("#nuovoGruppo").popup("open");
|
||||
},
|
||||
onClosing: function () {
|
||||
if (this.freeWall !== null)
|
||||
this.freeWall.reset({
|
||||
selector: '.itemMenuHomeMetro',
|
||||
onResize: function(){}
|
||||
});
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
HomeView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({profile: Profile}));
|
||||
this.$el.append(this.footer.$el);
|
||||
}
|
||||
this.$el.find("#homeBtn").addClass("ui-btn-active");
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return HomeView;
|
||||
});
|
||||
@@ -4,22 +4,55 @@
|
||||
<h2 id="benvenuto">Bentornat<% if(profile.data.gender=="male"){%>o<%}else{%>a<%}%>
|
||||
<br><%=profile.data.name %></h2>
|
||||
<% } %>
|
||||
<img id="sfondo" src="https://dl.dropboxusercontent.com/s/6qrdp9mbi1rb92k/sfondo.png">
|
||||
</div>
|
||||
<div>
|
||||
<% var customClassTheme = "itemMenuHomeMetro-" + profile.data.tema;%>
|
||||
<div id="menuHomeMetro">
|
||||
<div class="itemMenuHomeMetro <%= customClassTheme %><% if(!profile.isConnected()){ %> loginClass<% }else{ %> profileClass<%}%>">
|
||||
<div>
|
||||
<% if(profile.isConnected()){ %>
|
||||
<a href="#settingsView" data-role="none" style=""></a>
|
||||
<span>Profilo</span>
|
||||
<% }else{ %>
|
||||
<a href="#syncView" data-role="none"></a>
|
||||
<span>Login</span>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="itemMenuHomeMetro <%= customClassTheme %> indexClass">
|
||||
<div>
|
||||
<a href="#indexView" data-role="none"></a>
|
||||
<span>Indice</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="itemMenuHomeMetro <%= customClassTheme %> searchClass">
|
||||
<div>
|
||||
<a href="#searchView" data-role="none"></a>
|
||||
<span>Ricerca</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="itemMenuHomeMetro <%= customClassTheme %> blogClass">
|
||||
<div>
|
||||
<a href="http://blog.gruppolapastamadre.it" data-role="none"></a>
|
||||
<span>Blog</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="popup" id="nuovoGruppo" data-history="false" data-dismissible="false">
|
||||
<!--<div data-role="popup" id="nuovoGruppo" data-history="false" data-dismissible="false">
|
||||
<div data-role="header"><h1>IMPORTANTE</h1></div>
|
||||
<div role="main" class="ui-content">
|
||||
<p style="text-align: center;font-style: italic;">
|
||||
<img src="https://dl.dropboxusercontent.com/s/xnbrbbe7eejkfv2/festa.png"><br><br>
|
||||
Le admin <br><br><b>Alessia, Elena e Francesca</b><br><br>hanno RIFONDATO IL GRUPPO!!<br>
|
||||
<br>"<b>Gruppo La Pasta Madre</b>"<br>
|
||||
<br>vuoi chiedere di diventare membro?
|
||||
<br>Se sei già membro premi si e poi torna indietro con il browser
|
||||
</p>
|
||||
<p style="text-align: center;">
|
||||
<a id="goFbGroup" href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b" data-rel="back">Si</a>
|
||||
<a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b" data-rel="back" data-transition="flow">No</a>
|
||||
</p>
|
||||
<div role="main" class="ui-content">
|
||||
<p style="text-align: center;font-style: italic;">
|
||||
<img src="https://dl.dropboxusercontent.com/s/xnbrbbe7eejkfv2/festa.png"><br><br>
|
||||
Le admin <br><br><b>Alessia, Elena e Francesca</b><br><br>hanno RIFONDATO IL GRUPPO!!<br>
|
||||
<br>"<b>Gruppo La Pasta Madre</b>"<br>
|
||||
<br>vuoi chiedere di diventare membro?
|
||||
<br>Se sei già membro premi si e poi torna indietro con il browser
|
||||
</p>
|
||||
<p style="text-align: center;">
|
||||
<a id="goFbGroup" href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b" data-rel="back">Si</a>
|
||||
<a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b" data-rel="back" data-transition="flow">No</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
+46
-35
@@ -1,38 +1,49 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/index/indexViewTemplate.html', 'modules/base/baseView'],
|
||||
function($, _, Backbone, indexViewTemplate, BaseView){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/index/indexViewTemplate.html', 'text!modules/index/indexItemViewTemplate.html', 'modules/base/baseView'],
|
||||
function ($, _, Backbone, indexViewTemplate, indexItemViewTemplate, BaseView) {
|
||||
|
||||
var IndexView = BaseView.extend({
|
||||
var IndexView = BaseView.extend({
|
||||
collection: null,
|
||||
//initialize template
|
||||
template: _.template(indexViewTemplate),
|
||||
//templateItem:_.template(indexItemViewTemplate, {variable: 'item'}),
|
||||
|
||||
collection: null,
|
||||
//initialize template
|
||||
template:_.template(indexViewTemplate),
|
||||
initialize: function (options) {
|
||||
this.id = "IndexView";
|
||||
var self = this;
|
||||
IndexView.__super__.initialize.call(this);
|
||||
/*this.collection = options.collection;
|
||||
this.collection.fetch({
|
||||
success: function(){
|
||||
var $ul = $('#categoryList');
|
||||
var html = "";
|
||||
_.each(self.collection.toJSON(), function(d) {
|
||||
html += self.templateItem(d);
|
||||
});
|
||||
$ul.html(html);
|
||||
$ul.listview("refresh");
|
||||
$ul.trigger("updatelayout");
|
||||
self.trigger("renderCompleted:Categories",self);
|
||||
}
|
||||
});*/
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
IndexView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
IndexView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
this.collection.fetch({
|
||||
success: function(data, textStatus, jqXHR){
|
||||
self.render();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
IndexView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({data:this.collection.toJSON()}));
|
||||
this.$el.append(this.footer.$el);
|
||||
this.trigger("renderCompleted:Categories",this);
|
||||
//return to enable chained calls
|
||||
this.$el.find("#indexBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return IndexView;
|
||||
});
|
||||
//return to enable chained calls
|
||||
}
|
||||
this.$el.find("#indexBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return IndexView;
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
<li><a href="#category/<%=item.name%>/<%= item.category_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r"><%= item.name %></a></li>
|
||||
@@ -1,9 +1,15 @@
|
||||
<div id="categoryListContent" data-role="content">
|
||||
<h1>Indice Ricette</h1>
|
||||
<h1>Indice</h1>
|
||||
<ul id="categoryList" data-role="listview" data-inset="true">
|
||||
<% for (var i = 0; i < data.length; i++) { %>
|
||||
<% var item = data[i]; %>
|
||||
<li><a href="#category/<%=item.name%>/<%= item.category_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r"><%= item.name %></a></li>
|
||||
<% } %>
|
||||
</ul>
|
||||
<li><a href="#category/Dolci/3" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Dolci</a></li>
|
||||
<li><a href="#category/Esuberi/6" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Esuberi</a></li>
|
||||
<li><a href="#category/Focacce/4" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Focacce</a></li>
|
||||
<li><a href="#category/Grandi Lievitati/10" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Grandi Lievitati</a></li>
|
||||
<li><a href="#category/Pane/1" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Pane</a></li>
|
||||
<li><a href="#category/Panificati Vari/5" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Panificati Vari</a></li>
|
||||
<li><a href="#category/Pasquali/9" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Pasquali</a></li>
|
||||
<li><a href="#category/Pizza/2" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Pizza</a></li>
|
||||
<li><a href="#category/Senza Glutine/8" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Senza Glutine</a></li>
|
||||
<li><a href="#category/Vegane/7" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Vegane</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
+101
-105
@@ -1,129 +1,125 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/item/itemViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function($, _, Backbone, itemViewTemplate, BaseView, Profile){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function ($, _, Backbone, itemViewTemplate, BaseView, Profile) {
|
||||
|
||||
var ItemView = BaseView.extend({
|
||||
var ItemView = BaseView.extend({
|
||||
collRicetta: null,
|
||||
collIngredienti: null,
|
||||
fetchedRicetta: false,
|
||||
fetchedIngredienti: false,
|
||||
//initialize template
|
||||
template: _.template(itemViewTemplate),
|
||||
initialize: function (options) {
|
||||
this.id = "ItemView";
|
||||
var self = this;
|
||||
ItemView.__super__.initialize.call(this);
|
||||
this.collRicetta = options.collRicetta;
|
||||
this.collIngredienti = options.collIngredienti;
|
||||
|
||||
collRicetta: null,
|
||||
collIngredienti: null,
|
||||
|
||||
fetchedRicetta: false,
|
||||
fetchedIngredienti: false,
|
||||
//initialize template
|
||||
template:_.template(itemViewTemplate),
|
||||
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
ItemView.__super__.initialize.call(this);
|
||||
this.collRicetta = options.collRicetta;
|
||||
this.collIngredienti = options.collIngredienti;
|
||||
|
||||
this.collRicetta.fetch({success: function() {
|
||||
this.collRicetta.fetch({success: function () {
|
||||
self.fetchedRicetta = true;
|
||||
self.render();
|
||||
}});
|
||||
this.collIngredienti.fetch({success: function() {
|
||||
this.collIngredienti.fetch({success: function () {
|
||||
self.fetchedIngredienti = true;
|
||||
self.render();
|
||||
}});
|
||||
},
|
||||
|
||||
events: {
|
||||
"click #favoriteBtn": "favBtn",
|
||||
"click #backBtn": "backBtn"
|
||||
},
|
||||
|
||||
backBtn:function(e){
|
||||
e.preventDefault();
|
||||
window.history.back();
|
||||
},
|
||||
|
||||
favBtn:function(e){
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
var ric = this.collRicetta.toJSON()[0];
|
||||
|
||||
if(!Profile.isConnected())
|
||||
{
|
||||
self.$el.find('#popupDialog').popup("open");
|
||||
return;
|
||||
}
|
||||
|
||||
Profile.addRicettaBloccoNote(ric.ricetta_id,
|
||||
function(msg) {
|
||||
var favBtn = self.$el.find('#favoriteBtn');
|
||||
favBtn.addClass('ui-disabled');
|
||||
}
|
||||
);
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
if(this.fetchedIngredienti && this.fetchedRicetta )
|
||||
{
|
||||
ItemView.__super__.render.call(this);
|
||||
isStayInPage: function () {
|
||||
return false;
|
||||
},
|
||||
events: {
|
||||
"click #favoriteBtn": "favBtn",
|
||||
"click #backBtn": "backBtn"
|
||||
},
|
||||
backBtn: function (e) {
|
||||
e.preventDefault();
|
||||
window.history.back();
|
||||
},
|
||||
favBtn: function (e) {
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
var ric = this.collRicetta.toJSON()[0];
|
||||
|
||||
var ric = self.collRicetta.toJSON()[0];
|
||||
if (!Profile.isConnected())
|
||||
{
|
||||
self.$el.find('#popupDialog').popup("open");
|
||||
return;
|
||||
}
|
||||
|
||||
Profile.existRicettaBloccoNote(ric.ricetta_id,
|
||||
function(exist) {
|
||||
self.$el.append(self.template({
|
||||
ricetta: self.collRicetta.toJSON()[0],
|
||||
ingredienti: self.collIngredienti.toJSON()
|
||||
}));
|
||||
|
||||
self.$arrayContent = self.$el.find('div[data-role="content"]');
|
||||
self.$arrayNavBar = self.$el.find('div[data-role="navbar"] a');
|
||||
|
||||
var favBtn = self.$el.find('#favoriteBtn');
|
||||
if(exist > 0)
|
||||
Profile.addRicettaBloccoNote(ric.ricetta_id,
|
||||
function (msg) {
|
||||
var favBtn = self.$el.find('#favoriteBtn');
|
||||
favBtn.addClass('ui-disabled');
|
||||
|
||||
self.$arrayNavBar.on("click", function(e){
|
||||
e.preventDefault();
|
||||
var index = jQuery.inArray( this , self.$arrayNavBar);
|
||||
self.goToContent(index);
|
||||
});
|
||||
|
||||
self.$arrayContent.on("swipeleft", function(e) {
|
||||
var index = jQuery.inArray(this, self.$arrayContent);
|
||||
self.goToContent(index + 1 );
|
||||
});
|
||||
self.$arrayContent.on("swiperight", function(e) {
|
||||
var index = jQuery.inArray(this, self.$arrayContent);
|
||||
self.goToContent(index - 1 );
|
||||
});
|
||||
self.trigger("renderCompleted:Item",self);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.fetchedIngredienti && this.fetchedRicetta)
|
||||
{
|
||||
ItemView.__super__.render.call(this);
|
||||
var self = this;
|
||||
|
||||
var ric = self.collRicetta.toJSON()[0];
|
||||
|
||||
Profile.existRicettaBloccoNote(ric.ricetta_id,
|
||||
function (exist) {
|
||||
self.$el.append(self.template({
|
||||
ricetta: self.collRicetta.toJSON()[0],
|
||||
ingredienti: self.collIngredienti.toJSON()
|
||||
}));
|
||||
|
||||
self.$arrayContent = self.$el.find('div[data-role="content"]');
|
||||
self.$arrayNavBar = self.$el.find('div[data-role="navbar"] a');
|
||||
|
||||
var favBtn = self.$el.find('#favoriteBtn');
|
||||
if (exist > 0)
|
||||
favBtn.addClass('ui-disabled');
|
||||
|
||||
self.$arrayNavBar.on("click", function (e) {
|
||||
e.preventDefault();
|
||||
var index = jQuery.inArray(this, self.$arrayNavBar);
|
||||
self.goToContent(index);
|
||||
});
|
||||
|
||||
self.$arrayContent.on("swipeleft", function (e) {
|
||||
var index = jQuery.inArray(this, self.$arrayContent);
|
||||
self.goToContent(index + 1);
|
||||
});
|
||||
self.$arrayContent.on("swiperight", function (e) {
|
||||
var index = jQuery.inArray(this, self.$arrayContent);
|
||||
self.goToContent(index - 1);
|
||||
});
|
||||
self.trigger("renderCompleted:Item", self);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
},
|
||||
|
||||
goToContent:function(newIndex)
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
},
|
||||
goToContent: function (newIndex)
|
||||
{
|
||||
if(this.$arrayContent.length > newIndex && newIndex >= 0)
|
||||
if (this.$arrayContent.length > newIndex && newIndex >= 0)
|
||||
{
|
||||
this.indexContent = newIndex;
|
||||
this.switchContent();
|
||||
}
|
||||
},
|
||||
|
||||
switchContent: function(){
|
||||
this.$arrayContent.hide();
|
||||
this.$arrayNavBar.removeClass('ui-btn-active');
|
||||
this.$arrayNavBar.removeClass('ui-state-persist');
|
||||
$(this.$arrayContent[this.indexContent]).show();
|
||||
$(this.$arrayNavBar[this.indexContent]).addClass('ui-btn-active');
|
||||
$(this.$arrayNavBar[this.indexContent]).addClass('ui-state-persist');
|
||||
}
|
||||
});
|
||||
return ItemView;
|
||||
});
|
||||
switchContent: function () {
|
||||
this.$arrayContent.hide();
|
||||
this.$arrayNavBar.removeClass('ui-btn-active');
|
||||
this.$arrayNavBar.removeClass('ui-state-persist');
|
||||
$(this.$arrayContent[this.indexContent]).show();
|
||||
$(this.$arrayNavBar[this.indexContent]).addClass('ui-btn-active');
|
||||
$(this.$arrayNavBar[this.indexContent]).addClass('ui-state-persist');
|
||||
}
|
||||
});
|
||||
return ItemView;
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
<div data-role="header" data-position="fixed" data-tap-toggle="false">
|
||||
<a id="favoriteBtn" href="" data-role="button" class="ui-btn-left" data-icon="custom" style="font-size: x-small;">Agg. al Blocco</a>
|
||||
<a id="favoriteBtn" href="#" class="nav-glyphish-example ui-btn ui-icon-myHome ui-btn-icon-notext ui-btn-left" data-icon="custom"></a>
|
||||
<h3 id='titoloRicetta'><%= unescape(ricetta.titolo)%></h3>
|
||||
<a id="backBtn" href="" data-role="button" class="ui-btn-right" data-icon="custom">Indietro</a>
|
||||
<a id="backBtn" href="#" class="nav-glyphish-example ui-btn ui-icon-myHome ui-btn-icon-notext ui-btn-right" data-icon="custom"></a>
|
||||
</div>
|
||||
<div id="contentIngredienti" data-role="content">
|
||||
<h1>Ingredienti</h1>
|
||||
@@ -17,10 +17,12 @@
|
||||
nome_ingr = "";
|
||||
} %> <li style="<%= liStyle %>"><b><%= nome_ingr %></b><%= qty %> <%= ingrediente.unita %> <%= unescape(ingrediente.note) %></li><br> <% }); %>
|
||||
</p></center>
|
||||
<p style="font-size: xx-small;font-weight: lighter;">La proprietà del materiale pubblicato nel Lievitario , salvo diversa indicazione, è dei rispettivi autori. E’ vietata la ripubblicazione, anche parziale, di tutto il materiale pubblicato nel sito Lievitario senza preventiva autorizzazione scritta.</p>
|
||||
</div>
|
||||
<div id="contentProcedimento" data-role="content" style="display: none;">
|
||||
<h1>Procedimento</h1>
|
||||
<p id='procedimento'><%= ricetta.procedimento%></p>
|
||||
<p style="font-size: xx-small;font-weight: lighter;">La proprietà del materiale pubblicato nel Lievitario , salvo diversa indicazione, è dei rispettivi autori. E’ vietata la ripubblicazione, anche parziale, di tutto il materiale pubblicato nel sito Lievitario senza preventiva autorizzazione scritta.</p>
|
||||
</div>
|
||||
<!--<div id="contentFoto" data-role="content" data-theme="d" style="display: none;" data-iscroll>
|
||||
<h1>Foto</h1>
|
||||
|
||||
+40
-42
@@ -1,43 +1,41 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/more/moreViewTemplate.html', 'modules/base/baseView'],
|
||||
function($, _, Backbone, moreViewTemplate, BaseView){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/more/moreViewTemplate.html', 'modules/base/baseView'],
|
||||
function ($, _, Backbone, moreViewTemplate, BaseView) {
|
||||
|
||||
var MoreView = BaseView.extend({
|
||||
|
||||
collection: null,
|
||||
//initialize template
|
||||
template:_.template(moreViewTemplate),
|
||||
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
MoreView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
|
||||
events:{
|
||||
"click #converterLnk": "converterLnkClick"
|
||||
},
|
||||
|
||||
converterLnkClick:function()
|
||||
{
|
||||
window.location.href = "http://www.pastamadre.eu/webapps/conversione_lieviti/index.php";
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
MoreView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
|
||||
this.$el.find("#moreBtn").addClass("ui-btn-active");
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return MoreView;
|
||||
});
|
||||
var MoreView = BaseView.extend({
|
||||
collection: null,
|
||||
//initialize template
|
||||
template: _.template(moreViewTemplate),
|
||||
initialize: function (options) {
|
||||
this.id = "MoreView";
|
||||
var self = this;
|
||||
MoreView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
events: {
|
||||
"click #converterLnk": "converterLnkClick"
|
||||
},
|
||||
converterLnkClick: function ()
|
||||
{
|
||||
window.location.href = "http://www.pastamadre.eu/webapps/conversione_lieviti/?p=conversioneLieviti";
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
MoreView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
}
|
||||
this.$el.find("#moreBtn").addClass("ui-btn-active");
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return MoreView;
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
<div data-role="content">
|
||||
<ul data-role="listview" data-inset="true">
|
||||
<li data-role="list-divider">Altre opzioni</li>
|
||||
<li><a id="converterLnk" href="#"><img src="Resources/img/converter.png" alt="Convertitore" class="ui-li-icon ui-corner-none">Convertitore</a></li>
|
||||
<li><a id="converterLnk" href="#" class="ui-li-icon ui-corner-none">Convertitore</a></li>
|
||||
|
||||
<li><a href="#settingsView"><img src="Resources/img/settings.png" alt="Impostazioni" class="ui-li-icon ui-corner-none">Impostazioni</a></li>
|
||||
|
||||
<li><a href="#aboutView"><img src="Resources/img/info.png" alt="Informazioni su..." class="ui-li-icon ui-corner-none">Informazioni su...</a></li>
|
||||
<li><a href="#donationView"><img src="Resources/img/donation.png" alt="Donazione" class="ui-li-icon ui-corner-none">Donazione</a></li>
|
||||
<li><a id="settingLnk" href="#settingsView">Impostazioni</a></li>
|
||||
<li><a id="aboutLnk" href="#aboutView">Informazioni su...</a></li>
|
||||
<li><a id="donationLnk" href="#donationView">Donazione</a></li>
|
||||
<li><a id="debugMsgLnk" href="#debugView">Messaggi di debug</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
+72
-74
@@ -1,82 +1,80 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/note/noteViewTemplate.html', 'text!modules/note/noteItemTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function($, _, Backbone, noteViewTemplate, noteItemTemplate, BaseView, Profile){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/note/noteViewTemplate.html', 'text!modules/note/noteItemTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function ($, _, Backbone, noteViewTemplate, noteItemTemplate, BaseView, Profile) {
|
||||
|
||||
var NoteView = BaseView.extend({
|
||||
var NoteView = BaseView.extend({
|
||||
collection: null,
|
||||
//initialize template
|
||||
template: _.template(noteViewTemplate),
|
||||
itemtemplate: _.template(noteItemTemplate),
|
||||
current_ricetta_id: null,
|
||||
initialize: function (options) {
|
||||
this.id = "NoteView";
|
||||
var self = this;
|
||||
NoteView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
this.collection.fetch({success: function () {
|
||||
self.renderItem();
|
||||
}});
|
||||
},
|
||||
events: {
|
||||
"click #deleteItem": "deleteItemClick",
|
||||
"popupafterclose #popupMenu": "popupMenuPopupafterclose"
|
||||
},
|
||||
updateList: function () {
|
||||
var $ul = this.$el.find('#allNote');
|
||||
$ul.html('');
|
||||
var items = this.itemtemplate({data: this.collection.toJSON()});
|
||||
|
||||
collection: null,
|
||||
//initialize template
|
||||
template:_.template(noteViewTemplate),
|
||||
itemtemplate:_.template(noteItemTemplate),
|
||||
current_ricetta_id: null,
|
||||
$ul.html(items);
|
||||
$ul.listview("refresh");
|
||||
$ul.trigger("updatelayout");
|
||||
},
|
||||
renderItem: function () {
|
||||
this.updateList();
|
||||
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
NoteView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
this.collection.fetch({ success: function(){ self.renderItem(); } });
|
||||
},
|
||||
|
||||
events: {
|
||||
"click #deleteItem": "deleteItemClick",
|
||||
"popupafterclose #popupMenu": "popupMenuPopupafterclose"
|
||||
},
|
||||
|
||||
updateList: function(){
|
||||
var $ul = this.$el.find('#allNote');
|
||||
|
||||
var items = this.itemtemplate({data:this.collection.toJSON()});
|
||||
|
||||
$ul.html( items );
|
||||
$ul.listview( "refresh" );
|
||||
$ul.trigger( "updatelayout");
|
||||
},
|
||||
|
||||
renderItem: function(){
|
||||
this.updateList();
|
||||
|
||||
$.mobile.loading( 'hide' );
|
||||
var self = this;
|
||||
this.$el.find('.optionLink').on("click", function(e){
|
||||
$.mobile.loading('hide');
|
||||
var self = this;
|
||||
this.$el.find('.optionLink').on("click", function (e) {
|
||||
e.preventDefault();
|
||||
self.current_ricetta_id = $(e.target.parentElement).find('#itemID').text();
|
||||
self.$el.find('#popupMenu').popup("open");
|
||||
});
|
||||
},
|
||||
deleteItemClick: function (e) {
|
||||
e.preventDefault();
|
||||
self.current_ricetta_id = $(e.target.parentElement).find('#itemID').text();
|
||||
self.$el.find('#popupMenu').popup("open");
|
||||
});
|
||||
},
|
||||
var self = this;
|
||||
Profile.removeRicettaBloccoNote(this.current_ricetta_id, function (msg) {
|
||||
var item = self.collection.get(self.current_ricetta_id);
|
||||
|
||||
deleteItemClick: function(e){
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
Profile.removeRicettaBloccoNote(this.current_ricetta_id, function(msg) {
|
||||
var item = self.collection.get(self.current_ricetta_id);
|
||||
self.$el.find('#popupMenu').popup("close");
|
||||
|
||||
self.$el.find('#popupMenu').popup("close");
|
||||
self.collection.remove(item);
|
||||
self.updateList();
|
||||
});
|
||||
},
|
||||
popupMenuPopupafterclose: function (event, ui) {
|
||||
this.current_ricetta_id = null;
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
if (this.created === true)
|
||||
{
|
||||
//this.header.title = "pippo";
|
||||
NoteView.__super__.render.call(this);
|
||||
|
||||
self.collection.remove(item);
|
||||
self.updateList();
|
||||
});
|
||||
},
|
||||
var self = this;
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
|
||||
popupMenuPopupafterclose: function( event, ui ) {
|
||||
this.current_ricetta_id = null;
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
NoteView.__super__.render.call(this);
|
||||
|
||||
var self = this;
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
|
||||
//return to enable chained calls
|
||||
this.$el.find("#noteBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return NoteView;
|
||||
});
|
||||
//return to enable chained calls
|
||||
}
|
||||
this.$el.find("#noteBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return NoteView;
|
||||
});
|
||||
+84
-42
@@ -1,48 +1,90 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/search/foundViewTemplate.html','text!modules/search/foundItemTemplate.html', 'modules/base/baseView'],
|
||||
function($, _, Backbone, foundViewTemplate, foundItemTemplate, BaseView){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/search/foundViewTemplate.html', 'text!modules/search/foundItemTemplate.html', 'modules/base/baseView'],
|
||||
function ($, _, Backbone, foundViewTemplate, foundItemTemplate, BaseView) {
|
||||
|
||||
var FoundView = BaseView.extend({
|
||||
var FoundView = BaseView.extend({
|
||||
collection: null,
|
||||
//initialize template
|
||||
template: _.template(foundViewTemplate),
|
||||
itemTemplate: _.template(foundItemTemplate),
|
||||
initialize: function (options) {
|
||||
this.id = "FoundView";
|
||||
var self = this;
|
||||
FoundView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
|
||||
collection: null,
|
||||
//initialize template
|
||||
template:_.template(foundViewTemplate),
|
||||
itemTemplate:_.template(foundItemTemplate),
|
||||
this.collection.fetch({
|
||||
success: function () {
|
||||
self.renderItem();
|
||||
}});
|
||||
},
|
||||
isStayInPage: function () {
|
||||
return false;
|
||||
},
|
||||
events: {
|
||||
"click #pagSucc": "nextPageSearch",
|
||||
"click #pagPrec": "prevPageSearch"
|
||||
},
|
||||
goTop: function (element) {
|
||||
$('html, body').animate({
|
||||
scrollTop: '0px'
|
||||
}, 'fast');
|
||||
return element; // for chaining...
|
||||
},
|
||||
renderItem: function () {
|
||||
var $ul = $('#foundRicette');
|
||||
$ul.html('');
|
||||
var items = this.itemTemplate({data: this.collection.toJSON()});
|
||||
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
FoundView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
this.collection.fetch({
|
||||
success: function(){ self.renderItem(); } });
|
||||
},
|
||||
$ul.html(items);
|
||||
$ul.listview("refresh");
|
||||
$ul.trigger("updatelayout");
|
||||
|
||||
renderItem: function(){
|
||||
var $ul = $('#foundRicette');
|
||||
if (this.collection.indexItems === 0)
|
||||
$('#pagPrec').hide();
|
||||
else
|
||||
$('#pagPrec').show();
|
||||
|
||||
var items = this.itemTemplate({data:this.collection.toJSON()});
|
||||
if (this.collection.getTotalRecords() < (this.collection.indexItems + 1) * this.collection.numItems)
|
||||
$('#pagSucc').hide();
|
||||
else
|
||||
$('#pagSucc').show();
|
||||
|
||||
$ul.html( items );
|
||||
$ul.listview( "refresh" );
|
||||
$ul.trigger( "updatelayout");
|
||||
|
||||
$.mobile.loading( 'hide' );
|
||||
//$( '[data-alpha="true"]' ).alphascroll();
|
||||
},
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
//this.header.title = "pippo";
|
||||
FoundView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
//return to enable chained calls
|
||||
this.$el.find("#searchBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return FoundView;
|
||||
});
|
||||
$.mobile.loading('hide');
|
||||
//$( '[data-alpha="true"]' ).alphascroll();
|
||||
},
|
||||
nextPageSearch: function (e) {
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
this.collection.indexItems++;
|
||||
this.collection.fetch({reset: true,
|
||||
success: function () {
|
||||
self.renderItem();
|
||||
}});
|
||||
this.goTop();
|
||||
},
|
||||
prevPageSearch: function (e) {
|
||||
e.preventDefault();
|
||||
var self = this;
|
||||
this.collection.indexItems--;
|
||||
this.collection.fetch({reset: true,
|
||||
success: function () {
|
||||
self.renderItem();
|
||||
}});
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
//this.header.title = "pippo";
|
||||
FoundView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
//return to enable chained calls
|
||||
this.$el.find("#searchBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return FoundView;
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
<div id="categoryListContent" data-role="content">
|
||||
<h1>Ricerca Ricette...</h1>
|
||||
<ul id="foundRicette" data-role="listview" data-autodividers="true" data-inset="true">
|
||||
</ul>
|
||||
<h1>Ricerca Ricette...</h1>
|
||||
<center><a href="" id="pagPrec" button="true" class="ui-btn ui-corner-all">Pagina precedente</a></center>
|
||||
<ul id="foundRicette" data-role="listview" data-autodividers="true" data-inset="true"></ul>
|
||||
<center><a href="" id="pagSucc" button="true" class="ui-btn ui-corner-all">Pagina successiva</a></center>
|
||||
</div>
|
||||
@@ -6,6 +6,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTempla
|
||||
template:_.template(searchViewTemplate),
|
||||
|
||||
initialize: function (options) {
|
||||
this.id = "SearchView";
|
||||
var self = this;
|
||||
SearchView.__super__.initialize.call(this);
|
||||
this.collection = options.collection;
|
||||
@@ -29,17 +30,40 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTempla
|
||||
}
|
||||
Backbone.history.navigate('search/' + nResult + "/"+ categoria + "/" + diffi + "/" + titolo, { trigger: true });
|
||||
},
|
||||
|
||||
onShowed: function(){
|
||||
var stars = $('input[type=radio].star');
|
||||
if (stars.length > 0)
|
||||
{
|
||||
stars.rating({
|
||||
callback: function (value, link) {
|
||||
var tip = $('#hover-test');
|
||||
if (value === undefined)
|
||||
{
|
||||
$('#hover-test').html("Nessuna" || 'value: ');
|
||||
}
|
||||
else
|
||||
$('#hover-test').html(link.title || 'value: ' + value);
|
||||
},
|
||||
focus: function (value, link) {
|
||||
var tip = $('#hover-test');
|
||||
tip[0].data = tip[0].data || tip.html();
|
||||
tip.html(link.title || 'value: ' + value);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
//this.header.title = "pippo";
|
||||
if (this.created === true)
|
||||
{
|
||||
SearchView.__super__.render.call(this);
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({data:this.collection.toJSON()}));
|
||||
this.$el.append(this.footer.$el);
|
||||
|
||||
this.$el.find('#nResult').val(Profile.data.risRic);
|
||||
this.trigger("renderCompleted:Search", this);
|
||||
|
||||
}
|
||||
this.$el.find('#nResult').val(Profile.data.risRic);
|
||||
this.trigger("renderCompleted:Search", this);
|
||||
this.$el.find("#searchBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
||||
template:_.template(settingsViewTemplate),
|
||||
|
||||
initialize: function () {
|
||||
SettingsView.__super__.initialize.call(this);
|
||||
this.id = "SettingsView";
|
||||
SettingsView.__super__.initialize.call(this);
|
||||
},
|
||||
|
||||
events: {
|
||||
@@ -25,14 +26,16 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
||||
|
||||
//render the content into div of view
|
||||
render: function(){
|
||||
SettingsView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
|
||||
if(this.created === true)
|
||||
{
|
||||
SettingsView.__super__.render.call(this);
|
||||
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||
//$el is cached jQuery object for the view's element.
|
||||
//append the compiled template into view div container
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template());
|
||||
this.$el.append(this.footer.$el);
|
||||
}
|
||||
this.$el.find('#nResult').val(Profile.data.risRic);
|
||||
this.$el.find('#theme').val(Profile.data.tema);
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
</select>
|
||||
<label for="theme">Tema Grafico:</label>
|
||||
<select name="theme" id="theme">
|
||||
<option value="a">Blu</option>
|
||||
<option value="b" selected="true">Nero</option>
|
||||
<option value="c" selected="true">Chiaro</option>
|
||||
<option value="a" selected="true">Blu</option>
|
||||
<option value="b">Nero</option>
|
||||
<option value="c">Chiaro</option>
|
||||
<option value="d">Material Design</option>
|
||||
</select>
|
||||
<a id="saveBtn" href="" button="true" class="ui-link ui-btn ui-icon-custom ui-btn-icon-left">Save</a>
|
||||
<br><br>
|
||||
|
||||
+26
-62
@@ -5,14 +5,18 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.
|
||||
//initialize template
|
||||
template: _.template(syncViewTemplate),
|
||||
initialize: function (options) {
|
||||
this.id = "SyncView";
|
||||
SyncView.__super__.initialize.call(this);
|
||||
if (options &&
|
||||
options.tokenFound == 1)
|
||||
options.tokenFound === 1)
|
||||
{
|
||||
this.updateLoginBtn();
|
||||
}
|
||||
window.localStorage.setItem("tryLogin", null);
|
||||
},
|
||||
isStayInPage: function () {
|
||||
return false;
|
||||
},
|
||||
events: {
|
||||
"click #backBtn": "backBtn",
|
||||
"click #fblogin": "fbLogin",
|
||||
@@ -23,7 +27,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.
|
||||
e.preventDefault();
|
||||
Profile.setKeySave(null);
|
||||
window.localStorage.setItem("hello", null);
|
||||
Backbone.history.loadUrl();
|
||||
this.updateLoginBtn();
|
||||
//Backbone.history.loadUrl();
|
||||
},
|
||||
backBtn: function (e) {
|
||||
e.preventDefault();
|
||||
@@ -35,91 +40,50 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.
|
||||
|
||||
hello('facebook').login();
|
||||
},
|
||||
fbAfterLogin: function ()
|
||||
{
|
||||
/*
|
||||
var self = this;
|
||||
openFB.api({
|
||||
path: '/me',
|
||||
success: function (data) {
|
||||
Profile.internalLoadProfile(data.id, function(retVal){
|
||||
if(retVal == false)
|
||||
Profile.createProfile(
|
||||
data.id,
|
||||
"fb",
|
||||
data.name,
|
||||
data.email,
|
||||
data.gender,
|
||||
function(){
|
||||
//Backbone.history.loadUrl();
|
||||
});
|
||||
self.updateLoginBtn();
|
||||
});
|
||||
}});
|
||||
*/
|
||||
},
|
||||
gplusLogin: function (e) {
|
||||
var self = this;
|
||||
e.preventDefault();
|
||||
|
||||
hello('google').login();
|
||||
},
|
||||
gPlusAfterLogin: function ()
|
||||
{
|
||||
/*
|
||||
var self = this;
|
||||
openGPlus.api({
|
||||
path: 'people/me',
|
||||
success: function (data) {
|
||||
Profile.internalLoadProfile(data.id, function(retVal){
|
||||
if(retVal == false)
|
||||
Profile.createProfile(
|
||||
data.id,
|
||||
"gplus",
|
||||
data.displayName,
|
||||
data.emails[0].value,
|
||||
data.gender,
|
||||
function(){
|
||||
//Backbone.history.loadUrl();
|
||||
}
|
||||
);
|
||||
self.updateLoginBtn();
|
||||
});
|
||||
}});
|
||||
*/
|
||||
},
|
||||
updateLoginBtn: function ()
|
||||
{
|
||||
if (Profile.isConnected()) {
|
||||
if (Profile.isFbConnected()) {
|
||||
this.$el.find("#fblogin").show();
|
||||
this.$el.find("#gpluslogin").hide();
|
||||
this.$el.find("#fblogin").removeClass("loginfb");
|
||||
this.$el.find("#fblogin").addClass("logoutfb");
|
||||
this.changeBtn("#fblogout", "inline-block!important");
|
||||
this.changeBtn("#gpluslogout", "none");
|
||||
this.changeBtn("#fblogin", "none");
|
||||
this.changeBtn("#gpluslogin", "none");
|
||||
}
|
||||
|
||||
if (Profile.isGPlusConnected()) {
|
||||
this.$el.find("#gpluslogin").show();
|
||||
this.$el.find("#fblogin").hide();
|
||||
this.$el.find("#gpluslogin").removeClass("logingplus");
|
||||
this.$el.find("#gpluslogin").addClass("logoutgplus");
|
||||
this.changeBtn("#fblogout", "none");
|
||||
this.changeBtn("#gpluslogout", "inline-block!important");
|
||||
this.changeBtn("#fblogin", "none");
|
||||
this.changeBtn("#gpluslogin", "none");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.$el.find("#fblogin").removeClass("logoutfb");
|
||||
this.$el.find("#fblogin").addClass("loginfb");
|
||||
this.$el.find("#gpluslogin").removeClass("logoutgplus");
|
||||
this.$el.find("#gpluslogin").addClass("logingplus");
|
||||
this.changeBtn("#fblogout", "none");
|
||||
this.changeBtn("#gpluslogout", "none");
|
||||
this.changeBtn("#fblogin", "inline-block!important");
|
||||
this.changeBtn("#gpluslogin", "inline-block!important");
|
||||
}
|
||||
},
|
||||
changeBtn: function (selector, displayStyle)
|
||||
{
|
||||
var ele = this.$el.find(selector)[0];
|
||||
ele.style.display = "";
|
||||
ele.style.cssText = ele.style.cssText + " display: " + displayStyle + ";";
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
var self = this;
|
||||
//this.header.title = "pippo";
|
||||
SyncView.__super__.render.call(this);
|
||||
|
||||
this.header.$el.append("<a id=\"backBtn\" href=\"\" data-role=\"button\" class=\"ui-btn-right\" data-icon=\"custom\">Indietro</a>");
|
||||
this.header.$el.append("<a id=\"backBtn\" href=\"\" data-role=\"button\" class=\"nav-glyphish-example ui-btn-right ui-btn ui-icon-myHome ui-btn-icon-notext\" data-icon=\"custom\"></a>");
|
||||
|
||||
this.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({app: myManifest}));
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
<div style="text-align: center;">
|
||||
Qui puoi collegarti con l'account che preferisci<br>per avere la sincronizzazione dei tuoi dati su qualsiasi dispositivo che userai<br>
|
||||
Scegli il tipo di account e premi il tasto qui sotto per effettuare il login<br><br>
|
||||
<a id="fblogin" href="" class="loginfb"></a><br>
|
||||
<a id="gpluslogin" href="" class="logingplus"></a>
|
||||
<a id="fblogin" href="" class="zocial facebook" data-role="none" style="font-size: 14px; color: #fff;">Connettiti con Facebook</a>
|
||||
<a id="fblogout" href="" class="zocial facebook" data-role="none" style="font-size: 14px; color: #fff;">Disconnettiti da Facebook</a><br><br>
|
||||
<a id="gpluslogin" href="" class="zocial googleplus" data-role="none" style="font-size: 14px; color: #fff;">Connettiti con Google+</a>
|
||||
<a id="gpluslogout" href="" class="zocial googleplus" data-role="none" style="font-size: 14px; color: #fff;">Disconnettiti da Google+</a>
|
||||
<div data-role="popup" id="popupLogin" data-overlay-theme="a" data-theme="a" data-corners="false" data-tolerance="15,15">
|
||||
<a href="#" data-rel="back" class="ui-btn ui-btn-b ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
|
||||
<iframe id="urlLogin" src="" width="497" height="298" seamless=""></iframe>
|
||||
</div>
|
||||
<a id="resetBtn" href="" class="ui-btn ui-corner-all ui-shadow">Reset Account</a>
|
||||
<a id="resetBtn" href="" class="ui-btn ui-corner-all ui-shadow">Reset Account</a>
|
||||
</div>
|
||||
</div>
|
||||
+69
-54
@@ -2,19 +2,45 @@ define(['jquery', 'underscore', 'backbone',
|
||||
'modules/home/home', 'modules/faq/faq', 'modules/index/index', 'modules/category/category', 'modules/item/item',
|
||||
'modules/about/about', 'modules/search/search', 'modules/search/found', 'modules/more/more', 'modules/note/note',
|
||||
'modules/sync/sync', 'modules/converter/converter', 'modules/donation/donation', 'modules/settings/settings',
|
||||
'modules/debug/debug',
|
||||
'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection',
|
||||
'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection',
|
||||
'libs/fastclick', 'classes/cache', 'jqm', 'jQueryPlugins'],
|
||||
'classes/cache', 'libs/fastclick',
|
||||
'jqm', 'jQueryPlugins'],
|
||||
function ($, _, Backbone,
|
||||
HomeView, FaqView, IndexView, CategoryView, ItemView,
|
||||
AboutView, SearchView, FoundView, MoreView, NoteView,
|
||||
SyncView, ConverterView, DonationView, SettingsView,
|
||||
DebugView,
|
||||
NoteCollection, CategoryCollection, CategoryItemCollection,
|
||||
ItemCollection, IngredientiCollection, FoundItemCollection,
|
||||
FastClick, Cache) {
|
||||
Cache, FastClick) {
|
||||
|
||||
'use strict';
|
||||
var Router = Backbone.Router.extend({
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
$(document).on("pagecontainershow", function (event, ui) {
|
||||
try
|
||||
{
|
||||
ga('send', 'pageview',
|
||||
{
|
||||
'page': "/" + this.location.hash,
|
||||
'title': document.title
|
||||
});
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
}
|
||||
|
||||
if (self.activeView.onShowed !== null)
|
||||
self.activeView.onShowed();
|
||||
|
||||
// if (self.fastClickInstance !== null)
|
||||
// self.fastClickInstance.destroy();
|
||||
// self.fastClickInstance = FastClick.attach(document.body);
|
||||
});
|
||||
},
|
||||
//define routes and mapping route to the function
|
||||
routes: {
|
||||
'': 'showHome', //home view
|
||||
@@ -27,13 +53,14 @@ define(['jquery', 'underscore', 'backbone',
|
||||
'syncView(/)*founded': 'showSync',
|
||||
'noteView': 'showNote',
|
||||
'searchView': 'showSearch',
|
||||
'debugView': 'showDebug',
|
||||
'settingsView': 'showSettings',
|
||||
'donationView': 'showDonation',
|
||||
'search/:nresult/:categoria/:difficolta/*titolo': 'searchFn',
|
||||
'converterView': 'showConverter',
|
||||
'moreView': 'showMore',
|
||||
'*actions': 'defaultAction' //default action
|
||||
},
|
||||
},
|
||||
defaultAction: function (actions) {
|
||||
this.showHome(actions);
|
||||
},
|
||||
@@ -85,27 +112,29 @@ define(['jquery', 'underscore', 'backbone',
|
||||
},
|
||||
showIndex: function (actions) {
|
||||
Cache.checkCacheFromServer();
|
||||
|
||||
var categories = new CategoryCollection();
|
||||
//var categories = new CategoryCollection();
|
||||
// will render home view and navigate to homeView
|
||||
var indexView = new IndexView({collection: categories});
|
||||
//indexView.render();
|
||||
indexView.bind('renderCompleted:Categories', this.changePage, this);
|
||||
var indexView = new IndexView();//{collection: categories});
|
||||
indexView.render();
|
||||
this.changePage(indexView);
|
||||
//indexView.bind('renderCompleted:Categories', this.changePage, this);
|
||||
},
|
||||
showCategory: function (categoryName, categoryId) {
|
||||
var categories = new CategoryItemCollection({categoryId: categoryId});
|
||||
// will render home view and navigate to homeView
|
||||
var categoryView = new CategoryView({categoryName: categoryName, collection: categories});
|
||||
var categoryView = new CategoryView({categoryName: categoryName, categoryId: categoryId, collection: categories});
|
||||
|
||||
categoryView.render();
|
||||
this.changePage(categoryView);
|
||||
|
||||
$.mobile.loading('show', {
|
||||
text: 'Caricamento categoria ' + categoryName + '...',
|
||||
textVisible: true,
|
||||
//theme: 'z',
|
||||
html: ""
|
||||
});
|
||||
|
||||
if(!categories.isCached() || categoryView.created){
|
||||
$.mobile.loading('show', {
|
||||
text: 'Caricamento categoria ' + categoryName + '...',
|
||||
textVisible: true,
|
||||
//theme: 'z',
|
||||
html: ""
|
||||
});
|
||||
}
|
||||
//categoryView.bind('renderCompleted:Category',this.changePage,this);
|
||||
},
|
||||
showItem: function (itemId) {
|
||||
@@ -129,6 +158,11 @@ define(['jquery', 'underscore', 'backbone',
|
||||
moreView.render();
|
||||
this.changePage(moreView);
|
||||
},
|
||||
showDebug: function () {
|
||||
var debugView = new DebugView();
|
||||
debugView.render();
|
||||
this.changePage(debugView);
|
||||
},
|
||||
showSearch: function () {
|
||||
var categories = new CategoryCollection();
|
||||
// will render home view and navigate to homeView
|
||||
@@ -137,9 +171,7 @@ define(['jquery', 'underscore', 'backbone',
|
||||
searchView.bind('renderCompleted:Search', this.changePage, this);
|
||||
},
|
||||
searchFn: function (nresult, categoria, difficolta, titolo) {
|
||||
|
||||
//console.log("Search by Titolo: " + titolo + ", Categoria: " + categoria + ", Difficoltà: " + difficolta);
|
||||
var foundedItems = new FoundItemCollection({categoryId: categoria, difficolta: difficolta, titolo: titolo, nResult: nresult});
|
||||
var foundedItems = new FoundItemCollection({categoryId: categoria, difficolta: difficolta, titolo: titolo, nResult: nresult, indexItems: 0});
|
||||
var foundView = new FoundView({collection: foundedItems});
|
||||
|
||||
foundView.render();
|
||||
@@ -152,52 +184,35 @@ define(['jquery', 'underscore', 'backbone',
|
||||
html: ""
|
||||
});
|
||||
},
|
||||
init: true,
|
||||
fastClickInstance: null,
|
||||
activeView: null,
|
||||
//1. changePage will insert view into DOM and then call changePage to enhance and transition
|
||||
//2. for the first page, jQuery mobile will present and enhance automatically
|
||||
//3. for the other page, we will call $.mobile.changePage() to enhance page and make transition
|
||||
//4. argument 'view' is passed from event trigger
|
||||
changePage: function (view) {
|
||||
|
||||
var self = this;
|
||||
//append to dom
|
||||
$('body').append(view.$el);
|
||||
if (view.created === true)
|
||||
{
|
||||
$('body').append(view.$el);
|
||||
}
|
||||
|
||||
if (this.activeView !== null &&
|
||||
this.activeView.onClosing !== null)
|
||||
this.activeView.onClosing();
|
||||
|
||||
$.mobile.pageContainer.pagecontainer("change", $(view.el), {changeHash: false});
|
||||
|
||||
FastClick.attach(document.body);
|
||||
var lastView = this.activeView;
|
||||
this.activeView = view;
|
||||
|
||||
$(":jqmData(role='page'):last").on("pageshow", function (event) {
|
||||
if (view.onShowed !== null)
|
||||
view.onShowed();
|
||||
});
|
||||
if (lastView !== null &&
|
||||
lastView.onClosed !== null)
|
||||
lastView.onClosed();
|
||||
|
||||
$('input[type=radio].star').rating({
|
||||
callback: function (value, link) {
|
||||
var tip = $('#hover-test');
|
||||
if (value === undefined)
|
||||
{
|
||||
$('#hover-test').html("Nessuna" || 'value: ');
|
||||
}
|
||||
else
|
||||
$('#hover-test').html(link.title || 'value: ' + value);
|
||||
},
|
||||
focus: function (value, link) {
|
||||
var tip = $('#hover-test');
|
||||
tip[0].data = tip[0].data || tip.html();
|
||||
tip.html(link.title || 'value: ' + value);
|
||||
}
|
||||
// ,
|
||||
// blur: function(value, link){
|
||||
// var tip = $('#hover-test');
|
||||
// $('#hover-test').html(tip[0].data || '');
|
||||
// }
|
||||
});
|
||||
|
||||
if (!this.init) {
|
||||
|
||||
} else {
|
||||
this.init = false;
|
||||
}
|
||||
if (this.activeView.onShowing !== null)
|
||||
this.activeView.onShowing();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user