Update Edit on GitHub links to point to master

Summary:
We've been getting a lot of documentation PRs opened against `0.29-stable`, `0.30-stable`, and so on, instead of `master`. This is because our doc site is also based on RN release cuts, so clicking on the "Edit on GitHub" links on a document will take you to the markdown source for that release branch instead of the latest doc on `master`.

See #9095 for an example of such a PR.

In this PR we edit the link to say View on GitHub. Though it may not prevent PRs from being opened against a release branch, removing the "Edit" CTA may help in this regard.
Closes https://github.com/facebook/react-native/pull/9149

Differential Revision: D3664368

Pulled By: vjeux

fbshipit-source-id: 395c0813f736bfbe1be4b4fb1182f9060169365d
This commit is contained in:
Héctor Ramos
2016-08-03 17:37:13 -07:00
committed by Facebook Github Bot 4
parent 9fa4fe2fa5
commit 01cb1e4ef6
7 changed files with 82 additions and 66 deletions

View File

@@ -12,13 +12,8 @@
var H = require('Header');
var React = require('React');
function getVersionedGithubPath(path, version) {
version = version || 'next';
return [
'https://github.com/facebook/react-native/blob',
version === 'next' ? 'master' : version + '-stable',
path
].join('/');
function getGitHubPath(path) {
return 'https://github.com/facebook/react-native/blob/master/' + path;
}
var HeaderWithGithub = React.createClass({
@@ -40,7 +35,7 @@ var HeaderWithGithub = React.createClass({
<td style={{textAlign: 'right'}}>
<a
target="_blank"
href={getVersionedGithubPath(this.props.path, this.context.version)}>
href={getGitHubPath(this.props.path)}>
Edit on GitHub
</a>
</td>