Ejemplo n.º 1
0
        route = function () {
            var hash = window.location.hash,
                view,
                match;

            if (!hash) {
                if (homePage) {
                    slider.slidePage(homePage.$el);
                } else {
                    homePage = new HomeView().render();
                    slider.slidePage(homePage.$el);
                }
            }
            
            match = hash.match(menuURL);
            if (match) {
                view = new MenuView().render();
                slider.slidePage(view.$el);
            }

            match = hash.match(budgetURL);
            if (match) {
                view = new BudgetView().render();
                slider.slidePage(view.$el);
            } 
        },
Ejemplo n.º 2
0
            require(["app/models/event", "app/views/EventList"], function (model, EventList) {
       
                if(typeof(event)==='undefined' || event===null){
                    Useful.showSpinner();
                    
                    event = new model.EventCollection();
                    
                    event.fetch({
                        success: function (collection) {
                            Useful.correctView(that.body);
                            slider.slidePage(new EventList({collection: collection}).$el);                          
                            Useful.hideSpinner();
                        },
                        error:function(){
                            Useful.correctView(that.body); 
                            Useful.hideSpinner();
                            Useful.checkNetwork(slider);

                        }
                    });
                }
                else{
                    Useful.correctView(that.body);
                    slider.slidePage(new EventList({collection: event}).$el);
                }
                
                
                            
            });
Ejemplo n.º 3
0
            require(["app/models/tweet", "app/views/TweetList"], function (models, TweetList) {

                
                if(typeof(tweets)==='undefined' || tweets===null){
                    tweets = new models.TweetCollection(); 
          
          
                    tweets.fetch({
                        api: true,
                        headers: {device_id:that.device_id,api_key:that.api_key},
                        success: function (collection) {
                            Useful.correctView(that.body);
                            slider.slidePage(new TweetList({collection: collection,message_count:that.message_count}).$el);
                        }, 
                        error: function(){
                            console.log('failed to get tweets');
                        }
                    }); 
                    
                    
                }
                else{
                    Useful.correctView(that.body);
                    slider.slidePage(new TweetList({collection: tweets, message_count:that.message_count}).$el);
                }
                                 
            });
Ejemplo n.º 4
0
        require(["app/models/tweet", "app/views/TweetList"], function (models, TweetList) {
 
            if(typeof(tweets)==='undefined' || tweets===null){
                
                Useful.showSpinner();
                
                tweets = new models.TweetCollection(); 
      
                tweets.fetch({
                    api: true,
                    headers: {device_id:that.device_id,api_key:that.api_key},
                    success: function (collection) {
                        Useful.correctView(that.body);
                        slider.slidePage(new TweetList({collection: collection}).$el);                      
                        Useful.hideSpinner();
                    }, 
                    error: function(){
                            Useful.correctView(that.body);
                            Useful.hideSpinner();
                            Useful.checkNetwork(slider);
                    }
                }); 
                
                
            }
            else{
                Useful.correctView(that.body);
                slider.slidePage(new TweetList({collection: tweets}).$el);
            }
                             
        });
Ejemplo n.º 5
0
            require(["app/models/album", "app/models/project", "app/views/AlbumList"], function (model, projectModel, AlbumList) {
       
                if(typeof(albums)==='undefined' || albums===null){
                    
                    Useful.showSpinner();
                    
                    /*
                     * FOR BROWSER TESTING
                     */
                    /*
                    if(in_browser===true){
                        that.device_id = test_device_id;
                        that.api_key = test_api_key;
                    }
                    
                    if(is_emulator===true){
                        that.device_id = test_device_id;
                        that.api_key = test_api_key;
                    }*/
                    
                    if(typeof(that.device_id)==='undefined' || that.device_id===null){
                        that.setDeviceDetails();
                    }
                    
                    
                    if(typeof(flickr_api_key)==='undefined' || flickr_api_key===null){

                        console.log('before the when');
                        $.when(that.setProjectDetailsWait()).done(function(data){

                        });
                        console.log('after the when');
                    }

                    albums = new model.AlbumCollection({flickr_api_key:flickr_api_key, flickr_user_id:flickr_user_id});

                    albums.fetch({
                        full_url: false,
                        success: function (collection) {
                            Useful.correctView(that.body);
                            slider.slidePage(new AlbumList({collection: collection}).$el);
                            Useful.hideSpinner();
                        },
                        error: function(){
                                Useful.correctView(that.body);
                                Useful.hideSpinner();
                                Useful.checkNetwork(slider);
                        }
                    });
         


                }
                else{ 
                    Useful.correctView(that.body);
                    slider.slidePage(new AlbumList({collection: albums}).$el);
                }
                            
            });
