Permalink
Browse files

fade ins

  • Loading branch information...
1 parent d28fef6 commit e6451638c61530601b36e651824cbc0121873edc @fguillen committed Apr 19, 2012
Showing with 25 additions and 7 deletions.
  1. +0 −2 client/app/FleetsView.js
  2. +4 −3 client/app/NoticesView.js
  3. +12 −1 client/app/PlanetDecorator.js
  4. +9 −1 client/app/PlanetView.js
View
2 client/app/FleetsView.js
@@ -1,7 +1,5 @@
$(function(){
App.FleetsView = Backbone.View.extend({
- el: "#dashboard #fleets ul",
-
initialize: function(opts){
this.fleets = opts.fleets;
this.fleets.bind( 'reset', this.addAll, this );
View
7 client/app/NoticesView.js
@@ -1,7 +1,5 @@
$(function(){
App.NoticesView = Backbone.View.extend({
- el: "#notices ul",
-
initialize: function(opts){
this.notices = opts.notices;
this.notices.bind( 'reset', this.addAll, this );
@@ -12,7 +10,10 @@ $(function(){
addOne: function( model ) {
var view = new App.NoticeView({ notice: model });
- this.$el.append( view.render().el );
+ view.render()
+ view.$el.hide();
+ this.$el.prepend( view.$el );
+ view.$el.fadeIn();
},
addAll: function() {
View
13 client/app/PlanetDecorator.js
@@ -19,7 +19,18 @@ $(function(){
},
unitsEnemyCount: function() {
- return this.planet.enemyFleets.reduce( function( memo, fleet ) { return memo + fleet.ships.size(); }, 0);
+ console.log( "PlanetDecorator.unitsEnemyCount", this.planet.id );
+ var result =
+ this.planet.enemyFleets.reduce(
+ function( memo, fleet ) {
+ return memo + fleet.ships.size();
+ },
+ 0
+ );
+
+ console.log( "PlanetDecorator.unitsEnemyCount.result", result );
+
+ return result;
},
extraCSSClasses: function(){
View
10 client/app/PlanetView.js
@@ -13,7 +13,7 @@ $(function(){
initialize: function(opts){
this.planet = opts.planet;
this.planet.ships.on( "add remove", this.render, this );
- this.planet.enemyFleets.on( "all", this.render, this );
+ this.planet.enemyFleets.on( "all", this.renderByEnemyFleets, this );
},
seeDetails: function(){
@@ -25,7 +25,15 @@ $(function(){
App.Game.sendFleetToPlanet( this.planet );
},
+ renderByEnemyFleets: function(){
+ console.log( "PlanetView.renderByEnemyFleets", this.planet.id );
+
+ this.render();
+ },
+
render: function(){
+ console.log( "PlanetView.render", this.planet.id );
+
var planetDecorator = new App.PlanetDecorator({ planet: this.planet });
this.$el.html( this.template( planetDecorator.toJSON() ) );
return this;

0 comments on commit e645163

Please sign in to comment.