Skip to content

Commit 6a77a67

Browse files
author
Ian Redpath
committed
show 'no blank found' for loops over empty arrays
1 parent c47869a commit 6a77a67

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

public/project/components/libraries/libraries.view.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h1>Libraries</h1>
1313
<div *ngIf="!showSearchResults" class="libraries-no-search">
1414
<h4>Highest rated libraries</h4>
1515
<div class="sample-libraries row">
16+
<span class="no-results" *ngIf="highestRatedLibs.length ===0">No libraries found</span>
1617
<div *ngFor="#library of highestRatedLibs.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
1718
<div class="movie-poster-container">
1819
<img src="./assets/default_library.png" class="movie-image"[routerLink]="['/Library', { library: library._id }]">
@@ -31,6 +32,7 @@ <h4>Highest rated libraries</h4>
3132
</div>
3233
<h4>Libraries with the most movies</h4>
3334
<div class="sample-libraries row">
35+
<span class="no-results" *ngIf="mostMoviesLibs.length ===0">No libraries found</span>
3436
<div *ngFor="#library of mostMoviesLibs.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
3537
<div class="movie-poster-container">
3638
<img src="./assets/default_library.png" class="movie-image"[routerLink]="['/Library', { library: library._id }]">
@@ -43,6 +45,7 @@ <h4>Libraries with the most movies</h4>
4345
</div>
4446
<h4>Libraries with the most comments</h4>
4547
<div class="sample-libraries row">
48+
<span class="no-results" *ngIf="mostCommentsLibs.length ===0">No libraries found</span>
4649
<div *ngFor="#library of mostCommentsLibs.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
4750
<div class="movie-poster-container">
4851
<img src="./assets/default_library.png" class="movie-image"[routerLink]="['/Library', { library: library._id }]">
@@ -56,6 +59,7 @@ <h4>Libraries with the most comments</h4>
5659
</div>
5760
<div class="libraries-search" *ngIf="showSearchResults">
5861
<div class="sample-libraries row">
62+
<span class="no-results" *ngIf="getShownResults.length ===0">No results found</span>
5963
<div *ngFor="#library of getShownResults()" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
6064
<div class="movie-poster-container">
6165
<img src="./assets/default_library.png" class="movie-image"[routerLink]="['/Library', { library: library._id }]">

public/project/components/libraries/library.view.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ <h1 *ngIf="!hasEditRights()">{{library.name}}</h1>
1212
<a [routerLink]='["/User", { user: library.user._id }]'>{{library.user.username}}</a>
1313
</div>
1414
<div class="library-contents row">
15+
<span class="no-results" *ngIf="library.movies.length ===0">No movies found</span>
1516
<div *ngFor="#movie of library.movies" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
1617
<button *ngIf="hasEditRights()" class="btn btn-xs glyphicon glyphicon-remove thumbnail-remove" (click)="removeMovie(movie._id)"></button>
1718
<div class="movie-poster-container-library">
@@ -52,6 +53,7 @@ <h1 *ngIf="!hasEditRights()">{{library.name}}</h1>
5253
</div>
5354

5455
<h3>COMMENTS</h3>
56+
<span class="no-results" *ngIf="library.comments.length ===0">No comments found</span>
5557
<table>
5658
<tr *ngFor="#comment of library.comments">
5759
<td><a [routerLink]='["/User", { user: comment.userId }]'>{{comment.username}}</a></td>

public/project/components/movies/movie.view.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ <h1 class="movie-title">{{omdbMovie.title}}</h1>
6565
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" *ngIf="!fetchingLibraries">
6666
<h3>Libraries With This Title</h3>
6767
<div class="sample-libraries row">
68+
<span class="no-results" *ngIf="movie.libraries.length ===0">No libraries with this title</span>
6869
<div *ngFor="#library of movie.libraries" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
6970
<div class="movie-poster-container">
7071
<img src="./assets/default_library.png" class="movie-image"[routerLink]="['/Library', { library: library._id }]">

