Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Fixed broken formatting that had annotations showing up in a code sni…
Browse files Browse the repository at this point in the history
…ppet.
  • Loading branch information
Joe Catera committed Aug 14, 2012
1 parent 9d18bd2 commit 2c33c42
Showing 1 changed file with 42 additions and 41 deletions.
83 changes: 42 additions & 41 deletions docs/dev_guide/getting_started/mojito_getting_started_tutorial.rst
Expand Up @@ -118,49 +118,50 @@ You will now modify the controller, so that the ``index`` function called in the

#. Edit ``controller.server.js`` and replace the string 'Just a simple mojit.' in the code with 'Hello World!'. Your ``controller.server.js`` should look similar to the following code:

.. code-block:: javascript
YUI.add('HelloMojit', function(Y, NAME) {
/**
* The HelloMojit module.
*
* @module HelloMojit
**/
/**
* Constructor for the Controller class.
*
* @class Controller
* @constructor
*/
Y.mojito.controllers[NAME] = {
init: function(config) {
this.config = config;
},
/**
* Method corresponding to the 'index' action.
*
* @param ac {Object} The ActionContext that provides access
* to the Mojito API.
**/
index: function(ac) {
ac.models.HelloMojitModelFoo.getData(function(err, data) {
if (err) {
.. code-block:: javascript
YUI.add('HelloMojit', function(Y, NAME) {
/**
* The HelloMojit module.
*
* @module HelloMojit
**/
/**
* Constructor for the Controller class.
*
* @class Controller
* @constructor
*/
Y.mojito.controllers[NAME] = {
init: function(config) {
this.config = config;
},
/**
* Method corresponding to the 'index' action.
*
* @param ac {Object} The ActionContext that provides access
* to the Mojito API.
**/
index: function(ac) {
ac.models.HelloMojitModelFoo.getData(function(err, data) {
if (err) {
ac.error(err);
return;
}
ac.assets.addCss('./index.css');
ac.done({
status: 'Hello World!',
data: data
});
});
}
};
}, '0.0.1', {requires: ['mojito', 'HelloMojitModelFoo']});
}
ac.assets.addCss('./index.css');
ac.done({
status: 'Hello World!',
data: data
});
});
}
};
}, '0.0.1', {requires: ['mojito', 'HelloMojitModelFoo']});
As you can see the "controllers" are just an array of JavaScript objects, and the "action" is just a method called on the controller object.
The result of the method are communicated back to Mojito through the ``actionContext`` object.
Expand Down

0 comments on commit 2c33c42

Please sign in to comment.