Skip to content

Commit

Permalink
общий шаблон для фильтрации и отображения
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachernyakova committed Dec 11, 2024
1 parent ac16835 commit 370a41b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 43 deletions.
32 changes: 31 additions & 1 deletion citywalls2/views/streets.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,36 @@
<body>
<h1><%= title %></h1>

<!-- Форма фильтрации -->
<form action="/main/streets" method="GET">
<div class="filters">
<!-- Фильтр по типу -->
<div>
<label for="type">Введите тип:</label><br>
<select id="type" name="type">
<option value="">Все</option>
<% types.forEach(function(type) { %>
<option value="<%= type %>" <%= filters.type === type ? 'selected' : '' %>><%= type %></option>
<% }); %>
</select>
</div>

<!-- Фильтр по району -->
<div>
<label for="district">Введите район:</label><br>
<select id="district" name="district">
<option value="">Все</option>
<% districts.forEach(function(district) { %>
<option value="<%= district %>" <%= filters.district === district ? 'selected' : '' %>><%= district %></option>
<% }); %>
</select>
</div>
</div>

<button type="submit" class="button">Применить фильтры</button>
</form>

<!-- Список улиц -->
<% if (!streets || streets.length === 0) { %>
<p>Нет улиц подходящих под ваш фильтр.</p>
<% } else { %>
Expand All @@ -23,6 +53,6 @@
</ul>
<% } %>

<a href="/main/streets">Назад к фильтрам</a>
<a href="/main">На главную</a>
</body>
</html>
42 changes: 0 additions & 42 deletions citywalls2/views/streets_filter.ejs

This file was deleted.

0 comments on commit 370a41b

Please sign in to comment.