Ejemplo n.º 6
0
 require(["app/views/Map"], function (Map) {    
     var mapView = new Map();
     //mapView.delegateEvents();
     //body.removeClass('left-nav');
     slider.slidePage(mapView.$el, body);
     mapView.render();
     //google.maps.event.trigger(mapView.map, 'resize');
  });
Ejemplo n.º 7
0
            require(["app/views/Home"], function (Home) {

                if(is_push===false){
                    slider.slidePage(new Home().$el);                       
                }
                is_push = false;

            });
Ejemplo n.º 8
0
 success: function (collection) {
     Useful.correctView(that.body);
     slider.slidePage(new PhotoList({collection: collection, message_count:that.message_count}).$el);
 
     $('img.lazy').lazyload();                            
     setTimeout(function(){
         $(window).trigger('scroll');
     },1000);
 
 }
Ejemplo n.º 9
0
 require(["app/views/Map"], function (Map) {    
     var mapView = new Map({body:that.body, message_count:that.message_count});
     //mapView.delegateEvents();
     Useful.correctView(that.body);
     slider.slidePage(mapView.$el);
     mapView.render();
     //google.maps.event.trigger(mapView.map, 'resize');
     
     that.body.find('.main-content').css('min-height', '500px');
  });
Ejemplo n.º 10
0
            require(["app/models/article", "app/views/Article"], function (models, Article) {
                               
                if(typeof(articles)==='undefined' || articles===null){
                    
                    
                    if(typeof(that.device_id)==='undefined' || that.device_id===null){
                        that.setDeviceDetails();
                    }

                    var article = new models.Article({id: id});

                    article.fetch({
                        api: true,
                        headers: {device_id:that.device_id,api_key:that.api_key},
                        success: function (data) {
                            
                            var articleView = new Article({model: data, message_count:that.message_count});

                            Useful.correctView(that.body);
                            slider.slidePage(articleView.$el);

                            $.when(articleView.saveView()).done(function(data){
                                that.message_count = data.count;
                            });
          
                            data.set('seen', '1');

                        },
                        error: function(){
                            console.log('failed to fecth artcie'); 
                        }
                    });
                    
                }
                else{
                    
                    var articleView = new Article({model: articles.get(id), 
                                                   device_id:that.device_id,
                                                   api_key:that.api_key,
                                                   message_count:that.message_count
                                                    });
                                                    
                    Useful.correctView(that.body);
                    slider.slidePage(articleView.$el);

                    $.when(articleView.saveView()).done(function(data){
                        that.message_count = data.count;
                    });

                    articles.get(id).set('seen', '1');

                }

            });
Ejemplo n.º 11
0
                        success: function (collection) {
                            Useful.correctView(that.body);

                            if(is_push===false){
                                slider.slidePage(new GenericList({collection: collection}).$el);                         
                            }
                            is_push = false;

                            Useful.hideSpinner();

                        },
Ejemplo n.º 12
0
 require(["app/views/Map"], function (Map) {    
     var mapView = new Map({body:that.body});
     //mapView.delegateEvents();
     Useful.showSpinner();
     
     Useful.correctView(that.body);
     slider.slidePage(mapView.$el);
     mapView.render();
     
     that.body.find('#main-content').css('min-height', '500px');
     
     Useful.hideSpinner();
  });
