@@ -59,12 +59,12 @@ define(function(require){
5959 initUserPreferences : function ( ) {
6060 var prefs = this . getUserPreferences ( ) ;
6161 this . filterText = prefs . search ;
62- this . filterTags = prefs . tags
62+ this . filterTags = prefs . tags
6363 ? prefs . tags . reduce ( ( m , tagId ) => {
6464 const tagModel = this . allTags . find ( tag => tag . get ( '_id' ) === tagId )
6565 if ( tagModel ) m . push ( { id :tagId , title :tagModel . get ( 'title' ) } )
6666 return m
67- } , [ ] )
67+ } , [ ] )
6868 : [ ] ;
6969 this . doLayout ( prefs . layout ) ;
7070 this . doSort ( prefs . sort , false ) ;
@@ -95,10 +95,15 @@ define(function(require){
9595 this . resizeTimer = - 1 ;
9696 }
9797 var $item = new ProjectView ( { model : new CourseModel ( ) } ) . $el ;
98+ $item . css ( {
99+ visibility : 'hidden'
100+ } ) . appendTo ( '.projects-list' ) ; // Fixed: added missing class selector
101+
98102 var containerHeight = $ ( window ) . height ( ) - this . $el . offset ( ) . top ;
99103 var itemHeight = $item . outerHeight ( true ) ;
100104 var columns = Math . floor ( this . $ ( '.projects-inner' ) . width ( ) / $item . outerWidth ( true ) ) ;
101- var rows = Math . floor ( containerHeight / itemHeight ) ;
105+ var rows = Math . max ( 1 , Math . ceil ( containerHeight / itemHeight ) ) ;
106+ $item . remove ( ) ;
102107 // columns stack nicely, but need to add extra row if it's not a clean split
103108 if ( ( containerHeight % itemHeight ) > 0 ) rows ++ ;
104109 this . collection . queryOptions . limit = columns * rows ;
@@ -153,7 +158,7 @@ define(function(require){
153158 if ( this . shouldStopFetches ) return ;
154159
155160 this . isCollectionFetching = true ;
156-
161+
157162 this . usersCollection . fetch ( {
158163 success : ( collection , response ) => {
159164 Object . assign ( this . collection . queryOptions , {
@@ -169,7 +174,7 @@ define(function(require){
169174 if ( this . allCourses . find ( course => course . get ( '_courseId' ) === courseId ) ) return
170175 this . allCourses . push ( model ) ;
171176 } )
172-
177+
173178 this . removeChildViews ( ) ;
174179 this . allCourses . forEach ( a => this . appendProjectItem ( a ) ) ;
175180
0 commit comments