0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
This gem adds Snap.js to the Rails asset pipeline
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

>= 3.1
 Project Readme

snap_js-rails

Add Snap.js to your asset pipeline.

Installation

Add this line to your application's Gemfile:

gem 'snap_js-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install snap_js-rails

Usage

Add this line to your application.js file.

//= require snap

Then, either add this to application.js below the requires...

$(function() {
  var snapper = new Snap({
    element: document.getElementById('content')
  });
})

... or add it directly to your layout file (i.e. application.html.erb)

<script type="text/javascript">
  var snapper = new Snap({
    element: document.getElementById('content')
  });
</script>

There's also an optional CSS stylesheet containing the barebones styles you'll need to get started (also from https://github.com/jakiestfu/Snap.js). To use it, add this to application.css:

*= require snap

A barebones application.html.erb might look like this:

...
<body>
  <div class="snap-drawers" style="position: absolute">
    <div class="snap-drawer snap-drawer-left">
      <!-- Left Drawer Content -->
    </div>
    <div class="snap-drawer snap-drawer-right">
      <!-- Right Drawer Content -->
    </div>
  </div>
  <div id="content" class="snap-content">
    <div id="toolbar">
      <!-- Toolbar Content -->
    </div>
    <%= yield %>
  </div>
</body>
...

Refer to Snap.js for more options.

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