Ignore:
Timestamp:
02/06/22 20:01:15 (3 years ago)
Author:
Petar Partaloski <ppartaloski@…>
Branches:
main
Children:
42d565b
Parents:
f25e8dd
Message:

Improved Front-End, added card view of movies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/web/controller/UsersController.java

    rf25e8dd r2efe93e  
    33
    44import com.wediscussmovies.project.LoggedUser;
     5import com.wediscussmovies.project.model.Movie;
    56import com.wediscussmovies.project.model.exception.InvalidArgumentsException;
    67import com.wediscussmovies.project.model.exception.PasswordsDoNotMatchException;
     
    1314import org.springframework.web.bind.annotation.RequestMapping;
    1415import org.springframework.web.bind.annotation.RequestParam;
     16
     17import java.util.ArrayList;
     18import java.util.List;
    1519
    1620@Controller
     
    5963    @GetMapping("/favoriteList")
    6064    public String getFavoriteList(Model model){
    61         model.addAttribute("movies",this.movieService.findLikedMoviesByUser(LoggedUser.getLoggedUser()));
     65        List<Movie> movieList = this.movieService.findLikedMoviesByUser(LoggedUser.getLoggedUser());
     66        List<List<Movie>> movie_rows = new ArrayList<>();
     67        for(int i=0; i<movieList.size(); i+=4){
     68            int j = i+4;
     69            if(j>movieList.size())
     70                j= movieList.size();
     71            movie_rows.add(movieList.subList(i, j));
     72        }
     73        model.addAttribute("movie_rows", movie_rows);
    6274        model.addAttribute("contentTemplate","favoriteList");
    6375        return "template";
Note: See TracChangeset for help on using the changeset viewer.