Skip to content

Commit c4c3d0e

Browse files
committed
Improved documentation pages.
1 parent aebafbc commit c4c3d0e

File tree

11 files changed

+78
-61
lines changed

11 files changed

+78
-61
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ install:
3232
script:
3333
- |
3434
if [ "$TEST_TYPE" = build_website ]; then
35-
if [ "$TRAVIS_BRANCH" = "docs" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
35+
if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
3636
echo "Building the web."
3737
nvm install 4.0
3838

docs/css/main.styl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ a, a:hover
1919
a
2020
color rgb(42,93,173)
2121

22+
p
23+
margin-bottom 1em
24+
2225
html, body
2326
font-family "Helvetica Neue", Helvetica, Arial, sans-serif
2427
font-weight 300
@@ -283,6 +286,10 @@ $title
283286
border-radius 2px
284287
border 1px solid #CCC
285288
color #000
289+
p + p, p + ul
290+
margin-top -.4em
291+
p + ul
292+
margin-top -.6em
286293
code
287294
font-size 14px
288295
line-height 20px
@@ -295,16 +302,16 @@ $title
295302

296303
.title
297304
background: #F9F9F9;
298-
padding 54px 0
305+
padding 48px 0
299306

300307
h1
301308
margin 0 auto
302309
@extend $wrapper
303310
font-family: 'Raleway';
304-
font-size: 42px;
311+
font-size: 40px;
305312
font-weight 200
306313
color: #585858;
307-
line-height: 49px;
314+
line-height: 50px;
308315

309316
.docs
310317
@extend $wrapper
@@ -356,6 +363,7 @@ $title
356363
.docs-content
357364
col(3/4)
358365
margin-top 60px
366+
margin-bottom 20px
359367
+below(600px)
360368
margin-top 10px
361369
col(1)
@@ -364,3 +372,8 @@ $title
364372
margin 0
365373
@extend $title
366374
font-size 32px
375+
376+
.docs-next
377+
float right
378+
color #e05b49
379+
font-weight 400

docs/pages/community.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ active_tab: community
55
description: The biggest GraphQL Community in Python
66
---
77

8-
Graphene is constantly developing thanks to an active volunteer community, There are many different places where you discuss Graphene, share your experiences or ask for help. Your feedback and participation are very welcome!
8+
Graphene is constantly developing thanks to an active volunteer community, There are many different places where you discuss Graphene, share your experiences or ask for help. **Your feedback and participation are very welcome**!
99

1010
If you think working with Graphene is fun, there are many ways you can contribute to it. Please join us in the Slack community and help us shape the next generation API’s.
1111

@@ -21,6 +21,11 @@ Django integration:
2121
- **graphql-django-view**: [Source Code][5] - [PyPI package][6]
2222
- **django-graphiql**: [Source Code][7] - [PyPI package][8]
2323

24+
## Other related projects
25+
26+
- [Flask GraphQL Demo](https://github.com/amitsaha/flask-graphql-demo) by [@echorand](https://twitter.com/echorand)
27+
28+
2429
[Source Code]: https://github.com/graphql-python/graphql-core
2530
[PyPI package]: https://pypi.python.org/pypi/graphql-core
2631
[1]: https://github.com/graphql-python/graphql-relay

docs/pages/docs/_template.js

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,41 @@ class Template extends React.Component {
1010
render() {
1111
var docs = this.props.config.docs;
1212
var docs_index = _.indexBy(this.props.pages, 'path');
13-
return (
14-
<div className="docs">
15-
<aside className="docs-aside">
16-
{Object.keys(docs).map((key) => {
17-
let group = docs[key];
18-
return <div className="docs-aside-group" key={key}>
19-
<h3>{group.name}</h3>
20-
{group.pages.map((page) => {
21-
return <Link key={page} to={page}>{docs_index[page].data.title}</Link>
22-
})}
23-
</div>;
13+
var pages = [];
14+
var aside_links = Object.keys(docs).map((key) => {
15+
let group = docs[key];
16+
return <div className="docs-aside-group" key={key}>
17+
<h3>{group.name}</h3>
18+
{group.pages.map((page) => {
19+
pages.push(page)
20+
return <Link key={page} to={page}>{docs_index[page].data.title}</Link>
21+
})}
22+
</div>;
23+
});
24+
var aside_options = Object.keys(docs).map((key) => {
25+
let group = docs[key];
26+
return <optgroup key={key} label={group.name}>
27+
{group.pages.map((page) => {
28+
return <option key={page} value={page}>{docs_index[page].data.title}</option>
2429
})}
25-
<select className="docs-aside-navselect" onChange={this.goToPage.bind(this)}>
26-
{Object.keys(docs).map((key) => {
27-
let group = docs[key];
28-
return <optgroup key={key} label={group.name}>
29-
{group.pages.map((page) => {
30-
return <option key={page} value={page}>{docs_index[page].data.title}</option>
31-
})}
32-
</optgroup>;
33-
})}
34-
</select>
35-
</aside>
36-
<div className="docs-content">
37-
<RouteHandler {...this.props} docs={true}/>
30+
</optgroup>;
31+
});
32+
var next_page_index = pages.indexOf(this.props.page.path)+1;
33+
var next_page = pages[next_page_index];
34+
return (
35+
<div>
36+
<div className="title"><h1>Documentation</h1></div>
37+
<div className="docs">
38+
<aside className="docs-aside">
39+
{aside_links}
40+
<select className="docs-aside-navselect" onChange={this.goToPage.bind(this)}>
41+
{aside_options}
42+
</select>
43+
</aside>
44+
<div className="docs-content">
45+
<RouteHandler {...this.props} docs={true}/>
46+
{next_page?<Link className="docs-next" to={next_page}>Next - {docs_index[next_page].data.title}</Link>:null}
47+
</div>
3848
</div>
3949
</div>
4050
);

docs/pages/docs/basic-types.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,23 @@ class DateTime(Scalar):
6262

6363
This types if are mounted in a `ObjectType`, `Interface` or `Mutation`,
6464
would act as `Field`s.
65-
So, the following examples will behave exactly the same:
6665

6766
```python
6867
class Person(graphene.ObjectType):
6968
name = graphene.String()
70-
```
71-
and
7269

73-
```python
70+
# Is equivalent to:
7471
class Person(graphene.ObjectType):
7572
name = graphene.Field(graphene.String())
7673
```
7774

7875
## Mounting in Fields
7976

80-
If this types are mounted in a `Field`, would act as `Argument`s.
81-
So, the following examples will behave exactly the same:
77+
If the types are mounted in a `Field`, would act as `Argument`s.
8278

8379
```python
8480
graphene.Field(graphene.String(), to=graphene.String())
85-
```
86-
and
8781

88-
```python
82+
# Is equivalent to:
8983
graphene.Field(graphene.String(), to=graphene.Argument(graphene.String()))
9084
```

docs/pages/docs/interfaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Walkthrough Interfaces
88
An Interface contains the essential fields that will be shared among multiple ObjectTypes.
99

1010
The basics:
11-
- Each Interface is a Python class that inherits from graphene.Interface.
11+
- Each Interface is a Python class that inherits from `graphene.Interface`.
1212
- Each attribute of the Interface represents a GraphQL field.
1313

1414
## Quick example

docs/pages/docs/objecttypes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Walkthrough ObjectTypes
88
An ObjectType is the single, definitive source of information about your data. It contains the essential fields and behaviors of the data you’re querying.
99

1010
The basics:
11-
- Each ObjectType is a Python class that inherits graphene.ObjectType or inherits an implemented [Interface](/docs/interfaces/).
11+
- Each ObjectType is a Python class that inherits `graphene.ObjectType` or inherits an implemented [Interface](/docs/interfaces/).
1212
- Each attribute of the ObjectType represents a GraphQL field.
1313

1414
## Quick example

docs/pages/docs/quickstart-django.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
2-
title: Guide to Django
2+
title: Django Tutorial
33
description: A Quick guide to Graphene in Django
44
---
55

6+
# Django Tutorial
7+
68
In our previous quickstart page we created a very simple schema.
7-
Now we will adapt the schema to map automatically some Django models.
9+
10+
Now we will adapt the schema to map automatically some Django models,
11+
and expose this schema in a `/graphql` API endpoint.
812

913
## Project setup
1014

@@ -54,7 +58,7 @@ from graphene.contrib.django import DjangoObjectType
5458

5559
from django.contrib.auth.models import User, Group
5660

57-
# Graphene will map automaticall the User model to UserType with
61+
# Graphene will map automatically the User model to UserType with
5862
# the specified fields
5963
class UserType(DjangoObjectType):
6064
class Meta:

docs/pages/docs/quickstart.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Getting started
33
description: A Quick guide to Graphene
44
---
55

6+
# Getting started
7+
68
Let's build a basic GraphQL schema from scratch.
79

810

@@ -15,15 +17,6 @@ Let's build a basic GraphQL schema from scratch.
1517
## Project setup
1618

1719
```bash
18-
# Create the project directory
19-
mkdir tutorial
20-
cd tutorial
21-
22-
# Create a virtualenv to isolate our package dependencies locally
23-
virtualenv env
24-
source env/bin/activate # On Windows use `env\Scripts\activate`
25-
26-
# Install Graphene
2720
pip install graphene
2821
```
2922

docs/pages/index.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ path: /
33
---
44
<div><a class="starwars-example" href="http://swapi.graphene-python.org/">Check our Django Starwars API example!</a></div>
55

6-
## About Graphene
6+
## Meet Graphene
77

88
Graphene is a Python library for building GraphQL schemas/types fast and easily.
99

10-
**What is GraphQL?** A GraphQL query is a string interpreted by a server that returns data in a specified format.
11-
12-
- **Easy to use:** Graphene helps you use GraphQL in Python without effort.
13-
- **Relay:** Graphene has builtin support for Relay
14-
- **Django:** Automatic *Django model* mapping to Graphene Types.
10+
**But, what is GraphQL?** A GraphQL query is a string interpreted by a server that returns data in a specified format. We believe *GraphQL* is the next big thing after peanut butter and *REST*.

0 commit comments

Comments
 (0)