git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_2.2.3@25 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -1,29 +1,78 @@
|
||||
define(['jquery','underscore', 'backbone', 'router', 'classes/profile'],function
|
||||
($, _, Backbone,Router, Profile) {
|
||||
'use strict';
|
||||
var init=function(){
|
||||
define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache'], function
|
||||
($, _, Backbone, Router, Profile, Cache) {
|
||||
'use strict';
|
||||
var init = function () {
|
||||
//create backbone router
|
||||
var router=new Router();
|
||||
var router = new Router();
|
||||
Backbone.history.start();
|
||||
Backbone.emulateJSON = true;
|
||||
var origin = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + (location.pathname?location.pathname:'');
|
||||
openFB.init('1466942266882168', origin, window.localStorage);
|
||||
openGPlus.init('319140243944-qk0lfhgmi8shi4go97r83l69f1k0gdf4.apps.googleusercontent.com', origin, window.localStorage);
|
||||
//console.log("Backbone history start");
|
||||
// Trigger 'route' event on router instance.
|
||||
router.on('route', function(name, args) {
|
||||
//alert(name);
|
||||
});
|
||||
|
||||
if( Profile.isConnected()) {
|
||||
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();
|
||||
}
|
||||
|
||||
hello.on('auth.login', function (auth) {
|
||||
if (!Profile.isConnected())
|
||||
{
|
||||
hello(auth.network).api("me").then(function (json) {
|
||||
var id = "";
|
||||
var displayName = "";
|
||||
var email = "";
|
||||
var gender = "";
|
||||
|
||||
if (auth.network === "google")
|
||||
{
|
||||
id = json.id;
|
||||
displayName = json.displayName;
|
||||
email = json.email;
|
||||
gender = json.gender;
|
||||
}
|
||||
else if (auth.network === "facebook")
|
||||
{
|
||||
id = json.id;
|
||||
displayName = json.name;
|
||||
email = json.email;
|
||||
gender = json.gender;
|
||||
}
|
||||
Profile.internalLoadProfile(id, function(retVal){
|
||||
if(retVal === false)
|
||||
{
|
||||
Profile.createProfile(
|
||||
id,
|
||||
auth.network,
|
||||
displayName,
|
||||
email,
|
||||
gender,
|
||||
function () {
|
||||
window.location.href = "#syncView/tokenFound";
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
window.location.href = "#syncView/tokenFound";
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('body').css('background-color', '');
|
||||
$('#loadingFrm').remove();
|
||||
};
|
||||
|
||||
return {
|
||||
initialize:init
|
||||
};
|
||||
|
||||
return {
|
||||
initialize: init
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
define(['jquery', 'backbone'],
|
||||
function ($, Backbone) {
|
||||
|
||||
var Cache = {
|
||||
convertToDate: function (mysql_string)
|
||||
{
|
||||
if (typeof mysql_string === 'string')
|
||||
{
|
||||
var t = mysql_string.split(/[- :]/);
|
||||
|
||||
//when t[3], t[4] and t[5] are missing they defaults to zero
|
||||
return new Date(t[0], t[1] - 1, t[2], t[3] || 0, t[4] || 0, t[5] || 0);
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
prefix: "cacheItem",
|
||||
get: function (name) {
|
||||
var item = window.localStorage.getItem(this.prefix + name);
|
||||
if(item === null)
|
||||
return null;
|
||||
item = JSON.parse(item);
|
||||
return item.storeValue;
|
||||
},
|
||||
set: function (name, value) {
|
||||
window.localStorage.setItem(this.prefix + name, JSON.stringify({setTime: new Date(), storeValue: value}));
|
||||
},
|
||||
isExpired: function (name, timeDiff) {
|
||||
var item = window.localStorage.getItem(this.prefix + name);
|
||||
if(item === null)
|
||||
return true;
|
||||
|
||||
item = JSON.parse(item);
|
||||
var time = item.setTime;
|
||||
if(timeDiff.getTime() > Date.parse(time))
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
checkCacheFromServer: function ()
|
||||
{
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/profile/statusCache",
|
||||
//dataType: "json",
|
||||
type: 'GET',
|
||||
success: function (msg) {
|
||||
$(msg).each(function (index, element) {
|
||||
var elemName = "Category" + element.ID_CATEGORIA;
|
||||
if (self.isExpired(elemName, self.convertToDate(element.LastDateModified)))
|
||||
{
|
||||
self.set(elemName, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return Cache;
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
define(['jquery', 'underscore', 'backbone', 'classes/cache'],
|
||||
function ($, _, Backbone, Cache) {
|
||||
|
||||
var CachedCollection = Backbone.Collection.extend({
|
||||
cacheName: null,
|
||||
fetch: function (options) {
|
||||
options = _.defaults(options || {}, {parse: true});
|
||||
var deferred = new $.Deferred(),
|
||||
self = this;
|
||||
|
||||
var cachedItem = Cache.get(this.cacheName);
|
||||
|
||||
if (cachedItem !== null)
|
||||
{
|
||||
window.setTimeout(function () {
|
||||
self[options.reset ? 'reset' : 'set'](false, options);
|
||||
deferred.resolve(cachedItem);
|
||||
self.push(cachedItem);
|
||||
self.trigger('sync', self, false, options);
|
||||
if (_.isFunction(options.success)) {
|
||||
options.success(self, false, options);
|
||||
}
|
||||
return deferred;
|
||||
}, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delegate to the actual fetch method and store the attributes in the cache
|
||||
var jqXHR = Backbone.Collection.prototype.fetch.apply(this, arguments);
|
||||
// resolve the returned promise when the AJAX call completes
|
||||
jqXHR.done(_.bind(deferred.resolve, this, this))
|
||||
// Set the new data in the cache
|
||||
.done(_.bind(
|
||||
function (a, b, c) {
|
||||
Cache.set(self.cacheName, a);
|
||||
}
|
||||
, null, this, options))
|
||||
// Reject the promise on fail
|
||||
.fail(_.bind(deferred.reject, this, this));
|
||||
|
||||
deferred.abort = jqXHR.abort;
|
||||
// return a promise which provides the same methods as a jqXHR object
|
||||
return deferred;
|
||||
}
|
||||
}
|
||||
});
|
||||
return CachedCollection;
|
||||
});
|
||||
@@ -73,12 +73,12 @@ define(['jquery', 'backbone'],
|
||||
},
|
||||
|
||||
isGPlusConnected: function(){
|
||||
if(this.data.type == "gplus")
|
||||
if(this.data.type === "google")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
isFbConnected: function(){
|
||||
if(this.data.type == "fb")
|
||||
if(this.data.type === "facebook")
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
Vendored
+3
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
+3
-3
@@ -1,11 +1,11 @@
|
||||
var myManifest = {
|
||||
Debug: false,
|
||||
Name: "Il Lievitario",
|
||||
Version: "2.3.0",
|
||||
Version: "2.5.0",
|
||||
Author: "Denis Ironi",
|
||||
Settings: {
|
||||
DefaultURL: "http://localhost:8081/Service_Manut",
|
||||
//DefaultURL: "http://app.gruppolapastamadre.it/Service",
|
||||
//DefaultURL: "http://localhost:8081/Service_Manut",
|
||||
DefaultURL: "http://app.gruppolapastamadre.it/Service",
|
||||
JQueryVersion: "1.11.1",
|
||||
JQueryMobileVersion: "1.4.3",
|
||||
Device:{
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/category/categoryModel'],
|
||||
function (app, $, _, Backbone, Category){
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/category/categoryModel', 'classes/cachedCollection'],
|
||||
function (app, $, _, Backbone, Category, CachedCollection) {
|
||||
|
||||
var Categories=Backbone.Collection.extend({
|
||||
var Categories = CachedCollection.extend({
|
||||
cacheName: "Category0",
|
||||
// Book is the model of the collection
|
||||
model: Category,
|
||||
url: function () {
|
||||
return myManifest.Settings.DefaultURL + "/api/categories";
|
||||
}
|
||||
});
|
||||
|
||||
// Book is the model of the collection
|
||||
model:Category,
|
||||
|
||||
url: function() {
|
||||
return myManifest.Settings.DefaultURL + "/api/categories";
|
||||
}
|
||||
});
|
||||
|
||||
return Categories;
|
||||
});
|
||||
return Categories;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel'],
|
||||
function (app, $, _, Backbone, Category){
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel', 'classes/cachedCollection'],
|
||||
function (app, $, _, Backbone, Category, CachedCollection){
|
||||
|
||||
var CategoryItems=Backbone.Collection.extend({
|
||||
var CategoryItems=CachedCollection.extend({
|
||||
|
||||
categoryId: null,
|
||||
initialize: function (options) {
|
||||
this.categoryId = options.categoryId;
|
||||
this.cacheName = "Category" + this.categoryId;
|
||||
},
|
||||
// Book is the model of the collection
|
||||
model:Category,
|
||||
|
||||
@@ -1,66 +1,62 @@
|
||||
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'],
|
||||
function ($, _, Backbone, categoryViewTemplate, categoryItemTemplate, BaseView) {
|
||||
|
||||
var CategoryView = BaseView.extend({
|
||||
var CategoryView = BaseView.extend({
|
||||
collection: null,
|
||||
categoryName: null,
|
||||
//initialize template
|
||||
template: _.template(categoryViewTemplate),
|
||||
itemtemplate: _.template(categoryItemTemplate),
|
||||
initialize: function (options) {
|
||||
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();
|
||||
}
|
||||
//success: function(){ self.renderItem(); }
|
||||
});
|
||||
},
|
||||
renderItem: function () {
|
||||
var $ul = $('#allRicette');
|
||||
|
||||
collection: null,
|
||||
categoryName: null,
|
||||
//initialize template
|
||||
template:_.template(categoryViewTemplate),
|
||||
itemtemplate:_.template(categoryItemTemplate),
|
||||
|
||||
initialize: function (options) {
|
||||
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();
|
||||
}
|
||||
//success: function(){ self.renderItem(); }
|
||||
});
|
||||
},
|
||||
|
||||
renderItem: function(){
|
||||
var $ul = $('#allRicette');
|
||||
|
||||
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: ');
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
$.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
|
||||
this.$el.find("#indexBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
else
|
||||
$('#hover-test').html(link.title || 'value: ' + value);
|
||||
}
|
||||
});
|
||||
|
||||
$.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
|
||||
this.$el.find("#indexBtn").addClass("ui-btn-active");
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return CategoryView;
|
||||
});
|
||||
});
|
||||
return CategoryView;
|
||||
});
|
||||
+129
-158
@@ -1,164 +1,135 @@
|
||||
define(['jquery', 'underscore', 'backbone','text!modules/sync/syncViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function($, _, Backbone, syncViewTemplate, BaseView, Profile){
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||
function ($, _, Backbone, syncViewTemplate, BaseView, Profile) {
|
||||
|
||||
var SyncView = BaseView.extend({
|
||||
|
||||
//initialize template
|
||||
template:_.template(syncViewTemplate),
|
||||
|
||||
initialize: function (options) {
|
||||
SyncView.__super__.initialize.call(this);
|
||||
if(options &&
|
||||
options.tokenFound == 1)
|
||||
{
|
||||
if(window.localStorage.getItem("tryLogin")=="fb")
|
||||
var SyncView = BaseView.extend({
|
||||
//initialize template
|
||||
template: _.template(syncViewTemplate),
|
||||
initialize: function (options) {
|
||||
SyncView.__super__.initialize.call(this);
|
||||
if (options &&
|
||||
options.tokenFound == 1)
|
||||
{
|
||||
this.fbAfterLogin();
|
||||
this.updateLoginBtn();
|
||||
}
|
||||
else if(window.localStorage.getItem("tryLogin")=="gplus")
|
||||
{
|
||||
this.gPlusAfterLogin();
|
||||
}
|
||||
}
|
||||
window.localStorage.setItem("tryLogin", null);
|
||||
},
|
||||
window.localStorage.setItem("tryLogin", null);
|
||||
},
|
||||
events: {
|
||||
"click #backBtn": "backBtn",
|
||||
"click #fblogin": "fbLogin",
|
||||
"click #gpluslogin": "gplusLogin",
|
||||
"click #resetBtn": "resetBtn"
|
||||
},
|
||||
resetBtn: function (e) {
|
||||
e.preventDefault();
|
||||
Profile.setKeySave(null);
|
||||
window.localStorage.setItem("hello", null);
|
||||
Backbone.history.loadUrl();
|
||||
},
|
||||
backBtn: function (e) {
|
||||
e.preventDefault();
|
||||
window.history.back();
|
||||
},
|
||||
fbLogin: function (e) {
|
||||
var self = this;
|
||||
e.preventDefault();
|
||||
|
||||
events: {
|
||||
"click #backBtn": "backBtn",
|
||||
"click #fblogin": "fbLogin",
|
||||
"click #gpluslogin": "gplusLogin",
|
||||
"click #resetBtn": "resetBtn"
|
||||
},
|
||||
|
||||
resetBtn:function(e){
|
||||
e.preventDefault();
|
||||
Profile.setKeySave(null);
|
||||
Backbone.history.loadUrl();
|
||||
},
|
||||
|
||||
backBtn:function(e){
|
||||
e.preventDefault();
|
||||
window.history.back();
|
||||
},
|
||||
|
||||
fbLogin: function(e){
|
||||
var self = this;
|
||||
e.preventDefault();
|
||||
|
||||
if(!Profile.isConnected()) {
|
||||
window.localStorage.setItem("tryLogin", "fb");
|
||||
openFB.login('email');
|
||||
}
|
||||
else if(Profile.isConnected() && Profile.isFbConnected())
|
||||
openFB.revokePermissions(function(){
|
||||
Profile.setKeySave(null);
|
||||
self.updateLoginBtn();
|
||||
});
|
||||
},
|
||||
|
||||
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();
|
||||
|
||||
if(!Profile.isConnected()) {
|
||||
window.localStorage.setItem("tryLogin", "gplus");
|
||||
openGPlus.login('email');
|
||||
}
|
||||
else if(Profile.isConnected() && Profile.isGPlusConnected())
|
||||
openGPlus.revokePermissions(function(){
|
||||
Profile.setKeySave(null);
|
||||
self.updateLoginBtn();
|
||||
});
|
||||
},
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
else
|
||||
hello('facebook').login();
|
||||
},
|
||||
fbAfterLogin: function ()
|
||||
{
|
||||
this.$el.find("#fblogin").removeClass("logoutfb");
|
||||
this.$el.find("#fblogin").addClass("loginfb");
|
||||
this.$el.find("#gpluslogin").removeClass("logoutgplus");
|
||||
this.$el.find("#gpluslogin").addClass("logingplus");
|
||||
/*
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
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");
|
||||
}
|
||||
},
|
||||
//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.$el.append(this.header.$el);
|
||||
this.$el.append(this.template({app: myManifest}));
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#moreBtn").addClass("ui-btn-active");
|
||||
|
||||
this.updateLoginBtn();
|
||||
|
||||
return this;
|
||||
}
|
||||
},
|
||||
|
||||
//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.$el.append(this.header.$el);
|
||||
this.$el.append(this.template( { app: myManifest }));
|
||||
this.$el.append(this.footer.$el);
|
||||
this.$el.find("#moreBtn").addClass("ui-btn-active");
|
||||
|
||||
this.updateLoginBtn();
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return SyncView;
|
||||
});
|
||||
});
|
||||
return SyncView;
|
||||
});
|
||||
+4
-2
@@ -4,14 +4,14 @@ define(['jquery', 'underscore', 'backbone',
|
||||
'modules/sync/sync', 'modules/converter/converter', 'modules/donation/donation', 'modules/settings/settings',
|
||||
'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection',
|
||||
'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection',
|
||||
'libs/fastclick', 'jqm', 'jQueryPlugins'],
|
||||
'libs/fastclick', 'classes/cache', 'jqm', 'jQueryPlugins'],
|
||||
function ($, _, Backbone,
|
||||
HomeView, FaqView, IndexView, CategoryView, ItemView,
|
||||
AboutView, SearchView, FoundView, MoreView, NoteView,
|
||||
SyncView, ConverterView, DonationView, SettingsView,
|
||||
NoteCollection, CategoryCollection, CategoryItemCollection,
|
||||
ItemCollection, IngredientiCollection, FoundItemCollection,
|
||||
FastClick) {
|
||||
FastClick, Cache) {
|
||||
|
||||
'use strict';
|
||||
var Router = Backbone.Router.extend({
|
||||
@@ -84,6 +84,8 @@ define(['jquery', 'underscore', 'backbone',
|
||||
this.changePage(faqView);
|
||||
},
|
||||
showIndex: function (actions) {
|
||||
Cache.checkCacheFromServer();
|
||||
|
||||
var categories = new CategoryCollection();
|
||||
// will render home view and navigate to homeView
|
||||
var indexView = new IndexView({collection: categories});
|
||||
|
||||
Reference in New Issue
Block a user