-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
if (Action != null || Controller != null || Route != null) | ||
{ | ||
// User specified an href AND a Action, Controller or Route; can't determine the href attribute. | ||
throw new InvalidOperationException( |
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.
I think we shouldn't throw here.
example - The a tag is populated by javascript based on the id tag.
so instead do nothing?
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.
+1 this is another case where, like "controller" and "route-value" in the <form/>
helper, we should be consistent. I agree we shouldn't second-guess the users's intent when they force the tag helper to no-op.
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.
Talked in person.
8f2cdfb
to
8c441bf
Compare
ee5f9ca
to
9626739
Compare
Addressed comments that didn't have a pending question. |
@@ -117,6 +117,12 @@ | |||
<resheader name="writer"> | |||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
<data name="AnchorTagHelper_CannotDetermineHrefOneSpecified" xml:space="preserve"> | |||
<value>Cannot determine an href for {0}. {0}s with a specified href must not have a {1}, {2} or {3} attribute.</value> |
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.
I know it's just a design PR, but: recommend passing in href
as a parameter to the string. And also recommend not pluralizing the {0}s
in the second sentence, and instead saying A {0} with a specified...
9626739
to
761faf8
Compare
Addressed comments. |
c908f03
to
14cf681
Compare
761faf8
to
7d0d910
Compare
Added tests. |
14cf681
to
07f8dda
Compare
7d0d910
to
917d849
Compare
/// <summary> | ||
/// The name of the action method. | ||
/// </summary> | ||
/// <remarks>Cannot be provided if <see cref="Route"/> is specified.</remarks> |
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.
nit: reword these "cannot" <remarks/>
to avoid passive voice: Must be <c>null</c> if <see cref="Route"/> is non-<c>null</c>.
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.
(hmm, updated comment is slightly passive but at least is in terms of the properties here and not some random "specifier".)
⌚ and if I missed some form-related comments, assume they apply here as well |
07f8dda
to
8b55118
Compare
917d849
to
af663a3
Compare
8b55118
to
c0b944d
Compare
af663a3
to
88eb37e
Compare
Addressed code review comments & tests. |
c0b944d
to
ffdae80
Compare
88eb37e
to
be195a9
Compare
public string Route { get; set; } | ||
|
||
/// <inheritdoc /> | ||
/// <remarks>Does nothing if user provides an "href" attribute. Cannot specify an "href" attribute AND |
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.
don't yell
ffdae80
to
4d221a1
Compare
be195a9
to
0a09f0b
Compare
Addressed code review comments. |
4d221a1
to
b275566
Compare
0a09f0b
to
a73f0a5
Compare
public string Protocol { get; set; } | ||
|
||
/// <summary> | ||
/// The host name for the URL. |
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.
teensy nit: leave off "for the URL" to be consistent w/ the other properties
⌚ for the restore some / throw on others follow-up |
b275566
to
011447d
Compare
a73f0a5
to
4642fbf
Compare
Addressed code review comments. |
Fragment != null || | ||
routePrefixedAttributes.Any()) | ||
{ | ||
// User specified an href AND a Action, Controller or Route; can't determine the href attribute. |
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.
nits:
- don't yell
- remove list of attributes (it's incomplete): just "one of the bound attributes"
|
- Added a TagHelper that targets the <a> tag and allows users to do the equivalent of Html.ActionLink or Html.RouteLink. - Added tests to validate AnchorTagHelper functionality. #1247
011447d
to
3e2c256
Compare
4642fbf
to
e494f83
Compare
Tag Helpers:
<a/>
tag helper #1247