Cypal.TagHelpers
1.0.0
dotnet add package Cypal.TagHelpers --version 1.0.0
NuGet\Install-Package Cypal.TagHelpers -Version 1.0.0
<PackageReference Include="Cypal.TagHelpers" Version="1.0.0" />
<PackageVersion Include="Cypal.TagHelpers" Version="1.0.0" />
<PackageReference Include="Cypal.TagHelpers" />
paket add Cypal.TagHelpers --version 1.0.0
#r "nuget: Cypal.TagHelpers, 1.0.0"
#:package Cypal.TagHelpers@1.0.0
#addin nuget:?package=Cypal.TagHelpers&version=1.0.0
#tool nuget:?package=Cypal.TagHelpers&version=1.0.0
Cypal ASP Utils: Tag-Helpers
Role based authorization is a powerful model in ASP Core to restrict who does what. This is applied at a Razor Page or Controller level. There is no simpler way of providing the similar access to individual controls. This library aims to provide Role based controlls for the individual form fields.
Overview
The form fields are created with Razor's Tag Helpers. This library adds two features show/hide and edit/read-only features for the form fields.
Installation
This library is available as a NuGet package. You can install it using the NuGet Package Console window:
PM> Install-Package Cypal.TagHelpers
No other initialization is required.
Usage
Show/Hide
Showing or hiding based on the Roles will be done on the div/ul/li/span elements.
<li class="nav-item" asp-shown-for="Admin,Developer">
<a asp-page="/AdminDashboard/Index" class="nav-link">Admin Dashboard</a>
</li>
<div class="form-group" asp-hidden-for="DataEntryOperator">
<label asp-for="Model.SomeField"></label>
<input asp-for="Model.SomeField" class="form-control">
<span asp-validation-for="Model.SomeField" class="text-danger"></span>
</div>
Edit/Read-Only
Editing or Read-Only is applicable for form field elements.
<div class="form-group ">
<label asp-for="Model.SomeField"></label>
<input asp-for="Model.SomeField" class="form-control" asp-editable-for="Admin" >
<span asp-validation-for="Model.SomeField" class="text-danger"></span>
</div>
<div class="form-group ">
<label asp-for="Model.SomeField"></label>
<input asp-for="Model.SomeField" class="form-control" asp-readonly-for="OfficeStaff" >
<span asp-validation-for="Model.SomeField" class="text-danger"></span>
</div>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.ViewFeatures (>= 2.2.0)
- Microsoft.AspNetCore.Razor (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 4,097 | 4/1/2020 |