No description, website, or topics provided.
JavaScript Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app/assets/javascripts/exoskeleton
lib
.gitignore
Gemfile
LICENSE.txt
README.md
Rakefile
exoskeleton.gemspec

README.md

Exoskeleton

This gem builds out the basic framework to use Backbone.js along with templating abilities

Controller Prerequisite

Please review the required format for data responses coming from your controllers which can be found here

Installation

Add this line to your application's Gemfile:

gem 'exoskeleton'

And then execute:

$ bundle

Or install it yourself as:

$ gem install exoskeleton

Usage

Mostly automated setup

Take a look at the AgapeRedRecipes gem

After installing the recipes gem

rails g recipe exoskeleton app_base_name:YOUR_APP_NAME

Manual setup

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. rails g exoskeleton:folders

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:{}
}

End Manual setup

In base javascript file add:

$(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.

Want to see this gem in action checkout:

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