added toggle for providers

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

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

@ -1,6 +1,8 @@
{ {
"culture": "tr", "culture": "tr",
"texts": { "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.ProviderKey" />
<input asp-for="@Model.ProviderName" /> <input asp-for="@Model.ProviderName" />
<abp-row> <abp-row h-align="End">
<abp-column size-sm="_4"> <div class="btn-group btn-group-toggle" data-toggle="buttons">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical"> <label class="btn btn-light btn-sm @(Model.ShowOnlyProviderPermissons? "":"active")">
@for (var i = 0; i < Model.Groups.Count; i++) <input type="radio" value="0" name="ShowOnlyProviderPermissonsToggle" autocomplete="off"
{ @(Model.ShowOnlyProviderPermissons ? "" : "checked") /> @L["All"]
<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> </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> </div>
</abp-column> </abp-row>
<abp-column size-sm="_8">
<div class="tab-content" id="v-pills-tabContent"> <abp-tabs tab-style="PillVertical" vertical-header-size="_4">
@for (var i = 0; i < Model.Groups.Count; i++) @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++) @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" <abp-input asp-for="@Model.Groups[i].Permissions[j].IsGranted"
label="@Model.Groups[i].Permissions[j].GetShownName(Model.ProviderName)" label="@Model.Groups[i].Permissions[j].GetShownName(Model.ProviderName)"
disabled="@Model.Groups[i].Permissions[j].IsDisabled(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-data-parent-name="@(Model.Groups[i].Permissions[j].ParentName ?? "")"
group-style="margin-left: @(Model.Groups[i].Permissions[j].Depth * 20)px" /> group-style="margin-left: @(Model.Groups[i].Permissions[j].Depth * 20)px" />
<input asp-for="@Model.Groups[i].Permissions[j].Name" /> <input asp-for="@Model.Groups[i].Permissions[j].Name" />
}
</div> </div>
} }
</div> </abp-tab>
</abp-column> }
</abp-row> </abp-tabs>
</abp-modal-body> </abp-modal-body>

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