# Exoskeleton This gem builds out the basic framework to use [Backbone.js](http://backbonejs.org/) along with templating abilities # Controller Prerequisite Please review the required format for data responses coming from your controllers which can be found [here](https://github.com/agapered/exoskeleton/wiki/Using-Backbone-Collections-and-Models) ## Installation Add this line to your application's Gemfile: gem 'exoskeleton' And then execute: $ bundle Or install it yourself as: $ gem install exoskeleton ## Usage This setup is going through the process when building a brand new rails application. Note: YOUR_APP_NAME is not a specific name, it just needs to be the same throughout. Add the following to `application.rb`: config.exoskeleton_base = 'YOUR_APP_NAME' Add the following to `application.js` before `//= require_tree .`: //= require exoskeleton //= require ./YOUR_APP_NAME //= require_tree ./backbone/views //= require_tree ./backbone/templates Then build the folder structure to hold all of your awesome Backbone. We use the following structure that can be built easily using the [backbone-rails](https://github.com/codebrew/backbone-rails) gem app/assets/javascripts/backbone/views app/assets/javascripts/backbone/models app/assets/javascripts/backbone/collections app/assets/javascripts/backbone/templates Create base javascript file `app/assets/javascripts/YOUR_APP_NAME.js` with the following content: YOUR_APP_NAME = { views:{} } $(function(){ var hello_view = new YOUR_APP_NAME.views.hello() $('body').append(hello_view.render().el) }) Create your first view `app/assets/javascripts/backbone/views/hello.js` with the following content: YOUR_APP_NAME.views.hello = exoskeleton.views.base_view.extend({ render: function(){ this.$el.html(YOUR_APP_NAME.templates['hello']) return this } }) Create your first template `app/assets/javascripts/templates/hello.jst.ejs.haml` with the following content: %h1 Hello from new view through exoskeleton! Generate a new view to show off the awesomness bundle exec rails g controller home index Start up your server rails s Navigate to the awesomness http://localhost:3000/home/index ## More Detailed Usage There are a few things to learn to use the full functionality of this gem. These items can be found on the [wiki](https://github.com/agapered/exoskeleton/wiki). ## Want to see this gem in action checkout: ###[https://github.com/agapered/exoskeleton_demo](https://github.com/agapered/exoskeleton_demo) ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request