Ejemplo n.º 13
0
            require(["app/models/article", "app/views/ArticleList"], function (models, ArticleList) {
             
                if(typeof(articles)==='undefined' || articles===null){
                    Useful.showSpinner();
                    
                    
                    if(in_browser===true){
                        that.device_id = test_device_id;
                        that.api_key = test_api_key;
                    }
                    
                    if(typeof(that.device_id)==='undefined' || that.device_id===null){
                        that.setDeviceDetails();
                    }
                    
                    if(typeof(that.device_id)!=='undefined' && that.device_id!==null){
                       
                        articles = new models.ArticleCollection({device_id: that.device_id, project_title: project_title
                                                                });
                                
                        articles.fetch({
                            api: true,
                            headers: {device_id:that.device_id,api_key:that.api_key},
                            success: function (collection) {
      
                                Useful.correctView(that.body);
                                slider.slidePage(new ArticleList({collection: collection}).$el);
                                Useful.hideSpinner();
                            }, 
                            error:   function(model, xhr, options){
                                Useful.correctView(that.body);
                                Useful.hideSpinner();
                                Useful.checkNetwork(slider);                  
                            }
                        }); 
                        
                    }
                    else{
                        Useful.showAlert('There was aproblem accessing messages, please close and reopen app and try again', 'One moment...');
                    }


                }
                else{

                    Useful.correctView(that.body);
                    slider.slidePage(new ArticleList({collection: articles}).$el);
                }
  

            });
Ejemplo n.º 14
0
            require(["app/models/devicenotification", "app/views/MultipleNotifications"], function (model, MultipleNotifications) {
                
                  if(typeof(deviceNotificationModel)==='undefined' || deviceNotificationModel===null){
                        Useful.showSpinner();
                        
                        if(in_browser===true){
                            that.device_id = test_device_id;
                            that.api_key = test_api_key;
                        }
 
                        if(typeof(that.device_id)==='undefined' || that.device_id===null){
                            that.setDeviceDetails();
                        }
                        
                        deviceNotificationModel = new model.DeviceNotification({id:that.device_id});
                        //deviceNotificationModel = new model.DeviceNotification({id:150});


                        if(typeof(that.device_id)==='undefined' || that.device_id===null || typeof(that.api_key)==='undefined' || that.api_key===null){
                            Useful.hideSpinner();
                            Useful.correctView(that.body);
                            Useful.showAlert('Could not get notification settings, please try again later', 'Problem');
                            window.location.hash = "news";
                        }
                        else{   
                            deviceNotificationModel.fetch({
                                api: true,
                                headers: {device_id:that.device_id,api_key:that.api_key},        
                                success: function (data) {
                                    Useful.correctView(that.body);
                                    slider.slidePage(new MultipleNotifications({model: data
                                                                        }).$el);   
                                    Useful.hideSpinner();
                                },
                                error:function(model, xhr, options){    
                                    Useful.correctView(that.body);
                                    Useful.hideSpinner();
                                    Useful.checkNetwork(slider);                  
                                }
                            });
                        }
                    
                  }else{    
                        Useful.correctView(that.body);
                        slider.slidePage(new Notification({model: deviceNotificationModel
                                                            }).$el);    
                  }

       
             });
Ejemplo n.º 15
0
                        success: function (data) {
                            
                            var articleView = new Article({model: data, message_count:that.message_count});

                            Useful.correctView(that.body);
                            slider.slidePage(articleView.$el);

                            $.when(articleView.saveView()).done(function(data){
                                that.message_count = data.count;
                            });
          
                            data.set('seen', '1');

                        },
Ejemplo n.º 16
0
            require(["app/models/student", "app/views/StudentList"], function (model, StudentList) {
       
                if(typeof(student)==='undefined' || student===null){
                    student = new model.StudentCollection();
                    
                    student.fetch({
                        full_url: true,
                        success: function (collection) {

                            slider.slidePage(new StudentList({collection: collection}).$el, body);
                        }
                    });
                }
                else{
                    slider.slidePage(new StudentList({collection: student}).$el, body);
                }
                            
            });
Ejemplo n.º 17
0
            require(["app/models/extracurricular", "app/views/ExtraCurricularList"], function (model, ExtraCurricularList) {
       
                if(typeof(extracurricular)==='undefined' || extracurricular===null){
                    extracurricular = new model.ExtraCurricularCollection();
                    
                    extracurricular.fetch({
                        full_url: true,
                        success: function (collection) {

                            slider.slidePage(new ExtraCurricularList({collection: collection}).$el, body, body);
                        }
                    });
                }
                else{
                    slider.slidePage(new ExtraCurricularList({collection: extracurricular}).$el, body);
                }
                            
            });
