Changeset ad4243e in Git for src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
- Timestamp:
- 02/07/22 21:26:03 (3 years ago)
- Branches:
- main
- Children:
- 0226942
- Parents:
- 7f36551 (diff), 3c0f9a9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Mato-77 <56981531+Mato-77@…> (02/07/22 21:26:03)
- git-committer:
- GitHub <noreply@…> (02/07/22 21:26:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
r7f36551 rad4243e 9 9 import com.wediscussmovies.project.service.PersonService; 10 10 import com.wediscussmovies.project.web.DesignFrontMovies; 11 import com.wediscussmovies.project.web.PageFrontMovies; 11 12 import lombok.Data; 12 13 import org.springframework.format.annotation.DateTimeFormat; … … 37 38 } 38 39 39 @GetMapping 40 @GetMapping("/old") 40 41 public String getMovies(@RequestParam(required = false) String titleQuery, Model model, 41 42 @RequestParam(required = false) String error){ … … 55 56 model.addAttribute("movie_rows", movie_rows); 56 57 model.addAttribute("contentTemplate", "moviesList"); 58 if (error != null && !error.equals(" ")) 59 model.addAttribute("error",error); 60 return "template"; 61 } 62 63 64 @GetMapping 65 public String getMoviesAlternative(@RequestParam(required = false) String titleQuery, Model model, 66 @RequestParam(required = false) String error, @RequestParam(required = false) String page){ 67 if (page==null){ 68 return "redirect:/movies?page=1"; 69 } 70 addModelPropertiesForUser(model); 71 List<Movie> movies = PageFrontMovies.getPagedMovies(page, movieService, model); 72 List<List<Movie>> movie_rows = new ArrayList<>(); 73 DesignFrontMovies.designMovieList(movies,movie_rows); 74 model.addAttribute("movies", movies); 75 model.addAttribute("movie_rows", movie_rows); 76 model.addAttribute("contentTemplate", "moviesListPaged"); 57 77 if (error != null && !error.equals(" ")) 58 78 model.addAttribute("error",error); … … 160 180 } 161 181 private void addModelProperties(Model model){ 162 163 model.addAttribute("directors", personService.findAllDirectors()); 182 model.addAttribute("directors", personService.findAllDirectors()); 164 183 model.addAttribute("actors", personService.findAllActors()); 165 184 model.addAttribute("genres", genreService.findAll()); … … 169 188 model.addAttribute("likedMovies",this.movieService.findLikedMoviesByUser(user)); 170 189 model.addAttribute("user",user); 171 190 } 172 191 173 192 }
Note:
See TracChangeset
for help on using the changeset viewer.