Changes in / [2a98e34:eb36f39]
- Location:
- src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
r2a98e34 reb36f39 134 134 135 135 } 136 // @GetMapping("/films")137 // public String getFilmsPage(Model model){138 // model.addAttribute("cinemas",cinemaService.findAllCinemas());139 // List<FilmsReturnTable> pom=new LinkedList<>();140 // model.addAttribute("films",pom);141 // boolean h=pom.isEmpty();142 // List<FilmsReturnTable> help=filmService.getFilmsFromCinema(2);143 // model.addAttribute("bodyContent","films");144 // return "master-template";145 // }146 147 136 @GetMapping("/films") 148 137 @Transactional … … 157 146 } 158 147 159 160 // @GetMapping("/films") 161 // public String getFilmsPage1(Model model,@RequestParam(required = false) Integer id_cinema){ 162 // model.addAttribute("cinemas",cinemaService.findAllCinemas()); 163 // if (id_cinema!=null) { 164 // model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema)); 165 // }else{ 166 //// List<FilmsReturnTable> pom=new LinkedList<>(); 167 // model.addAttribute("films",filmService.findAllFilms()); 168 // } 169 // model.addAttribute("bodyContent","films"); 170 // return "master-template"; 171 // } 172 173 // @PostMapping("/getFilmsFromCinema") 174 // public String getFilmsFromCinema(@RequestParam Integer cinema, Model model){ 175 // return getFilmsPage1(model,cinema); 176 // } 148 public String getFilmsPage1(Model model,Integer id_cinema){ 149 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 150 if (id_cinema!=null) { 151 model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema.intValue())); 152 }else{ 153 List<FilmsReturnTable> pom=new LinkedList<>(); 154 model.addAttribute("films",pom); 155 } 156 157 model.addAttribute("bodyContent","films"); 158 return "master-template"; 159 } 160 @PostMapping("/getFilmsFromCinema") 161 public String getFilmsFromCinema(@RequestParam Integer cinema, Model model){ 162 return getFilmsPage1(model,cinema); 163 } 177 164 @GetMapping("/projections") 178 165 public String getProjectionsPage(Model model) -
src/main/resources/templates/films.html
r2a98e34 reb36f39 200 200 </style> 201 201 <div> 202 <!-- <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}"--> 203 <!-- th:method="POST">--> 204 205 <!-- <div class="form-group">--> 206 <!-- <label style="color: white;font-size: 20px;font-weight: bold">Кино</label>--> 207 <!-- <select name="cinemas" class="form-control" id="cinema">--> 208 <!-- <option--> 209 <!-- th:selected="${cinemas.get(1)}"--> 210 <!-- th:each="cinema : ${cinemas}"--> 211 <!-- th:value="${cinema.getId_cinema()}"--> 212 <!-- th:text="${cinema.getName()}">--> 213 <!-- </option>--> 214 <!-- </select>--> 215 216 <!-- </div>--> 217 <!-- <button class="button" type="submit">Filter</button>--> 218 <!--</form>--> 219 <form id="filter-form"> 220 221 <label for="f2">Cinema</label> 222 <select name="id_cinema" id="f2"> 223 <option value="">All</option> 224 <option th:each="cinema : ${cinemas}" th:value="${cinema.id_cinema}" th:text="${cinema.name}"> [course]</option> 202 <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}" 203 th:method="POST"> 204 205 <div class="form-group"> 206 <label style="color: white;font-size: 20px;font-weight: bold">Кино</label> 207 <select name="cinemas" class="form-control" id="cinema"> 208 <option 209 th:selected="${cinemas.get(1)}" 210 th:each="cinema : ${cinemas}" 211 th:value="${cinema.getId_cinema()}" 212 th:text="${cinema.getName()}"> 213 </option> 225 214 </select> 226 <button id="filter" type="submit">Filter</button> 227 </form> 215 216 </div> 217 <button class="button" type="submit">Filter</button> 218 </form> 228 219 229 220 </div> … … 234 225 <div class="card"> 235 226 <div class="imgBx"> 236 <img th:src=" @{${film.getUrl()}}"/>227 <img th:src=""/> 237 228 </div> 238 229 <div class="contentBx">
Note:
See TracChangeset
for help on using the changeset viewer.