added toggle for providers

pull/818/head
Yunus Emre Kalkan 6 years ago
parent 734534052a
commit d7ce35886d

@ -1,6 +1,8 @@
{
"culture": "en",
"texts": {
"Permissions": "Permissions"
"Permissions": "Permissions",
"OnlyProviderPermissons": "Only this provider",
"All": "All"
}
}

@ -1,6 +1,8 @@
{
"culture": "tr",
"texts": {
"Permissions": "İzinler"
"Permissions": "İzinler",
"OnlyProviderPermissons": "Sadece bu sağlayıcı",
"All": "Hepsi"
}
}

@ -19,22 +19,37 @@
<input asp-for="@Model.ProviderKey" />
<input asp-for="@Model.ProviderName" />
<abp-row>
<abp-column size-sm="_4">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
@for (var i = 0; i < Model.Groups.Count; i++)
{
<a class="nav-link @(i == 0 ? "active" : "")" id="v-pills-tab-@Model.Groups[i].GetNormalizedGroupName()" data-toggle="pill" href="#v-pills-@Model.Groups[i].GetNormalizedGroupName()" role="tab" aria-controls="v-pills-@Model.Groups[i].GetNormalizedGroupName()" aria-selected="false">@Model.Groups[i].DisplayName</a>
}
<abp-row h-align="End">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-light btn-sm @(Model.ShowOnlyProviderPermissons? "":"active")">
<input type="radio" value="0" name="ShowOnlyProviderPermissonsToggle" autocomplete="off"
@(Model.ShowOnlyProviderPermissons ? "" : "checked") /> @L["All"]
</label>
<label class="btn btn-light btn-sm @(!Model.ShowOnlyProviderPermissons? "":"active")">
<input type="radio" value="1" name="ShowOnlyProviderPermissonsToggle" autocomplete="off"
@(!Model.ShowOnlyProviderPermissons ? "" : "checked") /> @L["OnlyProviderPermissons"]
</label>
</div>
</abp-column>
<abp-column size-sm="_8">
<div class="tab-content" id="v-pills-tabContent">
</abp-row>
<abp-tabs tab-style="PillVertical" vertical-header-size="_4">
@for (var i = 0; i < Model.Groups.Count; i++)
{
<div class="tab-pane fade @(i == 0 ? "show active" : "")" id="v-pills-@Model.Groups[i].GetNormalizedGroupName()" role="tabpanel" aria-labelledby="v-pills-tab-@Model.Groups[i].GetNormalizedGroupName()">
var hideTabOnToggle = true;
@for (var j = 0; j < Model.Groups[i].Permissions.Count; j++)
{
if (!((Model.Groups[i].Permissions[j].Providers?.All(p => p.ProviderName != Model.ProviderName)) ?? true))
{
hideTabOnToggle = false;
break;
}
}
<abp-tab header-class="@(hideTabOnToggle?"hideTabOnToggle":"")" title="@Model.Groups[i].DisplayName" name="v-pills-tab-@Model.Groups[i].GetNormalizedGroupName()">
@for (var j = 0; j < Model.Groups[i].Permissions.Count; j++)
{
var hideCheckboxOnToggle = (Model.Groups[i].Permissions[j].Providers?.All(p => p.ProviderName != Model.ProviderName)) ?? true;
<div class="@(hideCheckboxOnToggle?"HideOnProviderToggle":"")">
<abp-input asp-for="@Model.Groups[i].Permissions[j].IsGranted"
label="@Model.Groups[i].Permissions[j].GetShownName(Model.ProviderName)"
disabled="@Model.Groups[i].Permissions[j].IsDisabled(Model.ProviderName)"
@ -42,12 +57,11 @@
group-data-parent-name="@(Model.Groups[i].Permissions[j].ParentName ?? "")"
group-style="margin-left: @(Model.Groups[i].Permissions[j].Depth * 20)px" />
<input asp-for="@Model.Groups[i].Permissions[j].Name" />
}
</div>
}
</div>
</abp-column>
</abp-row>
</abp-tab>
}
</abp-tabs>
</abp-modal-body>

@ -20,6 +20,9 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement
[BindProperty(SupportsGet = true)]
public string ProviderKey { get; set; }
[BindProperty(SupportsGet = true)]
public bool ShowOnlyProviderPermissons { get; set; } = false;
[BindProperty]
public List<PermissionGroupViewModel> Groups { get; set; }

@ -48,6 +48,17 @@
}
});
});
$('input:radio[name="ShowOnlyProviderPermissonsToggle"]').change(
function () {
if ($(this).val() == '1') {
$('.HideOnProviderToggle').slideUp();
$('.hideTabOnToggle').slideUp();
}
else {
$('.HideOnProviderToggle').slideDown();
$('.hideTabOnToggle').slideDown();
}
});
});
};
};

Loading…
Cancel
Save