|
6 | 6 | var userConfig = config.GetUserConfig(User); |
7 | 7 | var userLanguage = userConfig.UserLanguage; |
8 | 8 | var recordTags = Model.SelectMany(x => x.Tags).Distinct(); |
| 9 | + var tagsExist = recordTags.Any(); |
| 10 | + var searchExist = userConfig.ShowSearch && Model.Count() > 1; |
| 11 | + var renderTopRow = tagsExist || searchExist; |
9 | 12 | } |
10 | | -@if (recordTags.Any()) |
| 13 | +@if (renderTopRow) |
11 | 14 | { |
12 | 15 | <div class='row'> |
13 | | - <div class="col-xl-10 col-lg-9 col-md-8 col-sm-8 col-12 d-flex align-items-center flex-wrap mb-2"> |
14 | | - @foreach (string recordTag in recordTags) |
15 | | - { |
16 | | - <span onclick="filterGarage(this)" class="user-select-none ms-1 me-1 mt-1 mb-1 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span> |
17 | | - } |
18 | | - <datalist id="tagList"> |
| 16 | + @if (tagsExist) |
| 17 | + { |
| 18 | + <div class="@(searchExist ? "col-xl-10 col-lg-9 col-md-8 col-sm-8" : "") col-12 d-flex align-items-center flex-wrap mb-2"> |
19 | 19 | @foreach (string recordTag in recordTags) |
20 | 20 | { |
21 | | - <!option value="@recordTag"></!option> |
| 21 | + <span onclick="filterGarage(this)" class="user-select-none ms-1 me-1 mt-1 mb-1 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span> |
22 | 22 | } |
23 | | - </datalist> |
24 | | - </div> |
25 | | - <div class="col-xl-2 col-lg-3 col-md-4 col-sm-4 col-12 pt-2 pb-2"> |
26 | | - <div class="input-group"> |
27 | | - <input type="text" id="garageSearchInput" class="form-control" onkeyup="handleGarageSearchKeyPress(event)" placeholder="@translator.Translate(userLanguage, "Search")" /> |
28 | | - <button type="button" class="btn btn-outline-secondary" onclick="searchGarage()"><i class="bi bi-search"></i></button> |
| 23 | + <datalist id="tagList"> |
| 24 | + @foreach (string recordTag in recordTags) |
| 25 | + { |
| 26 | + <!option value="@recordTag"></!option> |
| 27 | + } |
| 28 | + </datalist> |
29 | 29 | </div> |
30 | | - </div> |
| 30 | + } |
| 31 | + @if (searchExist) |
| 32 | + { |
| 33 | + <div class="@(tagsExist ? "col-xl-2 col-lg-3 col-md-4 col-sm-4" : "") col-12 pt-2 pb-2"> |
| 34 | + <div class="input-group"> |
| 35 | + <input type="text" id="garageSearchInput" class="form-control" onkeyup="handleGarageSearchKeyPress(event)" placeholder="@translator.Translate(userLanguage, "Search")" /> |
| 36 | + <button type="button" class="btn btn-outline-secondary" onclick="searchGarage()"><i class="bi bi-search"></i></button> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + } |
31 | 40 | </div> |
32 | 41 | } |
33 | | - <div class="row gy-3 align-items-stretch vehiclesContainer pb-2 @(recordTags.Any() ? "" : "mt-2")"> |
| 42 | +<div class="row gy-3 align-items-stretch vehiclesContainer pb-2 @(renderTopRow ? "" : "mt-2")"> |
34 | 43 | @foreach (VehicleViewModel vehicle in Model) |
35 | 44 | { |
36 | 45 | @if (!(userConfig.HideSoldVehicles && !string.IsNullOrWhiteSpace(vehicle.SoldDate))) |
|
0 commit comments