Skip to content

Commit 8cfe329

Browse files
committed
minor edits to Controller docs
1 parent d00bb3b commit 8cfe329

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

_controller/action.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ module.exports = {
1515
};
1616
```
1717

18-
The example above will have add the `index` action to the `users_controller`. To hookup the controller's action to a route simply add `addRoute('/users', 'users#index')` to the [app/routes.js](/router#routes.js) file.
18+
The example above will add the `index` action to the `users_controller`. To connect the controller's action to a route, simply add `addRoute('/users', 'users#index')` to the [app/routes.js](/router#routes.js) file.

_controller/name.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
header: name
33
---
44

5-
All controllers are required to have the `_controller.js` post-fix. The name of the controller is the filename before the post-fix.
5+
All controllers are required to have the `_controller.js` postfix. The name of the controller is the filename before the postfix.
66

7-
For example: `users_controller.js` has the name `users`.
7+
For example: `users_controller.js` has the name `users`.
88

9-
This is a convention, and doesn't actually have an attribute stored, the [router](/router) uses it to generate the handler in [addRouteDefinition](/router#addRouteDefinition).
9+
The [router](/router) uses this naming convention to generate the handler in [addRouteDefinition](/router#addRouteDefinition), but a `name` attribute isn't actually stored.

controller/index.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ title: Controller - RendrJS
55

66
# Controller
77

8-
Controllers are an addition to Rendr that doesn't exist in Backbone. Controllers allow us to have a cleaner [router](/router). Controllers define functions that the router will invoke when a URL is visited. The functions that are invoked are called [actions](#action).
8+
Controllers are an addition to Rendr that do not exist in Backbone. Controllers define functions (known as [actions](#action)) that the [router](/router) will invoke when a URL is visited. This allows us to have a cleaner router.
99

10-
Controllers have no base class, as they are simply objects where the values are functions. Simply create files in the `controllers/` directory of your application and follow the naming convention: `<name>_controller.js`. The [name](#name) is how the router will know which file to open. The keys of the object being exported are the [actions](#action) for a controller.
10+
Controllers have no base class, as they are simply objects containing functions. Simply create files in the `controllers/` directory of your application and follow the naming convention: `<name>_controller.js`. The [name](#name) is how the router will know which file to open. The keys of the object being exported are the [actions](#action) for a controller.
1111

1212
Example Controller:
1313

1414
```js
15-
// contollers/users_controller.js
15+
// controllers/users_controller.js
1616
module.exports = {
1717
index: function(params, callback) {
1818
var spec = {
@@ -44,9 +44,9 @@ module.exports = {
4444
};
4545
```
4646

47-
The above example creates a controller with two actions, `index` and `show`. The `index` action will simply display all the users, and the `show` action will show a specific user, by their id.
47+
The above example creates a controller with two actions, `index` and `show`. The `index` action will display all the users, and the `show` action will show a specific user by their id.
4848

49-
The example's matching [routes.js](/router#routes.js) file:
49+
Example [routes.js](/router#routes.js) file:
5050

5151
```js
5252
module.exports = function(addRoute) {
@@ -55,7 +55,7 @@ module.exports = function(addRoute) {
5555
};
5656
```
5757

58-
Note how the `routes.js` file will match the controller's [name](#name) and the [action](#action)
58+
Note how the `routes.js` file will match the controller's [name](#name) and the [action](#action).
5959

6060
{% include pageDoc.html name="controller" %}
6161

0 commit comments

Comments
 (0)