public/project/components/movies/movies.view.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ <h1>Movies</h1>
1212
</div>
1313
<div *ngIf="!showSearchResults" class="movies-no-search">
1414
<h4>Highest rated movies</h4>
15-
16-
1715
<div class="sample-movies row">
16+
<span class="no-results" *ngIf="highestRatedMovies.length ===0">No movies found</span>
1817
<div *ngFor="#movie of highestRatedMovies.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
1918
<div class="movie-poster-container">
2019
<img src={{movie.image}} class="movie-image"[routerLink]="['/Movie', { movie: movie.imdbId }]">
@@ -34,6 +33,7 @@ <h4>Highest rated movies</h4>
3433
</div>
3534
<h4>Movies with the most libraries</h4>
3635
<div class="sample-movies row">
36+
<span class="no-results" *ngIf="mostLibsMovies.length ===0">No movies found</span>
3737
<div *ngFor="#movie of mostLibsMovies.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
3838
<div class="movie-poster-container">
3939
<img src={{movie.image}} class="movie-image" [routerLink]="['/Movie', { movie: movie.imdbId }]">
@@ -46,6 +46,7 @@ <h4>Movies with the most libraries</h4>
4646
</div>
4747
<h4>Movies with the most comments</h4>
4848
<div class="sample-movies row">
49+
<span class="no-results" *ngIf="mostCommentsMovies.length ===0">No movies found</span>
4950
<div *ngFor="#movie of mostCommentsMovies.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
5051
<div class="movie-poster-container">
5152
<img src={{movie.image}} class="movie-image" [routerLink]="['/Movie', { movie: movie.imdbId }]">
@@ -59,6 +60,7 @@ <h4>Movies with the most comments</h4>
5960
</div>
6061
<div class="movies-search" *ngIf="showSearchResults">
6162
<div class="movies-search-results row">
63+
<span class="no-results" *ngIf="results.length ===0">No results found</span>
6264
<div *ngFor="#movie of results" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
6365
<div class="movie-poster-container">
6466
<img src={{movie.image}} class="movie-image"[routerLink]="['/Movie', { movie: movie.imdbId }]">

public/project/components/users/user.view.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ <h4 class="no-bot-margin">Create a new library!</h4>
1818

1919
<h3 class="no-bot-margin">{{ getWhoseLibraries() }} libraries</h3>
2020
<div class="user-libraries row">
21+
<span class="no-results" *ngIf="user.libraries.length ===0">No libraries found</span>
2122
<div *ngFor="#library of user.libraries" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
2223
<button *ngIf="hasEditRights()" class="btn btn-xs glyphicon glyphicon-remove thumbnail-remove" (click)="removeLibrary(library._id)"></button>
2324
<div class="movie-poster-container">

public/project/components/users/users.view.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h1>Users</h1>
1313
<div *ngIf="!showSearchResults" class="users-no-search">
1414
<h4>Users with the most libraries</h4>
1515
<div class="sample-users row">
16+
<span class="no-results" *ngIf="mostLibUsers.length ===0">No users found</span>
1617
<div *ngFor="#user of mostLibUsers.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
1718
<div class="movie-poster-container">
1819
<img src="./assets/default_user.png" class="movie-image"[routerLink]="['/User', { user: user._id }]">
@@ -25,6 +26,7 @@ <h4>Users with the most libraries</h4>
2526
</div>
2627
<h4>Users with the most ratings</h4>
2728
<div class="sample-users row">
29+
<span class="no-results" *ngIf="mostRatingsUsers.length ===0">No users found</span>
2830
<div *ngFor="#user of mostRatingsUsers.slice(0, 10)" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
2931
<div class="movie-poster-container">
3032
<img src="./assets/default_user.png" class="movie-image"[routerLink]="['/User', { user: user._id }]">
@@ -37,8 +39,8 @@ <h4>Users with the most ratings</h4>
3739
</div>
3840
</div>
3941
<div class="users-search" *ngIf="showSearchResults">
40-
4142
<div class="users-search-results row">
43+
<span class="no-results" *ngIf="getShownResults.length ===0">No results found</span>
4244
<div *ngFor="#user of getShownResults()" class="library-movie col-xs-6 col-sm-4 col-md-3 col-lg-2">
4345
<div class="movie-poster-container">
4446
<img src="./assets/default_user.png" class="movie-image"[routerLink]="['/User', { user: user._id }]">

0 commit comments

Comments
 (0)