<commit_before>![Chaplin](http://s3.amazonaws.com/imgly_production/3401027/original.png)

# Plain JS Boilerplate Application for Chaplin.js

This is a boilerplate applicatoin built with [Chaplin.js](https://github.com/chaplinjs/chaplin), an application structure on top of Backbone.js.

While Chaplin itself is coded in CoffeeScript, any front-end developer can put the
framework to use in their web applications.  This boilerplate serves as an example
for how to build a Chaplin-powered application using plain javascript.  Chaplin
(with the help of require.js) provides all the neccesary functionality and helpers
to code a clean, modular, easy to read application without the syntactic sugar that
CoffeeScript enables.

If you prefer coding in CoffeeScript, you should head over to the
[CoffeeScript Chaplin Boilterplate](https://github.com/chaplinjs/chaplin-boilerplate).

## Running the Example

Copy the contents of this folder to the document root of your favorite webserver.

Visit `index.html` in your browser.  If everything is running correctly you will
see a 'Hello World!' message render.

## Architectural Documentation

### Directory Structure

This example has a standard Chaplin MVC directory structure:

- `js/models`
- `js/views`
- `js/controllers`
- `js/libs`

All vendor libraries like jQuery and Backbone are located at `vendor/`.

A recently built copy of the base chaplin framework is located at `vendor/chaplin-amd-min.js`.

### Application Startup

There are two special files which are responsible for the application bootstrap:

- `js/hello_world_application.js`
- `js/routes.js`

`hello_world_application.js` is the application root class which inherits from `Chaplin.Application`. It starts up all Chaplin core modules and starts the routing. It is loaded and instantiated in `index.html`.

`routes.js` contains all application routes which map URLs to controller actions.

### Templating

Since Chaplin is template-engine agnostic, you have to decide which templating solution you want to use and how you want to load the templates. This example uses [Handlebars](http://handlebarsjs.com/) templates and loads them on-demand using the [RequireJS Text](http://requirejs.org/docs/api.html#text) plugin.

Chaplin expects that views implement the `getTemplateFunction` method which needs to return the actual templating function. Since all views in this example use the same templating solution, `getTemplateFunction` is provided once by two base classes all other views inherit from:

- `js/views/base/view.js`
- `js/views/base/collection_view.js`

The actual `.hbs` template files are located in the `js/templates` directory.

### Application-specific Extensions

To ease the development, this repository also provides application-specific base classes for models, collections and controllers. They inherit from the Chaplin base classes:

- `js/models/base/model.js`
- `js/models/base/collection.js`
- `js/controllers/base/controller.js`

Furthermore, `js/lib/support.js` and `js/lib/utils.js` demonstrate how to extend the feature testing and utility files of Chaplin.

Last but not least, this example uses a specific `Layout` class which can be found in `js/views/utils.js`.

## [The Cast](https://github.com/chaplinjs/chaplin/blob/master/AUTHORS.md#the-cast)

## [The Producers](https://github.com/chaplinjs/chaplin/blob/master/AUTHORS.md#the-producers)
<commit_msg>fixed typo<commit_after>![Chaplin](http://s3.amazonaws.com/imgly_production/3401027/original.png)

# Plain JS Boilerplate Application for Chaplin.js

This is a boilerplate applicatoin built with [Chaplin.js](https://github.com/chaplinjs/chaplin), an application structure on top of Backbone.js.

While Chaplin itself is coded in CoffeeScript, any front-end developer can put the
framework to use in their web applications.  This boilerplate serves as an example
for how to build a Chaplin-powered application using plain javascript.  Chaplin
(with the help of require.js) provides all the neccesary functionality and helpers
to code a clean, modular, easy to read application without the syntactic sugar that
CoffeeScript enables.

If you prefer coding in CoffeeScript, you should head over to the
[CoffeeScript Chaplin Boilerplate](https://github.com/chaplinjs/chaplin-boilerplate).

## Running the Example

Copy the contents of this folder to the document root of your favorite webserver.

Visit `index.html` in your browser.  If everything is running correctly you will
see a 'Hello World!' message render.

## Architectural Documentation

### Directory Structure

This example has a standard Chaplin MVC directory structure:

- `js/models`
- `js/views`
- `js/controllers`
- `js/libs`

All vendor libraries like jQuery and Backbone are located at `vendor/`.

A recently built copy of the base chaplin framework is located at `vendor/chaplin-amd-min.js`.

### Application Startup

There are two special files which are responsible for the application bootstrap:

- `js/hello_world_application.js`
- `js/routes.js`

`hello_world_application.js` is the application root class which inherits from `Chaplin.Application`. It starts up all Chaplin core modules and starts the routing. It is loaded and instantiated in `index.html`.

`routes.js` contains all application routes which map URLs to controller actions.

### Templating

Since Chaplin is template-engine agnostic, you have to decide which templating solution you want to use and how you want to load the templates. This example uses [Handlebars](http://handlebarsjs.com/) templates and loads them on-demand using the [RequireJS Text](http://requirejs.org/docs/api.html#text) plugin.

Chaplin expects that views implement the `getTemplateFunction` method which needs to return the actual templating function. Since all views in this example use the same templating solution, `getTemplateFunction` is provided once by two base classes all other views inherit from:

- `js/views/base/view.js`
- `js/views/base/collection_view.js`

The actual `.hbs` template files are located in the `js/templates` directory.

### Application-specific Extensions

To ease the development, this repository also provides application-specific base classes for models, collections and controllers. They inherit from the Chaplin base classes:

- `js/models/base/model.js`
- `js/models/base/collection.js`
- `js/controllers/base/controller.js`

Furthermore, `js/lib/support.js` and `js/lib/utils.js` demonstrate how to extend the feature testing and utility files of Chaplin.

Last but not least, this example uses a specific `Layout` class which can be found in `js/views/utils.js`.

## [The Cast](https://github.com/chaplinjs/chaplin/blob/master/AUTHORS.md#the-cast)

## [The Producers](https://github.com/chaplinjs/chaplin/blob/master/AUTHORS.md#the-producers)

{'fraction_non_alphanumeric': 0.08095378274948484, 'fraction_numerical': 0.0023550191345304682, 'mean_word_length': 4.81763698630137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1389180', 'n_tokens_mistral': 1900, 'n_tokens_neox': 1883, 'n_words': 781}