From 01cb1e4ef679dae822e0780331b8c5ef8aab43ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Wed, 3 Aug 2016 17:37:13 -0700 Subject: [PATCH] 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 --- .github/PULL_REQUEST_TEMPLATE.md | 2 - CONTRIBUTING.md | 2 +- website/core/Footer.js | 28 ++++++++ website/core/HeaderWithGithub.js | 11 +--- website/layout/AutodocsLayout.js | 29 ++++---- website/layout/DocsLayout.js | 10 ++- website/src/react-native/css/react-native.css | 66 ++++++++++--------- 7 files changed, 82 insertions(+), 66 deletions(-) create mode 100644 website/core/Footer.js diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e66cdff2e7..7da24f0944 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,8 +2,6 @@ Thanks for submitting a pull request! Please provide enough information so that > **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.** -(You can skip this if you're fixing a typo or adding an app to the Showcase.) - Explain the **motivation** for making this change. What existing problem does the pull request solve? Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3c08db03db..53f7c5c889 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ The core team will be monitoring for pull requests. When we get one, we'll run s 1. Fork the repo and create your branch from `master`. 2. **Describe your test plan in your commit.** If you've added code that should be tested, add tests! 3. If you've changed APIs, update the documentation. -4. If you've updated the docs, verify the website locally and submit screenshots if applicable +4. If you've updated the docs, verify the website locally and submit screenshots if applicable. ``` $ cd website diff --git a/website/core/Footer.js b/website/core/Footer.js new file mode 100644 index 0000000000..516b178d64 --- /dev/null +++ b/website/core/Footer.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule Footer + */ + +var React = require('React'); + +function getGitHubPath(path) { + return 'https://github.com/facebook/react-native/blob/master/' + path; +} + +var Footer = React.createClass({ + render: function() { + return ( +

+ You can edit the content above on GitHub and send us a pull request! +

+ ); + } +}); + +module.exports = Footer; diff --git a/website/core/HeaderWithGithub.js b/website/core/HeaderWithGithub.js index 601051c7e3..c8e87770ce 100644 --- a/website/core/HeaderWithGithub.js +++ b/website/core/HeaderWithGithub.js @@ -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({ + href={getGitHubPath(this.props.path)}> Edit on GitHub diff --git a/website/layout/AutodocsLayout.js b/website/layout/AutodocsLayout.js index 33351016b0..7ff3280a80 100644 --- a/website/layout/AutodocsLayout.js +++ b/website/layout/AutodocsLayout.js @@ -12,9 +12,9 @@ 'use strict'; var DocsSidebar = require('DocsSidebar'); -var H = require('Header'); var Header = require('Header'); var HeaderWithGithub = require('HeaderWithGithub'); +var Footer = require('Footer'); var Marked = require('Marked'); var Prism = require('Prism'); var React = require('React'); @@ -331,7 +331,7 @@ var ComponentDoc = React.createClass({ } return ( - Methods +
Methods
{methods.filter((method) => { return method.name[0] !== '_'; @@ -362,7 +362,7 @@ var ComponentDoc = React.createClass({ } return ( - Type Definitions +
Type Definitions
{typedefs.map((typedef) => { return this.renderTypeDef(typedef, namedTypes); @@ -381,7 +381,7 @@ var ComponentDoc = React.createClass({ {content.description} - Props +
Props
{this.renderProps(content.props, content.composes)} {this.renderMethods(content.methods, namedTypes)} {this.renderTypeDefs(content.typedef, namedTypes)} @@ -413,7 +413,7 @@ var APIDoc = React.createClass({ } return ( - Methods +
Methods
{methods.filter((method) => { return method.name[0] !== '_'; @@ -447,7 +447,7 @@ var APIDoc = React.createClass({ } return ( - Properties +
Properties
{properties.filter((property) => { return property.name[0] !== '_'; @@ -508,7 +508,7 @@ var APIDoc = React.createClass({ } return ( - Type Definitions +
Type Definitions
{typedefs.map((typedef) => { return this.renderTypeDef(typedef, namedTypes); @@ -835,13 +835,11 @@ var Autodocs = React.createClass({ } return (
- +
Description
{docs.fullDescription} +
); }, @@ -876,7 +874,7 @@ var Autodocs = React.createClass({ return (
- {(docs.examples.length > 1) ? Examples : null} + {(docs.examples.length > 1) ?
Examples
: null} {docs.examples.map(example => this.renderExample(example, metadata))}
); @@ -895,12 +893,9 @@ var Autodocs = React.createClass({
- +
{metadata.title}
{content} +