;(function(Draws, _, session){ /** * @class Games * @extends Backbone.View * @requires portalGGA.models.Draws * @view */ portalGGA.views.WinnerCarousel = Backbone.View.extend( /** @lends portalGGA.views.DrawResults.prototype */{ /** * Rename object, and render on init. * @author mulleti.satyanrayana@gtech.com * @param {Object} options * @param {portalGGA.models.Draws} [options.draws] Draws collection, if not given new one will be created. * @param {Object} options.betslipLinks Map of betslip links, one per each ESA game name. */ constructor: function WinnerCarousel( options ){ Backbone.View.apply(this, arguments); this.gameConfig = $.parseJSON(options.gameConfig); this.winnerID = $.parseJSON(options.winnerID); this.winnerImg = $.parseJSON(options.winnerImg); this.winnerUrl = $.parseJSON(options.winnerUrl); this.winnerDesc = $.parseJSON(options.winnerDesc); this.newWindow = $.parseJSON(options.newWindow); this.renderCarousel(); }, /** * Render all games from collection, bind click. * @author mulleti.satyanarayana@gtech.com * @todo: get only opened? fileter latest? to be discussed with ESA guys (twytrebowicz) * @return {jQuery} #$el */ renderCarousel: function renderCarousel(){ var self = this; var games = {}; for(var index=0;index < self.winnerID.length;index++) { if(self.winnerUrl[index].indexOf("/content/")!= -1 && self.winnerUrl[index].indexOf(".html")== -1 ) self.winnerUrl[index] = self.winnerUrl[index] + ".html"; games[self.winnerID [index]] = { imageID : self.winnerID[index], carouselIndex : index+1, imageName: self.winnerImg[index], imageUrl : self.winnerUrl[index], imageDesc : self.winnerDesc[index], imageOpenWindow :self.newWindow[index] }; } console.log("Carousel Items..." ,games) $('.winners-carousel').append(carouselItemTemplate({games:games})); $('.responsiveGallery-wrapper').responsiveGallery({ animatDuration: 400, $btn_prev: $('.responsiveGallery-btn_prev'), $btn_next: $('.responsiveGallery-btn_next') }); } }); }(portalGGA.models.Draws, _, portalGGA.utils.session))