Ejemplo n.º 18
0
            require(["app/models/parents", "app/views/ParentsList"], function (model, ParentsList) {
       
                if(typeof(parents)==='undefined' || parents===null){
                    parents = new model.ParentsCollection();
                    
                    parents.fetch({
                        full_url: true,
                        success: function (collection) {

                            slider.slidePage(new ParentsList({collection: collection}).$el, body, body);
                        }
                    });
                }
                else{
                    slider.slidePage(new ParentsList({collection: parents}).$el, body, body);
                }
                            
            });
Ejemplo n.º 19
0
            require(["app/models/curriculum", "app/views/CurriculumList"], function (model, CurriculumList) {
       
                if(typeof(curriculum)==='undefined' || curriculum===null){
                    curriculum = new model.CurriculumCollection();
                    
                    curriculum.fetch({
                        full_url: true,
                        success: function (collection) {

                            slider.slidePage(new CurriculumList({collection: collection}).$el, body, body);
                        }
                    });
                }
                else{
                    slider.slidePage(new CurriculumList({collection: curriculum}).$el, body, body);
                }
                            
            });
Ejemplo n.º 20
0
            require(["app/models/news", "app/views/NewsList"], function (model, NewsList) {
       
                if(typeof(news)==='undefined' || news===null){
                    news = new model.NewsCollection();
                    
                    news.fetch({
                        full_url: false,
                        success: function (collection) {

                            slider.slidePage(new NewsList({collection: collection}).$el, body, body);
                        }
                    });
                }
                else{ 
                    slider.slidePage(new NewsList({collection: news}).$el, body, body);
                }
                            
            });
Ejemplo n.º 21
0
            require(["app/models/album", "app/views/AlbumList"], function (model, AlbumList) {
       
                if(typeof(albums)==='undefined' || albums===null){
                    albums = new model.AlbumCollection();
                    
                    albums.fetch({
                        full_url: true,
                        success: function (collection) {

                            slider.slidePage(new AlbumList({collection: collection}).$el, body, body);
                        }
                    });
                }
                else{ 
                    slider.slidePage(new AlbumList({collection: albums}).$el, body, body);
                }
                            
            });
Ejemplo n.º 22
0
      require(["app/models/calendar", "app/views/CalendarList"], function (model, CalendarList) {
 
          if(typeof(calendar)==='undefined' || calendar===null){
              calendar = new model.CalendarCollection();
              
              calendar.fetch({
                  full_url: true,
                  success: function (collection) {
                      Useful.correctView(that.body);
                      slider.slidePage(new CalendarList({collection: collection, message_count:that.message_count}).$el);                          
                  }
              });
          }
          else{
              Useful.correctView(that.body);
              slider.slidePage(new CalendarList({collection: calendar, message_count:that.message_count}).$el);
          }
                      
      });
Ejemplo n.º 23
0
            require(["app/models/article", "app/views/ArticleList"], function (models, ArticleList) {
             
                if(typeof(articles)==='undefined' || articles===null){
                    

                    
                    if(typeof(that.device_id)==='undefined' || that.device_id===null){
                        that.setDeviceDetails();
                    }
                    
                    if(typeof(that.device_id)!=='undefined' && that.device_id!==null){
                       
                        articles = new models.ArticleCollection({device_id: that.device_id, project_title: project_title
                                                                });

                        articles.fetch({
                            api: true,
                            headers: {device_id:that.device_id,api_key:that.api_key},
                            success: function (collection) {
                                Useful.correctView(that.body);
                                slider.slidePage(new ArticleList({collection: collection,message_count:that.message_count}).$el);
                            }, 
                            error: function(model, xhr, options){
                                    console.log('there was an error, response is ');
                                    console.log(xhr.responseText);
                            }
                        }); 
                        
                    }
                    else{
                        Useful.showAlert('There was aproblem accessing messages, please close and reopen app and try again', 'One moment...');
                    }


                }
                else{

                    Useful.correctView(that.body);
                    slider.slidePage(new ArticleList({collection: articles,message_count:that.message_count}).$el);
                }
  

            });
