Browse Source

Merge pull request #18863 from abpframework/salihozkara/docs

Fix: Selects on docs shrinks to unusable sizes on mobile
pull/18891/head
Gizem Mutu Kurt 2 years ago
committed by GitHub
parent
commit
77fd143a22
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 56
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml

56
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml

@ -332,28 +332,46 @@
</abp-column>
</abp-row>
<abp-row class="gx-2">
@foreach (var parameter in Model.DocumentPreferences.Parameters)
{
<div class="col">
<div class="custom-input-group">
<span class="input-group-text" id="@("Section" + parameter.Name + "ComboboxAddonId")">@(parameter.DisplayName)</span>
<select class="doc-section-combobox form-select"
aria-describedby="@("Section" + parameter.Name + "ComboboxAddonId")"
id="@("Section" + parameter.Name + "ComboboxId")" data-key="@parameter.Name">
@foreach (var value in parameter.Values.OrderBy(p => p.Value))
{
@if (value.Key == (Model.UserPreferences.ContainsKey(parameter.Name) ? Model.UserPreferences[parameter.Name] : null))
{
<option value="@value.Key" selected="selected">@value.Value</option>
}
else
@{
const int maxCellCount = 3;
var count = Model.DocumentPreferences.Parameters.Count;
var rowCount = count / maxCellCount + (count % maxCellCount > 0 ? 1 : 0);
var cellSize = 12 / (count > maxCellCount ? maxCellCount : count);
var latestCellSize = 12 / count - (rowCount - 1) * maxCellCount;
string BuildParameterDivClass(int index)
{
var row = index / maxCellCount;
var isLastRow = row == rowCount - 1;
var currentCellSize = isLastRow ? latestCellSize : cellSize;
return $"col-12 col-lg-{currentCellSize} mb-lg-{(isLastRow ? "0" : "2")} {(index == count - 1 ? "" : "mb-2")}";
}
for (var i = 0; i < count; ++i)
{
var parameter = Model.DocumentPreferences.Parameters[i];
<div class="@BuildParameterDivClass(i)">
<div class="custom-input-group">
<span class="input-group-text" id="@("Section" + parameter.Name + "ComboboxAddonId")">@(parameter.DisplayName)</span>
<select class="doc-section-combobox form-select"
aria-describedby="@("Section" + parameter.Name + "ComboboxAddonId")"
id="@("Section" + parameter.Name + "ComboboxId")" data-key="@parameter.Name">
@foreach (var value in parameter.Values.OrderBy(p => p.Value))
{
<option value="@value.Key">@value.Value</option>
@if (value.Key == (Model.UserPreferences.ContainsKey(parameter.Name) ? Model.UserPreferences[parameter.Name] : null))
{
<option value="@value.Key" selected="selected">@value.Value</option>
}
else
{
<option value="@value.Key">@value.Value</option>
}
}
}
</select>
</select>
</div>
</div>
</div>
}
}
</abp-row>
</div>

Loading…
Cancel
Save