View Area vs Feature Folders
This file contains 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
Areas seem to be like this out of the box: | |
/Areas | |
/Blog | |
/Controllers | |
BlogController.cs | |
/Views | |
Create.cshtml | |
... | |
Not like this, which is more like Feature Folders: |
View Index.cshtml
This file contains 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
<div is-visible="User.Identity.IsAuthenticated"> | |
This should only be visible if you're logged in | |
</div> |
View Index.cshtml
This file contains 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
@if (User.Identity.IsAuthenticated) | |
{ | |
<div> | |
This should only be visible if you're logged in | |
</div> | |
} |
View _ViewImports.cshtml
This file contains 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
@addTagHelper *, WebApplication1 |
View VisibilityTagHelper.cs
This file contains 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
// Add more target elements here on a new line if you want to target more than just div. Example: [HtmlTargetElement("a")] to hide/show links | |
[HtmlTargetElement("div")] | |
public class VisibilityTagHelper : TagHelper | |
{ | |
// default to true otherwise all existing target elements will not be shown, because bool's default to false | |
public bool IsVisible { get; set; } = true; | |
// You only need one of these Process methods, but just showing the sync and async versions | |
public override void Process(TagHelperContext context, TagHelperOutput output) | |
{ |
View jqueryFallback.cshtml
This file contains 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
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.2.min.js" | |
asp-fallback-src="~/lib/jquery/dist/jquery.min.js" | |
asp-fallback-test="window.jQuery"> | |
</script> |
View polyfillFetch.js
This file contains 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
window.Promise || document.write('<script src="https://unpkg.com/promise-polyfill@6.0.2"></script>') | |
window.fetch || document.write('<script src="https://unpkg.com/whatwg-fetch@2.0.2"></script>') |
View polyfillTagHelpers.cshtml
This file contains 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
<script asp-fallback-test="window.Promise" | |
asp-fallback-src="https://unpkg.com/promise-polyfill@6.0.2"> | |
</script> | |
<script asp-fallback-test="window.fetch" | |
asp-fallback-src="https://unpkg.com/whatwg-fetch@2.0.2"> | |
</script> |
View project.json
This file contains 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
{ | |
"dependencies": { | |
"Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design": { | |
"version": "1.1.0-preview4-final", | |
"type": "build" | |
} | |
}, | |
"tools": { | |
"Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools": "1.1.0-preview4-final" |
OlderNewer