Changeset 2efe93e in Git for src/main/java


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

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  
    2929        http.csrf().disable()
    3030                .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()
    3232                .anyRequest()
    3333                .authenticated()
  • src/main/java/com/wediscussmovies/project/web/controller/MovieController.java

    rf25e8dd r2efe93e  
    11package com.wediscussmovies.project.web.controller;
    22
     3import com.wediscussmovies.project.LoggedUser;
    34import com.wediscussmovies.project.model.Movie;
    45import com.wediscussmovies.project.model.Person;
     
    1920import java.sql.Date;
    2021import java.time.LocalDate;
     22import java.util.ArrayList;
    2123import java.util.List;
    2224
     
    5355          model.addAttribute("user",user);
    5456        }
    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        }
    5665        model.addAttribute("movies", movies);
     66        model.addAttribute("movie_rows", movie_rows);
    5767        model.addAttribute("contentTemplate", "moviesList");
    5868        if (error != null && !error.equals(" "))
  • 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.