Ejemplo n.º 24
0
      require(["app/models/album", "app/views/AlbumList"], function (model, AlbumList) {
 
          if(typeof(albums)==='undefined' || albums===null){
              albums = new model.AlbumCollection();
              
              albums.fetch({
                  full_url: true,
                  success: function (collection) {
                      Useful.correctView(that.body);
                      slider.slidePage(new AlbumList({collection: collection, message_count:that.message_count}).$el);
                  }
              });
          }
          else{ 
              Useful.correctView(that.body);
              slider.slidePage(new AlbumList({collection: albums, message_count:that.message_count}).$el);
          }
                      
      });
Ejemplo n.º 25
0
            require(["app/models/sports", "app/views/SportsList"], function (model, SportsList) {
       
                if(typeof(sports)==='undefined' || sports===null){
                    sports = new model.SportsCollection();
                    
                    sports.fetch({
                        full_url: true,
                        success: function (collection) {

                            slider.slidePage(new SportsList({collection: collection}).$el, body, body);
                           // $("html, body").animate({ scrollTop: 0 }, 'slow');
                        } 
                    });
                }
                else{
                    slider.slidePage(new SportsList({collection: sports}).$el, body, body);
                }
                            
            });
Ejemplo n.º 26
0
      require(["app/models/calendar", "app/views/CalendarList"], function (model, CalendarList) {
 
          if(typeof(calendar)==='undefined' || calendar===null){
              calendar = new model.CalendarCollection();
              
              calendar.fetch({
                  full_url: true,
                  success: function (collection) {
                      //body.removeClass('left-nav');
                      slider.slidePage(new CalendarList({collection: collection}).$el, body);                          
                  }
              });
          }
          else{
              //body.removeClass('left-nav');
              slider.slidePage(new CalendarList({collection: calendar}).$el, body);
          }
                      
      });
Ejemplo n.º 27
0
                require(["app/models/service", "app/views/ServiceList"], function (model, ServiceList) {

                    if(typeof(service)==='undefined' || service===null){
                        service = new model.ServiceCollection();

                        service.fetch({
                            full_url: true,
                            success: function (collection) {
                                Useful.correctView(that.body);
                                slider.slidePage(new ServiceList({collection: collection, message_count:that.message_count}).$el);                         
                                
                            }
                        });
                    }
                    else{
                        Useful.correctView(that.body);
                        slider.slidePage(new ServiceList({collection: service, message_count:that.message_count}).$el);
                    }

                });
Ejemplo n.º 28
0
                        success: function (data) {
                            
                            var articleView = new Article({model: data});

                            Useful.correctView(that.body);
                            slider.slidePage(articleView.$el);
                            
                            Useful.hideSpinner();

                            $.when(articleView.saveView()).done(function(data){
                                that.message_count = data.count;
                            });
          
                            data.set('seen', '1');
                            
                            setTimeout(function(){
                                is_push = false;
                            },1000);

                        },
Ejemplo n.º 29
0
                require(["app/models/welcome", "app/views/WelcomeList"], function (model, WelcomeList) {

                    if(typeof(welcome)==='undefined' || welcome===null){
                        welcome = new model.WelcomeCollection();

                        welcome.fetch({
                            full_url: true,
                            success: function (collection) {
                                Useful.correctView(that.body);
                                slider.slidePage(new WelcomeList({collection: collection, message_count:that.message_count}).$el);                         
                                
                            }
                        });
                    }
                    else{
                        Useful.correctView(that.body);
                        slider.slidePage(new WelcomeList({collection: welcome, message_count:that.message_count}).$el);
                    }

                });
Ejemplo n.º 30
0
                require(["app/models/facilities", "app/views/FacilitiesList"], function (model, FacilitiesList) {

                    if(typeof(facilities)==='undefined' || facilities===null){
                        facilities = new model.FacilitiesCollection();

                        facilities.fetch({
                            full_url: true,
                            success: function (collection) {
                                Useful.correctView(that.body);
                                slider.slidePage(new FacilitiesList({collection: collection, message_count:that.message_count}).$el);                         
                                
                            }
                        });
                    }
                    else{
                        Useful.correctView(that.body);
                        slider.slidePage(new FacilitiesList({collection: facilities, message_count:that.message_count}).$el);
                    }

                });