Repository navigation
feat(aio): add "suggest edits" feature to all docs #24378
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e02a12c
feat(docs-infra): add "suggest edits" feature to all docs
martinsik 1b1d5c1
fix(docs-infra): show "suggest edits" only for /guide and /tutorial dirs
martinsik 3c355f9
refactor(docs-infra): refactor templates
martinsik 18d047f
test(docs-infra): test that the "suggest edit" buttons are visible wh…
martinsik 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
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 was deleted.
Oops, something went wrong.
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,4 +1,12 @@ | ||
| {% import "lib/githubLinks.html" as github -%} | ||
|
|
||
| {% set relativePath = doc.fileInfo.relativePath %} | ||
| {% if doc.title %}{$ ('# ' + doc.title.trim()) | marked $}{% endif %} | ||
| {% if 'guide/' in relativePath or 'tutorial/' in relativePath or 'docs.md' in relativePath %} | ||
| <div class="github-links"> | ||
| {$ github.githubEditLink(doc, versionInfo) $} | ||
| </div> | ||
| {% endif %} | ||
| <div class="content"> | ||
| {$ doc.description | marked $} | ||
| </div> | ||
| </div> |
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,31 @@ | ||
| {% macro projectRelativePath(fileInfo) -%} | ||
| {$ fileInfo.realProjectRelativePath if fileInfo.realProjectRelativePath else fileInfo.projectRelativePath $} | ||
| {%- endmacro %} | ||
|
|
||
| {% macro githubViewHref(doc, versionInfo) -%} | ||
| https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/packages/{$ doc.fileInfo.realProjectRelativePath $}#L{$ doc.startingLine + 1 $}-L{$ doc.endingLine + 1 $} | ||
| {%- endmacro %} | ||
|
|
||
| {% macro githubEditHref(doc, versionInfo) -%} | ||
| https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/edit/master{$ '/packages' if doc.docType !== 'content' $}/{$ projectRelativePath(doc.fileInfo) $}?message=docs | ||
| {%- if doc.moduleDoc %}({$ doc.moduleDoc.id.split('/')[0] $}) | ||
| {%- elseif doc.docType === 'module' %}({$ doc.id.split('/')[0] $}) | ||
| {%- elseif doc.docType === 'content' %} | ||
| {%- else %}(...){%- endif -%} | ||
| %3A%20describe%20your%20change...{% if doc.docType !== 'content' %}#L{$ doc.startingLine + 1 $}-L{$ doc.endingLine + 1 $}{% endif %} | ||
| {%- endmacro %} | ||
|
|
||
| {% macro githubEditLink(doc, versionInfo) -%} | ||
| <a href="{$ githubEditHref(doc, versionInfo) $}" aria-label="Suggest Edits" title="Suggest Edits"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a> | ||
| {%- endmacro %} | ||
|
|
||
| {% macro githubViewLink(doc, versionInfo) -%} | ||
| <a href="{$ githubViewHref(doc, versionInfo) $}" aria-label="View Source" title="View Source"><i class="material-icons" aria-hidden="true" role="img">code</i></a> | ||
| {%- endmacro %} | ||
|
|
||
| {% macro githubLinks(doc, versionInfo) -%} | ||
| <div class="github-links"> | ||
| {$ githubEditLink(doc, versionInfo) $} | ||
| {$ githubViewLink(doc, versionInfo) $} | ||
| </div> | ||
| {%- endmacro -%} |
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
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.
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.
If this feature will be released, some angular.io localization sites (at least our angular.jp) will customize it to jump to its own repository.
So I want this specs not to depend on
angular/angularrepository.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.
@lacolaco The same regexps are already used to test API's buttons:
https://github.com/angular/angular/blob/master/aio/tests/e2e/api.e2e-spec.ts#L60-L68
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.
Exactly. After I've send the above comment, I found it's e2e testing so it doesn't affect to build aio. Sorry, and thank you. 🙌