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

This commit is contained in:
2015-05-07 13:16:11 +00:00
parent d0d55ee8e5
commit 282ad76c48
79 changed files with 2416 additions and 1824 deletions
+30 -29
View File
@@ -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;
});
+4 -2
View File
@@ -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;'>&copy;</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>
+31 -8
View File
@@ -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;
});
+46 -38
View File
@@ -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;
}
+22 -13
View File
@@ -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.:&nbsp;&nbsp;</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>
+30 -30
View File
@@ -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
View File
@@ -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 -1
View File
@@ -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
View File
@@ -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;
});
+48 -15
View File
@@ -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
View File
@@ -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>
+12 -6
View File
@@ -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
View File
@@ -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;
});
+4 -2
View File
@@ -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
View File
@@ -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;
});
+5 -5
View File
@@ -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
View File
@@ -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
View File
@@ -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;
});
+4 -3
View File
@@ -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>
+29 -5
View File
@@ -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;
}
+12 -9
View File
@@ -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
View File
@@ -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}));
+5 -3
View File
@@ -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>