-
Notifications
You must be signed in to change notification settings - Fork 56
Updates to display, editor and authz tag helpers #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MSingh-13
wants to merge
9
commits into
DamianEdwards:main
Choose a base branch
from
MSingh-13:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fd03960
Updated editor and display taghelpers to accept class and style attri…
MSingh-13 4d2de24
Updated AuthzTagHelper to handle authorizations based on permissions …
MSingh-13 ac55e3c
Incorporated PR feedback
MSingh-13 4a265d2
Updated samples to display source for asp-authz-permission and asp-au…
MSingh-13 fbdab70
Added a condition to guard against RequiredRoles and RequiredPolicy b…
MSingh-13 1ae3e04
Renamed the properties and attributes related to permission, to resou…
MSingh-13 60a8260
Simplified HtmlHelperExtensions.MergeHtmlAttributes()
MSingh-13 a107a8e
Refactored MergeHtmlAttributes method.
MSingh-13 c5428ac
Updated DisplayTagHelper and EditorTagHelper.
MSingh-13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "7.0.100", | ||
| "rollForward": "latestFeature", | ||
| "rollForward": "latestMajor", | ||
| "allowPrerelease": false | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
samples/TagHelperPack.Sample/Views/Shared/EditorTemplates/String3.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| @model string | ||
|
|
||
| @using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
|
|
||
| @{ | ||
| //default html attributes added by the template | ||
| var defaultHtmlAttributesObject = new | ||
| { | ||
| Class = "form-control", | ||
| style= "font-weight: bold" | ||
| }; | ||
|
|
||
| //merging the above html attributes with attributes received from the view | ||
| var viewHtmlAttributes = ViewData["htmlAttributes"] ?? new { }; | ||
| var mergedHtmlAttributes = Html.MergeHtmlAttributesObjects(viewHtmlAttributes, defaultHtmlAttributesObject); | ||
| } | ||
|
|
||
| @Html.TextBox("", Model, mergedHtmlAttributes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a guard to ensure invalid combinations of attributes aren't being set and throw an
InvalidOperationExceptionin that case, e.g. if both a required role and policy are set.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As suggested, I have added a condition to guard against RequiredRoles and RequiredPolicy being set at the same time.
See commit fbdab70