Point "View page source" link to the git source file of the current page
ClosedPublic

Authored by richardbowen on Mar 28 2018, 7:12 PM.

Details

Summary

Point the "View page source" link on the current page to its source file in the Phabricator git repository

Diff Detail

Repository
R985 KDE Human Interface Guidelines
Branch
arcpatch-D11769
Lint
No Linters Available
Unit
No Unit Test Coverage
richardbowen requested review of this revision.Mar 28 2018, 7:12 PM
richardbowen created this revision.
richardbowen retitled this revision from Reset "View page source" to file in the git repo to Reset "View page source" link to page's source file in the git repo.Mar 28 2018, 7:16 PM
richardbowen retitled this revision from Reset "View page source" link to page's source file in the git repo to Point "View page source" link to the git source file of the current page.Mar 28 2018, 11:09 PM
richardbowen edited the summary of this revision. (Show Details)
richardbowen updated this revision to Diff 30826.EditedMar 29 2018, 3:23 AM

Fix some bugs, refactor and clean up code

  • Remove unused code.
  • Because the root path "/" points to "/index.html", we set the root path to always be "/index.html".
  • Also exclude the "/" at the beginning of the newPath for non-root paths.
  • Change the wording in the function description.
  • Add return statement within the if block to end execution after "View page source" link is updated, and return the URL for the page's source file in Phabricator (useful for debugging).
This comment was removed by richardbowen.

Remove a word from a comment

fabianr added inline comments.Apr 4 2018, 3:49 PM
source/_static/js/custom.js
16

Why are you returning the href? The return value is not used anywhere.

richardbowen added a comment.EditedApr 4 2018, 4:10 PM

I thought it was a useful addition to show the link to the page's Phabricator repo in the js console. It's either that or return nothing.

fabianr accepted this revision.Apr 4 2018, 4:11 PM
This revision is now accepted and ready to land.Apr 4 2018, 4:11 PM
fabianr closed this revision.Apr 5 2018, 12:57 PM