Changeset 2efe93e in Git for src/main/java
- Timestamp:
- 02/06/22 20:01:15 (3 years ago)
- Branches:
- main
- Children:
- 42d565b
- Parents:
- f25e8dd
- Location:
- src/main/java/com/wediscussmovies/project
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java
rf25e8dd r2efe93e 29 29 http.csrf().disable() 30 30 .authorizeRequests() 31 .antMatchers("/movies","/movies/**/","/actors","/persons/**/","/directors","/discussions","/discussions/**/","/discussions/all/**/","/replies","/register","/genres" ).permitAll()31 .antMatchers("/movies","/movies/**/","/actors","/persons/**/","/directors","/discussions","/discussions/**/","/discussions/all/**/","/replies","/register","/genres", "/css/**", "/js/**").permitAll() 32 32 .anyRequest() 33 33 .authenticated() -
src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
rf25e8dd r2efe93e 1 1 package com.wediscussmovies.project.web.controller; 2 2 3 import com.wediscussmovies.project.LoggedUser; 3 4 import com.wediscussmovies.project.model.Movie; 4 5 import com.wediscussmovies.project.model.Person; … … 19 20 import java.sql.Date; 20 21 import java.time.LocalDate; 22 import java.util.ArrayList; 21 23 import java.util.List; 22 24 … … 53 55 model.addAttribute("user",user); 54 56 } 55 57 List<Movie> movieList = movies; 58 List<List<Movie>> movie_rows = new ArrayList<>(); 59 for(int i=0; i<movieList.size(); i+=4){ 60 int j = i+4; 61 if(j>movieList.size()) 62 j=movieList.size(); 63 movie_rows.add(movieList.subList(i, j)); 64 } 56 65 model.addAttribute("movies", movies); 66 model.addAttribute("movie_rows", movie_rows); 57 67 model.addAttribute("contentTemplate", "moviesList"); 58 68 if (error != null && !error.equals(" ")) -
src/main/java/com/wediscussmovies/project/web/controller/UsersController.java
rf25e8dd r2efe93e 3 3 4 4 import com.wediscussmovies.project.LoggedUser; 5 import com.wediscussmovies.project.model.Movie; 5 6 import com.wediscussmovies.project.model.exception.InvalidArgumentsException; 6 7 import com.wediscussmovies.project.model.exception.PasswordsDoNotMatchException; … … 13 14 import org.springframework.web.bind.annotation.RequestMapping; 14 15 import org.springframework.web.bind.annotation.RequestParam; 16 17 import java.util.ArrayList; 18 import java.util.List; 15 19 16 20 @Controller … … 59 63 @GetMapping("/favoriteList") 60 64 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); 62 74 model.addAttribute("contentTemplate","favoriteList"); 63 75 return "template";
Note:
See TracChangeset
for help on using the changeset viewer.