diff --git a/js/app.js b/js/app.js index 950d9c9..92a8212 100644 --- a/js/app.js +++ b/js/app.js @@ -1,5 +1,5 @@ -define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache', 'libs/fastclick'], function - ($, _, Backbone, Router, Profile, Cache, FastClick) { +define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache', 'libs/fastclick', 'classes/debug'], function + ($, _, Backbone, Router, Profile, Cache, FastClick, Debug) { 'use strict'; var init = function () { //create backbone router @@ -34,7 +34,7 @@ define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classe var id = ""; var displayName = ""; var email = ""; - var gender = ""; + var gender = "unknown"; if (auth.network === "google") { @@ -50,9 +50,16 @@ define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classe email = json.email; gender = json.gender; } + + if(gender !== "") + gender = "unknown"; + + Debug.writeMessage('Your name is ' + json.name + ' in the social ' + auth.network + ", ID=" + id + ", DisplayName: "+ displayName + ", email:"+ email); + Profile._loadProfile(id, function (retVal) { if (retVal === false) { + Debug.writeMessage("Profilo non trovato, ne creo uno nuovo"); Profile.createProfile( id, auth.network, @@ -60,6 +67,7 @@ define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classe email, gender, function () { + Debug.writeMessage("Profilo nuovo creato"); window.location.href = ""; } ); @@ -67,6 +75,9 @@ define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classe else window.location.href = ""; }); + }, + function(e){ + Debug.writeMessage('Whoops! ' + e.error.message); }); } }); diff --git a/js/classes/profile.js b/js/classes/profile.js index 7dec514..54dd5ca 100644 --- a/js/classes/profile.js +++ b/js/classes/profile.js @@ -29,6 +29,7 @@ define(['jquery', 'backbone'], "provincia": null, "comune": null, "cap": null, + "note": null, "tipopm": null, "privacy": 0, "long": null, @@ -68,7 +69,7 @@ define(['jquery', 'backbone'], if (response.length > 0) { self.dataloaded = true; - self.data.name = response[0].Name; + self.data.name = unescape(response[0].Name); self.data.email = response[0].Email; self.data.gender = response[0].Gender; self.data.tema = response[0].TemaUI; @@ -79,11 +80,12 @@ define(['jquery', 'backbone'], self.setGender(self.data.gender); self.data.isSpacc = response[0].bSpacciatore; self.data.dataSpacc.stato = response[0].Stato; - self.data.dataSpacc.provincia = response[0].Provincia; - self.data.dataSpacc.comune = response[0].Comune; + self.data.dataSpacc.provincia = unescape(response[0].Provincia); + self.data.dataSpacc.comune = unescape(response[0].Comune); self.data.dataSpacc.cap = response[0].Cap; self.data.dataSpacc.privacy = response[0].bPrivacy; self.data.dataSpacc.tipopm = response[0].TipoPM; + self.data.dataSpacc.note = unescape(response[0].Note); self.data.dataSpacc.lat = response[0].Latitudine; self.data.dataSpacc.long = response[0].Longitudine; retBool = true; @@ -126,6 +128,7 @@ define(['jquery', 'backbone'], this.data.dataSpacc.comune = null; this.data.dataSpacc.cap = null; this.data.dataSpacc.tipopm = null; + this.data.dataSpacc.note = null; this.data.dataSpacc.privacy = 0; this.data.dataSpacc.long = null; this.data.dataSpacc.lat = null; @@ -219,7 +222,7 @@ define(['jquery', 'backbone'], var sendobj = { "keyStore": this.getKeySave(), - "name": this.data.name, + "name": escape(this.data.name), "email": this.data.email, "gender": this.data.gender, "tema": this.data.tema, @@ -248,10 +251,11 @@ define(['jquery', 'backbone'], "email": this.data.email, "isSpacc": this.data.isSpacc, "stato": this.data.dataSpacc.stato, - "prov": this.data.dataSpacc.provincia, - "comune": this.data.dataSpacc.comune, + "prov": escape(this.data.dataSpacc.provincia), + "comune": escape(this.data.dataSpacc.comune), "cap": this.data.dataSpacc.cap, "tipopm": this.data.dataSpacc.tipopm, + "note": escape(this.data.dataSpacc.note), "privacy": this.data.dataSpacc.privacy, "lng": this.data.dataSpacc.long, "lat": this.data.dataSpacc.lat diff --git a/js/manifest.js b/js/manifest.js index 00ebfd2..09eefe8 100644 --- a/js/manifest.js +++ b/js/manifest.js @@ -1,7 +1,7 @@ var myManifest = { Debug: (window.location.port !== ""), Name: "Il Lievitario", - Version: "2.9.5.3", + Version: "3.0.1.3", Author: "Denis Ironi", Settings: { DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"), diff --git a/js/model/authors/authorCollection.js b/js/model/authors/authorCollection.js new file mode 100644 index 0000000..cedf22f --- /dev/null +++ b/js/model/authors/authorCollection.js @@ -0,0 +1,15 @@ +define(['app', 'jquery', 'underscore', 'backbone', 'model/authors/authorModel'], + function (app, $, _, Backbone, Author) { + + var Authors = Backbone.Collection.extend({ + // Book is the model of the collection + model: Author, + url: function () { + return myManifest.Settings.DefaultURL + "/api/ricette/authors"; + } + }); + + return Authors; + }); + + diff --git a/js/model/authors/authorModel.js b/js/model/authors/authorModel.js new file mode 100644 index 0000000..ec82911 --- /dev/null +++ b/js/model/authors/authorModel.js @@ -0,0 +1,13 @@ +define(['jquery', 'underscore', 'backbone'], +function ($, _, Backbone){ + + var Author=Backbone.Model.extend({ + //default attributes + defaults:{ + name:'' + } + }); + + return Author; +}); + diff --git a/js/modules/about/aboutViewTemplate.html b/js/modules/about/aboutViewTemplate.html index 4d05fa7..9f96ee6 100644 --- a/js/modules/about/aboutViewTemplate.html +++ b/js/modules/about/aboutViewTemplate.html @@ -2,7 +2,7 @@

<%= app.Name %>©

-

Copyright 2015
Lievitario è un marchio registrato

+

Copyright 2015-2016
Lievitario è un marchio registrato


Applicazione Ricettario del

'Gruppo La Pasta Madre'

Versione: <%= app.Version %>

Sviluppatore: <%= app.Author %>

diff --git a/js/modules/category/categoryItemTemplate.html b/js/modules/category/categoryItemTemplate.html index fb35354..d975e71 100644 --- a/js/modules/category/categoryItemTemplate.html +++ b/js/modules/category/categoryItemTemplate.html @@ -4,9 +4,9 @@ <% var item = data[i]; %>
  • <% if(item.firstImage === ""){ %> - + <%}else{%> - + <%}%>
    <%= unescape(item.titolo) %>
    <%= unescape(item.autore) %>
    diff --git a/js/modules/home/home.js b/js/modules/home/home.js index 48be2e1..ad4e59a 100644 --- a/js/modules/home/home.js +++ b/js/modules/home/home.js @@ -138,7 +138,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate. this.changePicture(Profile.data.picture); } - Debug.writeMessage(myManifest.Agent.ua); + //Debug.writeMessage(myManifest.Agent.ua); }, onClosing: function () { if (this.freeWall !== null) diff --git a/js/modules/item/item.js b/js/modules/item/item.js index 1850734..9f41f87 100644 --- a/js/modules/item/item.js +++ b/js/modules/item/item.js @@ -57,7 +57,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate. onShowed: function(){ var self = this; $('body').scrollTop(0); - + /* this.galleryWall = new Freewall("#Gallery"); this.galleryWall.reset({ selector: '.brick', @@ -73,6 +73,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate. images.find('img').load(function() { self.galleryWall.fitWidth(); }); +*/ $.mobile.loading('hide'); }, @@ -95,7 +96,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate. self.scrollPositions = []; self.$arrayContent = self.$el.find('div[data-role="content"]'); self.$arrayNavBar = self.$el.find('div[data-role="navbar"] a'); - + /* self.$photos = self.$el.find('#contentFoto a'); self.$photos.on("click", function(e){ e.preventDefault(); @@ -115,7 +116,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate. }); }); - + */ for (var i = self.$arrayContent.length - 1; i >= 0; i--) { self.scrollPositions.push(0); }; diff --git a/js/modules/item/itemViewTemplate.html b/js/modules/item/itemViewTemplate.html index f204f4c..23ff2d0 100644 --- a/js/modules/item/itemViewTemplate.html +++ b/js/modules/item/itemViewTemplate.html @@ -7,7 +7,7 @@ var widthImg = 320; if( myManifest.Agent.device.type != "" ) { - //prendo la larghezza del viewport e sottraggo il 10%, poi divito per le due colonne + /*prendo la larghezza del viewport e sottraggo il 10perc, poi divito per le due colonne*/ widthImg = (myManifest.Settings.Device.Width - (myManifest.Settings.Device.Width / 10)) / 2; if(widthImg>320) widthImg = 320; @@ -34,14 +34,14 @@

    <%= ricetta.procedimento%>

    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.

    - <% if(ricetta.autore.length > 0){ %> diff --git a/js/modules/maps/infoWindowTemplate.html b/js/modules/maps/infoWindowTemplate.html index 79eacce..f590459 100644 --- a/js/modules/maps/infoWindowTemplate.html +++ b/js/modules/maps/infoWindowTemplate.html @@ -1,11 +1,12 @@
    \ No newline at end of file diff --git a/js/modules/maps/maps.js b/js/modules/maps/maps.js index 89460a5..fa40ff6 100644 --- a/js/modules/maps/maps.js +++ b/js/modules/maps/maps.js @@ -13,6 +13,10 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. url: "http://app.gruppolapastamadre.it/icon.png", scaledSize: new google.maps.Size(24, 24) }, + iconPMGF: { + url: "http://app.gruppolapastamadre.it/iconGreen.png", + scaledSize: new google.maps.Size(24, 24) + }, initialize: function () { this.id = "MapsView"; this.markers = []; @@ -167,7 +171,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. var self = this; var marker = new google.maps.Marker({ position: new google.maps.LatLng(ele.Latitudine, ele.Longitudine), - icon: self.iconPM, + icon: ele.TipoPM == "4"?self.iconPMGF:self.iconPM, //label: ele.Name, title: ele.Name, map: self.map diff --git a/js/modules/more/moreViewTemplate.html b/js/modules/more/moreViewTemplate.html index d58fb04..9ff1a70 100644 --- a/js/modules/more/moreViewTemplate.html +++ b/js/modules/more/moreViewTemplate.html @@ -3,7 +3,7 @@
  • Altre opzioni
  • Convertitore
  • -
  • Impostazioni
  • +
  • Informazioni su...
  • Donazione
  • Messaggi di debug
  • diff --git a/js/modules/search/search.js b/js/modules/search/search.js index e0fdb58..bb53d1d 100644 --- a/js/modules/search/search.js +++ b/js/modules/search/search.js @@ -56,12 +56,12 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTempla //render the content into div of view render: function () { 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); - } + { + 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("#searchBtn").addClass("ui-btn-active"); diff --git a/js/modules/search/searchViewTemplate.html b/js/modules/search/searchViewTemplate.html index 22ac31d..ffa1e31 100644 --- a/js/modules/search/searchViewTemplate.html +++ b/js/modules/search/searchViewTemplate.html @@ -5,10 +5,16 @@
    @@ -21,11 +27,18 @@ +

    Cerca
    \ No newline at end of file diff --git a/js/modules/settings/settings.js b/js/modules/settings/settings.js index 727878e..201a6e5 100644 --- a/js/modules/settings/settings.js +++ b/js/modules/settings/settings.js @@ -59,6 +59,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe Profile.data.dataSpacc.comune = this.$el.find('#comune').val(); Profile.data.dataSpacc.cap = this.$el.find('#CAP').val(); Profile.data.dataSpacc.tipopm = this.$el.find('#tPM').val(); + Profile.data.dataSpacc.note = this.$el.find('#note').val(); Profile.data.dataSpacc.privacy = this.$el.find('#privacyChk').prop('checked')?"1":"0"; if(Profile.data.email === "" || @@ -87,21 +88,28 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe $.ajax({ url: "http://maps.google.com/maps/api/geocode/json?address=" + Profile.data.dataSpacc.comune + "+" + - Profile.data.dataSpacc.comune + "+" + + Profile.data.dataSpacc.cap + "+" + Profile.data.dataSpacc.provincia + "+" + Profile.data.dataSpacc.stato + "&sensor=false",                 Type: "GET"             }).then(function ( response ) { if(response.results.length == 1) { Profile.data.dataSpacc.lat = response.results[0].geometry.location.lat; - Profile.data.dataSpacc.long = response.results[0].geometry.location.lng; - Profile.updateProfile(function(){ - self._flagSave = false; - self.$el.find('#titlePopup').html("Salvataggio"); - self.$el.find('#messaggio').html("Impostazioni salvate con successo"); - self.$el.find('#popupDialog').popup("open"); - }); + Profile.data.dataSpacc.long = response.results[0].geometry.location.lng; } + + if(Profile.data.dataSpacc.lat === "" && + Profile.data.dataSpacc.long === ""){ + self._flagSave = false; + return; + } + + Profile.updateProfile(function(){ + self._flagSave = false; + self.$el.find('#titlePopup').html("Salvataggio"); + self.$el.find('#messaggio').html("Impostazioni salvate con successo"); + self.$el.find('#popupDialog').popup("open"); + }); }); } else @@ -162,7 +170,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe             })             .then( function ( response ) {                 $.each( response, function ( i, val ) { -                     html += "
  • " + val.Comune + "
  • "; +                     html += "
  • " + unescape(val.Comune) + "
  • ";                 });                 $ul.html( html );                 $ul.listview( "refresh" ); @@ -221,6 +229,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe this.$el.find('#comune').val(Profile.data.dataSpacc.comune); this.$el.find('#CAP').val(Profile.data.dataSpacc.cap); + this.$el.find('#note').val(Profile.data.dataSpacc.note); this.$el.find('#tPM').val(Profile.data.dataSpacc.tipopm); this.$el.find('#privacyChk').prop('checked', Profile.data.dataSpacc.privacy==="0"?false:true); diff --git a/js/modules/settings/settingsViewTemplate.html b/js/modules/settings/settingsViewTemplate.html index c7a9043..a7cc5db 100644 --- a/js/modules/settings/settingsViewTemplate.html +++ b/js/modules/settings/settingsViewTemplate.html @@ -32,8 +32,11 @@ @@ -185,7 +190,10 @@ + + + diff --git a/js/router.js b/js/router.js index a50a4f1..5dff439 100644 --- a/js/router.js +++ b/js/router.js @@ -4,7 +4,7 @@ define(['jquery', 'underscore', 'backbone', 'modules/sync/sync', 'modules/donation/donation','modules/settings/settings', 'modules/debug/debug','modules/maps/maps', 'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection', - 'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection', + 'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection','model/authors/authorCollection', 'classes/cache', 'libs/fastclick', 'jqm', 'jQueryPlugins'], function ($, _, Backbone, @@ -13,7 +13,7 @@ define(['jquery', 'underscore', 'backbone', SyncView, DonationView, SettingsView, DebugView, MapsView, NoteCollection, CategoryCollection, CategoryItemCollection, - ItemCollection, IngredientiCollection, FoundItemCollection, + ItemCollection, IngredientiCollection, FoundItemCollection, AuthorCollection, Cache, FastClick) { 'use strict'; @@ -172,9 +172,9 @@ define(['jquery', 'underscore', 'backbone', this.changePage(mapsView); }, showSearch: function () { - var categories = new CategoryCollection(); + var authors = new AuthorCollection(); // will render home view and navigate to homeView - var searchView = new SearchView({collection: categories}); + var searchView = new SearchView({collection: authors}); //indexView.render(); searchView.bind('renderCompleted:Search', this.changePage, this); },