From 27a571328bfb0ad4846e8585eacc520cbf90b48e Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 22 May 2016 18:05:30 +0200 Subject: [PATCH] Added popovers to team preview --- client/app/js/views/battles/battle_view.coffee | 6 ++++++ public/js/app.js | 14 ++++++++++++-- public/js/replays.js | 14 ++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/client/app/js/views/battles/battle_view.coffee b/client/app/js/views/battles/battle_view.coffee index 55ab45b..0e7e9ad 100644 --- a/client/app/js/views/battles/battle_view.coffee +++ b/client/app/js/views/battles/battle_view.coffee @@ -207,7 +207,13 @@ class @BattleView extends Backbone.View locals = battle : @model window : window + yourTeam : @model.getTeam() @$('.battle_container').append @team_preview_template(locals) + @$('.battle_teams').find('.arrange_team .pokemon_icon').each (i, el) => + $this = $(el) + slot = $this.data('index') + pokemon = @model.getPokemon(@model.get('index'), slot) + @pokemonPopover($this, pokemon) togglePokemonOrSwitch: (e) => $currentTarget = $(e.currentTarget) diff --git a/public/js/app.js b/public/js/app.js index 670cb5a..4651340 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -3256,9 +3256,19 @@ var locals; locals = { battle: this.model, - window: window + window: window, + yourTeam: this.model.getTeam() }; - return this.$('.battle_container').append(this.team_preview_template(locals)); + this.$('.battle_container').append(this.team_preview_template(locals)); + return this.$('.battle_teams').find('.arrange_team .pokemon_icon').each((function(_this) { + return function(i, el) { + var $this, pokemon, slot; + $this = $(el); + slot = $this.data('index'); + pokemon = _this.model.getPokemon(_this.model.get('index'), slot); + return _this.pokemonPopover($this, pokemon); + }; + })(this)); }; BattleView.prototype.togglePokemonOrSwitch = function(e) { diff --git a/public/js/replays.js b/public/js/replays.js index 650a854..9982cd5 100644 --- a/public/js/replays.js +++ b/public/js/replays.js @@ -2982,9 +2982,19 @@ var locals; locals = { battle: this.model, - window: window + window: window, + yourTeam: this.model.getTeam() }; - return this.$('.battle_container').append(this.team_preview_template(locals)); + this.$('.battle_container').append(this.team_preview_template(locals)); + return this.$('.battle_teams').find('.arrange_team .pokemon_icon').each((function(_this) { + return function(i, el) { + var $this, pokemon, slot; + $this = $(el); + slot = $this.data('index'); + pokemon = _this.model.getPokemon(_this.model.get('index'), slot); + return _this.pokemonPopover($this, pokemon); + }; + })(this)); }; BattleView.prototype.togglePokemonOrSwitch = function(e) {